O'Reilly logo

Cocos2d-x Game Development Essentials by Gareth Jones, Arutosh Gurung, Frahaan Hussain

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

Manipulating scenes

Without functionality, moving between scenes is not possible and they would be useless. Cocos2d-x provides great methods to move from one scene to another. Before you take a look at these methods, you need to understand how Cocos2d-x manages scenes.

Cocos2d-x uses a stack to manage scenes, which is a Last-In First-Out (LIFO) system that runs the latest scene in the stack. The following are the main methods that are used to move between scenes:

  • Pushing a scene: This method pushes a particular scene onto the stack while keeping the current scene but pauses its execution. A real-world example for this is when you click on a pause button, the Pause scene will be pushed onto the stack, while the Game scene still exists.
  • Popping a scene ...

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