O'Reilly logo

Cocos2D Game Development Essentials by Ben Trengrove

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Animation in code

Of course, you don't have to use SpriteBuilder when developing for Cocos2d. Sometimes, SpriteBuilder won't be capable of what you are trying to achieve. For these situations, you can of course perform animation within your code. There is a powerful animation engine built straight into Cocos2d.

Moving, scaling, and rotating

In the last section, you saw how you can keep track of time since an event starter and use that knowledge in the update method to change an attribute of a node. You can write all your animation like this, but there is a much simpler way to accomplish simple animations. This method uses CCAction. By using CCAction, you can accomplish many animations, such as move, rotate, and scale.

Here is a list of CCActions ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required