Sprite animations and cocos2d

It took a day or so, but I am finally getting cocos2d. Or it feels like that anyway.

The key to image based animations in cocos2d seems to be pyglet. Understanding both was key to much happiness. But doing so was like making origami without instructions. It is surprising that there are so few - easily found - examples of image animation management in cocos.

Creating the animations is very simple. pyglet.image.Animation is all that is needed. I use spritesheets so from_image_sequence is my new best friend. The key bit of information is that a cocos sprite inherits two important things from pyglet.sprite.Sprite: the property image, and the event on_animation_end. So I use image to assign the next to play animation to an existing sprite, and on_animation_end to know when it ..ends.