Advertisement

Help with speed of animations.

Started by August 05, 2001 03:37 AM
2 comments, last by FlorianapoliS 23 years, 6 months ago
Hey, I've finished my pong game, and I've decide to move to a sort of action/adventure game similar to zelda. The only problem I'm having so far is that the animations of the character walking are to quick. heres the code:
    
  if(key[KEY_DOWN])
{

check_down(); //checks whether or not there is a wall in the way.


//gets animation state


if (frame_number == 1)
    {
     frame_number = 0;
    } 
     else
    {
     frame_number = 1;
    }

}
  
it gets them from an allegro .dat file using this
      
   draw_sprite(buffer, man_picture[frame_number].dat, man.x, man.y);
    
So if someone can tell me how to slow this down it would be a great help, thanks for your time. Edited by - FlorianapoliS on August 5, 2001 4:38:47 AM
One way is to use static variables to keep track of the time since you last changed the frame of the animation. Every time the movement code is called, check if the time elapsed is greater than 0.25 seconds (or whatever time period you want between frame changes). If it is, change the frame and set the timer back to zero. If it''s not, do nothing.
Advertisement
You have made a pong and now you want to make a Zelda?... hmmm... I think you should make some tetris clone first, then pacman and then mario bros. after that you''ll have enough skills to strart doing a basic tile based RPG like Zelda....


but ok... go on if you feel like you can do it...

good luck!

jakovo
"lots of shoulddas, coulddas, woulddas in the air, thinking about things they shouldda couldda wouldda donne, however all those shoulddas coulddas woulddas ran away when they saw the little did to come"
By Zelda i meant that view, it will be no where near as advanced.

thanks for your help I will try using static variables

This topic is closed to new replies.

Advertisement