Advertisement

animation speed

Started by January 28, 2000 09:45 PM
2 comments, last by +AA_970+ 24 years, 8 months ago
hi, how would i set the speed of a sprite''s animation? Basically i want something like: draw frame 1 wait a few milliseconds draw frame 2 wait draw frame 3 etc...
All you have to do is check the time whenever you animate the sprite:

void AnimateSprite(Sprite* sprite)
{
if(GetTime() - prevTime() >= spriteAnimSpeed)
sprite->GetNextFrame();
}

see what I mean?

------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
Advertisement
THANK YOU!!!
i got it working perfectly.
if(GetTime() - prevTime() >= spriteAnimSpeed)
sprite->GetNextFrame();

Might be a good idea to use ''while'' instead of ''if'' here. If the system froze up for a second, or you want to implement a pause feature on your game, the animation would look a bit funny when the game is unpaused.

Regards

Starfall

This topic is closed to new replies.

Advertisement