🎉 Celebrating 25 Years of GameDev.net! 🎉
Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!
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
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