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 - creating a pause menu

Now we will see how to create a CCColorLayer and use it to display a pause screen. Along with that I will teach you a way to actually pause the game. So when you press the pause button, or press the lock button, or receive a call, the elements of the game stop moving and then when you wish to, gameplay is resumed.

Actually, the template already created some helpful code for handling the pausing, when the game stops/resumes activity. Check the AerialGunAppDelegate, and you will find the following two methods:

-(void) applicationWillResignActive:(UIApplication *)application { [[CCDirector sharedDirector] pause]; } - (void)applicationDidBecomeActive:(UIApplication *)application { [[CCDirector sharedDirector] ...

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