Animating a sprite in Cocos2d-x
The key thing to remember is that an animation is just another type of action, one that changes the texture used by a sprite over a period of time.
In order to create an animation action, you need to first create an Animation
object. This object will store all the information regarding the different sprite frames you wish to use in the animation, the length of the animation in seconds, and whether it loops or not.
With this Animation
object, you then create a Animate
action. Let's take a look.