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.

Coding > keeping speed and setting frames

#1988 - imikeyi - Mon Jan 27, 2003 6:44 am

I'm currently working on my first GBA game and its progressing well at this stage..
The basic structure for my code is:

    1 update game related data based on input etc
    2 wait for X vblanks
    3 update VRAM
    4 goto 1


With my game the sprites are animated alot, for any move they make, even when they are just standing they are still being animated. At this stage of my game though what happens is some animation appears to occur too fast and some too slow. For example, a 'jump' move would need a fair few frames of animation; similarly a walk action may only need a few frames.. what I don't know is how many frames each move needs. At the moment they all have the same number of frames which makes the whole game look and feel jerky.

So my question is, how can I determine the number of frames I should be using for each animation? Is there a set method to do it, or do I have to use trial and error?

Thanks
_________________
microkernel advance

#1995 - Splam - Mon Jan 27, 2003 1:52 pm

Probably trial and error. If your game is running at 60fps then sometimes (sounds like your case) you don't want the animations to ALL run that fast. I've got an animation editor in my tools whichh allows me to set a "frame wait" of the number of vsyncs between frames (can be different for each fram of an anim), without an editor though you'll probably have to guess.

#2042 - imikeyi - Tue Jan 28, 2003 4:17 am

I think the best way for me to do it is just to multiply everything against a special constant. I think 6 is good because its a multiple of 60fps.
For a walk animation, it might take 1/2 a second, so the number of frames could be 1/2*6 = 3 frames.
Similarly a jump may take 1 second, so 1*6 = 6 frames should be used.
_________________
microkernel advance