SFML community forums
Help => General => Topic started by: Kain5056 on June 07, 2013, 11:41:37 am
-
Hello everybody, I am quite new to SFML and programming in general, and I have a simple question to see if I undestand things right.
As I see in every tutorial, every time you want to animate an entity, you need to restart the clock after every animation cycle.
Does that mean that you need a seperate clock for every entity, or is there a way to use just one clock for all entities?
I have not found a Tutorial that specifies this issue yet, so I apologize if it is mentioned somewhere and I missed it.
Thank you in advance. :)
-
You don't need clocks for animations. You only need a single clock to measure the frame time, and pass that time to the animations.
You could also have a look at how I implemented animations in Thor: API documentation (http://www.bromeon.ch/libraries/thor/v2.0/doc/group___animation.html), bigger example (https://github.com/Bromeon/Thor/blob/master/examples/Animation.cpp). The animations take a sf::Time value and affect the sprite correspondingly.
-
Thanks for the help. :-) That's all I needed to know. :-)