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 addition, we are going to use the CCTransition
class for a smooth transition between scenes, and of course, we are going to add more scenes to our game.