O'Reilly logo

Cocos2d Cross-Platform Game Development Cookbook - Second Edition by Siddharth Shekar

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

Adding a MainMenu Scene

To create the main menu scene, first create a new project and follow the steps in Chapter 1, Sprites and Animations, to load the MainScene file upon loading the game. Also, don't forget to make changes to the CCBReader.m file and change the folder search parameter.

Getting ready

For this step, no additional steps are required. Later in the chapter, we will discuss how to make more complex scenes with the custom init function.

For now, we will use MainScene as the MainMenu scene and start populating it with text, buttons, and functions to transition between the scenes.

How to do it…

As of now, we have a MainMenu.h file that looks similar to the following:

@interface MainScene : CCNode

+(CCScene*)scene;

@end

We also have a MainScene.m ...

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