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

Creating modal dialogs and using text input


Often, there are moments in the game when you need to display a dialog and require the user to choose an option before continuing. For example, you might want to prompt for the player's name when they achieve a highscore.

Of course, you can just use the pushScene: method and display the whole new scene. However, sometimes, these dialogs are so small and you want them to cover only a small portion of the underlying scene.

Also, sometimes, you don't want to suspend the running scene while showing the dialog. There are tons of other cases when you might want to show a modal dialog without a separate scene.

In this chapter, we are going to create several custom dialogs and use the built-in UIAlertView class. We are going to create a pause dialog, a dialog to enter the highscore, and a dialog that is displayed after you win or lose the game.