Book Image

Mastering Cocos2d Game Development

By : Alex Ogorek
Book Image

Mastering Cocos2d Game Development

By: Alex Ogorek

Overview of this book

Table of Contents (15 chapters)
Mastering Cocos2d Game Development
About the Author
About the Reviewers

Creating menus, scenes, and scene transitions

Scenes make up the core of Cocos2d. When you go from the main menu to the Level Select screen, those are (when done in a best practice coding way) two different scenes. You can transition from one scene to another in any way your heart desires. However, it's generally done by tapping a button. For example, Play, Settings, and Shop are all examples of a menu button that a user might press to trigger a scene transition.

Creating a new file for the scene

Most likely, your game isn't going to have just one screen. If so, then you can skim over this as it likely won't pertain to you. However, the vast majority of games made have at the very least a main menu, a settings menu, a pause screen, and some sort of screen besides the main game screen.

The next few screenshots show how to create a file with a CCNode object as the parent class. If you already know how to do this, feel free to skip to the next step.

In Xcode, right-click (or press Ctrl and click...