#5124 - 00kevin - Mon Apr 21, 2003 5:11 pm
Hi,
I have a few questions regarding sprites. I would like to understand how a set of animation frames are normaly translated into sprite data.
From what i have read, there are 128 OAM Entries available for this purpose. Some of the spirtes in my game have over 100 frames. Should i use one OAM entry per sprite and simply swap the OAM image every time the sprite changes to a new frame? Is this the correct way to handle this?
thanks
#5126 - DekuTree64 - Mon Apr 21, 2003 5:22 pm
Usually it depends on how many frames/how many sprites you have. You can either load all of your frames to VRAM and just switch the tile in oam attr2, which is the fastest way, or you can copy in new frames as needed, so the sprite is only using the VRAM it actually needs at the moment. Then you can have a lot more sprites on screen at once, but it takes time to copy in the new frames. The second method is almost always better though, cause the first is just too wasteful unless you only have a few frames per sprite.
#5151 - Psyk - Tue Apr 22, 2003 7:57 am
I use the first method, i just switch the sprite tile number. But i only have 9 frames of animation per sprite. You could do a hybrid of both ways where you have about 3 or 4 frames saved into VRAM and copy in a new one as you are displaying another. That would speed things up a bit but not use too much VRAM.
#5154 - delbogun - Tue Apr 22, 2003 8:49 am
in some games, not all frames is put into gba ram (such as golden sun). those games have only one frame stored in ram and than updates the stored frame to create an animation instead of updating oam. isn't this method more power consuming and slower?
#5164 - DekuTree64 - Tue Apr 22, 2003 3:31 pm
Yea, instead of just one hword write, you have to copy 512 bytes for a 16x32, 256 color sprite (like Golden Sun).
I think PsyK's idea would be best to like load all the frames for the current walking direction, and use OAM to swap between them, since you know you'll be needing them all repeatedly.