• Advertisement
Sign in to follow this  

Frame Independent Motion/Animation in SDL

This topic is 2180 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I've done a lot of research to find nothing, so I'm posting here. Here goes nothing.

I have two images: a red circle and a blue circle. I have some controls set up. I want the sprite to swap between the red circle and the blue circle every half second and I want it to move across the screen at the same speed of forty pixels per second, both independent from the frame rate. Can anyone give me a minimal example of this being done in C (not C++ or C#... C)? Thank you. :)

Share this post


Link to post
Share on other sites
Advertisement
I found something about that while I was Googling, but it has to do with C++. The timer class likely isn't present in C itself because C++ is C with Classes. There has to be some other alternative in C to what is available in C++. Or maybe I could program my own time calculator and integrate that in there...

Share this post


Link to post
Share on other sites
Thanks! So I can set up some if statements and if the time elapsed is equal to or beyond a certain value, change the animation frame for the player and/or the position? Good. Thanks! :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement