Jump to content

Photo

16x16 1bit sprite won't show up


5 replies to this topic

#1 flux OFFLINE  

flux

    Space Invader

  • 48 posts

Posted Wed Jan 2, 2019 5:27 PM

I got stuck on this issue a while back and decided to get back into it and still wasn't able to come up with a solution so I'm going to try reaching out. I have a 1 bit 16x16 single frame sprite that refuses to show up. I tried making a 64x64 1 bit sprite using the same program and method and it seems to load ok (the palette seems off but it's there at least). But the 16x16 version inexplicably refuses to appear.

 

The changes I make in rapinit.s between the two are on these lines:

dc.l	16	; sprite_width	; width of sprite (in pixels)
dc.l	16	; sprite_height	; height of sprite (in pixels)
dc.l	1	; (BIT DEPTH)	; bitmap depth (1/2/4/8/16/24)
dc.l	16*16/8	; sprite_framesz	; size per frame in bytes of sprite data
dc.l	16/8	; sprite_bytewid	; width in bytes of one line of sprite data
dc.l	16/8	; sprite_gwidth	; GFX width (of data)

dc.l	64	; sprite_width	; width of sprite (in pixels)
dc.l	64	; sprite_height	; height of sprite (in pixels)
dc.l	1	; (BIT DEPTH)	; bitmap depth (1/2/4/8/64/24)
dc.l	64*64/8	; sprite_framesz	; size per frame in bytes of sprite data
dc.l	64/8	; sprite_bytewid	; width in bytes of one line of sprite data
dc.l	64/8	; sprite_gwidth	; GFX width (of data)

Besides specifying a different filename in assets.txt, that's really the only thing that changes and I'm not sure why it would show up in one instance and not the other. I did clear out the build files and everything when switching between the two different files. I'm still not 100% clear on the whole dividing by 8 or 2 thing but I feel like I have it correct there. Once, when playing around with those numbers I did get my sprite to appear when I changed sprite_bytewid to 16/2. It was as tall as it should be but was maybe 4 or 5 times as wide, like a big rectangle instead of a square with the graphic all distorted and messed around (not simply stretched). Both 16/16 and 16/4 left me with my sprite still not appearing, and 16/1 gave me an even wider rectangle, perhaps twice as wide. So it may well be the case that I'm doing something wrong in that rapinit.s file but as I have it there in the code paste, it simply doesn't appear at all.

 

(It might also be worth noting I don't have transparency turned on for that sprite or anything like that.)



#2 CyranoJ ONLINE  

CyranoJ

    RAPTOR Wrangler

  • 5,756 posts
  • reBOOTed
  • Location:Adelaide, SA

Posted Wed Jan 2, 2019 6:02 PM

I might be wrong, but afair 64 wide is the smallest a 1-bit image can be.



#3 Zerosquare OFFLINE  

Zerosquare

    River Patroller

  • 2,766 posts
  • Location:France

Posted Wed Jan 2, 2019 9:31 PM

Objects have to be at least one phrase-wide, which is 64 pixels in 1-bit mode. If the width is less, you have to pad it to 64 pixels.

#4 joeyaage OFFLINE  

joeyaage

    Star Raider

  • 64 posts

Posted Fri Jan 4, 2019 6:36 AM

You could try using using blank space around your 16x16 sprite to make it up to 64 pixels wide by 16 pixels high. I think you should be okay with using 16 pixels for the height!



#5 ggn OFFLINE  

ggn

    Stargunner

  • 1,463 posts
  • Location:Athens, Greece

Posted Fri Jan 4, 2019 7:38 AM

Alternatively you could change your object to 4bit colour depth, so each line then would need 16x4=64 bits (one phrase)



#6 swapd0 OFFLINE  

swapd0

    Moonsweeper

  • 389 posts

Posted Fri Jan 4, 2019 12:00 PM

I think that if you want to draw a lot 16x16 pixels sprites, it's better to use a 4bits sprite because the OP don't waste time drawing empty pixels.





Reply to this topic



  


0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users