Skip to Main Content
Learning iPhone Game Development with Cocos2D 3.0
book

Learning iPhone Game Development with Cocos2D 3.0

by Kirill Muzykov
June 2014
Beginner to intermediate content levelBeginner to intermediate
434 pages
9h 49m
English
Packt Publishing
Content preview from Learning iPhone Game Development with Cocos2D 3.0

Time for action – restarting and exiting the game

There are still two buttons in the pause dialog that currently simply output to the console instead of actually doing something. Let's add the code for the Exit and Restart buttons. In addition, we are going to create a LoadingScene class, which will help us to avoid memory errors and will use UIAlertView to confirm the exit from the game.

Looks like a lot of work, so let's start:

  1. Open the Xcode project and create a new scene named LoadingScene in the Scenes group.
  2. Then, open the PauseDialog.m file and import the LoadingScene.h and MenuScene.h headers:
    #import "LoadingScene.h"
    #import "MenuScene.h"
  3. Find the btnRestartTapped: method and replace its contents with the following code:
    -(void)btnRestartTapped:(id)sender ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit

Beginning Swift Games Development for iOS: Develop 2D and 3D games Using Apple's SceneKit and SpriteKit

James Goodwill, Wesley Matlock

Publisher Resources

ISBN: 9781782160144Supplemental Content