Time for action – pausing the game with a pause dialog
We will start with adding a pause dialog to allow the player to pause the game:
- Create a new group in
Resources
and call itDialogs
. Then, open the book's supporting files inChapter_09/Assets/Dialogs
and add all the images to that group. - Create a new Objective-C class in the
Scenes
group. Name the classPauseDialog
and make it a subclass ofCCNode
.Tip
Note that it is a subclass of
CCNode
notCCScene
. We have used a similar approach when we created theHUDLayer
class. You can read Chapter 6, Rendering Text, to refresh your memory. We are going to useCCNode
as a base class for all dialogs. - Open the
PauseDialog.h
file and add the following property. It will allow the object, which creates the dialog ...
Get Learning iPhone Game Development with Cocos2D 3.0 now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.