O'Reilly logo

Cocos2d for iPhone 0.99 Beginner's Guide by Pablo Ruiz

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

Time for action - adding a difficulty selection screen

Let's create a simple layer that asks the player to select a difficulty level. He will be able to choose from easy, normal, and extreme, where the last option will be disabled. We will show this layer when the player selects "New game" from the main menu and it will show a menu with those three menu items.

When one of them is touched, we will pass the selected difficulty to the GameScene which in turn will pass the value to the GameLayer to adjust the difficulty level. You may do this in other ways like storing the selected value in a variable in the AppDelegate or saving this to the user preferences. I will do it by passing the values around scenes and layers so I can show you how to do that. ...

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