gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Graphics > Another Sprite question

#3587 - sketcher - Fri Feb 28, 2003 6:03 pm

I am not currently doing in gba programming, nor have I for almost a year now :( Too busy with my game demo on PC right now...But that's another story.

Anyway, I still check out these boards and saw a couple sprite questions that reminded of a question I had from back when I was programming on the gba.

If your images are stored 1 dimensionally. 8x8 format, but your actual sprite is 32x32 or 16x16 etc...

How do you animate your sprites? The way I did this was that I had a character class. The character was made of all the "pieces" and then when he moved all pieces were updated.
It was the only way I could get animation to look right, but I always felt like it was a big hack.

So how does everyone else do this?

Thanks.
_________________
"Oh yeah, so what kind of warrior are you? A code warrior? HAHAHA!"

#3589 - tepples - Fri Feb 28, 2003 7:10 pm

In the 1D sprite memory mapping mode, a 32x32 pixel sprite at 4 bits per pixel will reference a contiguous block of 512 bytes of VRAM containing tile data in 8x8 pixel pieces from left to right and top to bottom. Just copy those 512 bytes from EWRAM (or ROM, if you're using uncompressed graphics) to VRAM to change the sprite's animation frame. Or load multiple frames into VRAM and change the sprite's "tile number" value.

See also http://www.pineight.com/gba/managing-sprite-vram.txt
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.