Book Image

Learning iPhone Game Development with Cocos2D 3.0

By : Kirill Muzykov
Book Image

Learning iPhone Game Development with Cocos2D 3.0

By: Kirill Muzykov

Overview of this book

Table of Contents (19 chapters)
Learning iPhone Game Development with Cocos2D 3.0
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Time for action – using the scroll view to select levels


It is nice to have good transitions from the menu, but currently, we can't even start the game since we display almost an empty scene for level selection. The reason for this whole scene is that in some games, you have multiple levels. I'm sure you can remember some popular game where you scroll between levels or game types.

Sometimes, the game can have so many levels that they don't fit on one screen. Of course, we could create different scenes and plan transitions just as we did on the menu scene, but in most cases, we just need a scroll view. This is exactly what we're going to do now; we're going to add a scroll view. Refer to the following steps:

  1. Open the LevelSelectScene.m file, and import the GameScene.h header since we're going to navigate to this scene for one of our levels:

    #import "GameScene.h"
  2. Right after the #import directives, add two #define statements. These will be our level names to distinguish them in the scroll view...