animation speed
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
void AnimateSprite(Sprite* sprite)
{
if(GetTime() - prevTime() >= spriteAnimSpeed)
sprite->GetNextFrame();
}
see what I mean?
------------------------------
Jonathan Little
invader@hushmail.com
http://www.crosswinds.net/~uselessknowledge
January 29, 2000 05:21 AM
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
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
Popular Topics
Advertisement
Recommended Tutorials
Advertisement