Cocos2D-x Tutorials Part 6: Switching between scenes
In this tutorial we are going to see how to create a menu for our game that will let us switch between different game scenes.
There are multiple ways to design a menu in cocos2d-x. In the default generated code we can see how to create a menu with sprites. Here we will see how we can create our menu with LabelTTF or simple text. The process is quite simple. Lets see some code:
Go to AppDelegate.cpp and change the Line 33 :
auto scene = MenuScene::createScene();
Also include these 2 lines after Line 2:
We have all the code in our hand, so lets see what the code is doing for us:
First of all, let us write the steps to create a menu:
- Create a LabelTTF object. (MenuScene.cpp line 31 and 32)
- Create a MenuItemLabel with the label object with a callback attached. (Line...
Continue reading →