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

The Cocos2d update loop

In our game, the update method was seen for the first time. This will most likely be used in every game, so it will now be covered in more detail.

There are two types of update methods:

  • update:(CCTime)delta: This update method has a dynamic time step. It is called directly before the frame is rendered. Cocos2d attempts to render your game at 60 frames per second.

    Note

    If your game consumes too much processing time, then the game's frame rate will decrease. The update method will then be called less-than 60 times per second.

    The delta parameter shows the time since the last update call in milliseconds.

  • fixedUpdate:(CCTime)delta: This update method is guaranteed to be called at a specified interval. It is recommended to use this ...

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