🎉 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!

Capping how fast an animation plays

Started by
1 comment, last by Shaarigan 2 years, 11 months ago

Hey,

so I am playing around with SDL and trying to make a little game with that. My current issue while getting sprite animations to play is that they play as fast as possible. How am I able to say play an animation at 30 or 60 FPS or what ever I want to set them at?

Let me know if you need any more information!

Thanks for any help,

Loomina

Advertisement

You have two options to achieve that, by either capping your entire game loop to a fixed update time. How to do this is frequently asked and discussed for example here:

https://www.gamedev.net/forums/topic/707282-questions-about-fixed-timestep-game-loop/

Or the other option is to either have a second update like Unity provides (aka FixedUpdate) or couple your animations to a time delta. I guess the later is more complex so you should try to add a second update loop that runs on a fixed frequency. This can not just be useful to animations but physics as well if there is need for it one day

This topic is closed to new replies.

Advertisement