Custom cocos2d Action for rotating a sprite around an arbitrary point

Cocos2d is and excellent framework. It has saved me tons of time during my game projects. It offers almost everything I need. However, sometimes there are some features that are not supported by cocos2d.

This is the case of rotating a sprite around an arbitrary point. Rotation in cocos2d is based on the concept of anchor point. This is ok on the 99% of situations, probably. However, during the development of Muster my Monsters I need to perform rotations around arbitrary points. The idea is to have an sprite “orbiting” around another sprite or some defined point in the space.

cocos2d rotation around arbitrary point

Continue reading

Sprite sheets. Managing them easily on Cocos2d

In today’s post I would like to share with you a handy piece of code to manage sprite sheets. I have called it TSSpriteSheetManager.

TSSpriteSheetManager is a singleton cocos2d class that allows for easily manage sprite sheets. You just add sprite sheets to the manager and then request a sprite or frame automatically batched for you. The manager will search for the sprite in all the added sprite sheets and if it is not in any of them, it will search for individual files on your project.

You have the entire source code for this project at the end of this article.

Sprite sheet Muster my Monsters

Continue reading