Navigating between scenes

Now, when we have all those buttons on the menu scene, we should make them work. In the early chapters of the book, we discussed the significance of the CCDirector class. We have already used some of its properties, and of course, we have used the replaceScene: method to load the game scene when you tap on the Start button.

With replaceScene:, everything should be quite clear. You create a new scene and pass it to the replaceScene: method, and now, this new scene is running and the old one is terminated and deallocated.

In this part of the chapter, we are going to use another method of the CCDirector class called pushScene. This method can be used to display the scene without deallocating the currently running scene. In ...

Get Learning iPhone Game Development with Cocos2D 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.