Book Image

Building Android Games with Cocos2d-x

By : Raydelto Hernandez
Book Image

Building Android Games with Cocos2d-x

By: Raydelto Hernandez

Overview of this book

Table of Contents (16 chapters)
Building Android Games with Cocos2d-x
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Pausing the game


Let us start and create our game. The first feature that we are going to add is the functionality for pausing and resuming our game. Let's start building – we'll start by setting up the screen that will appear when we pause the game.

We will achieve this by adding a new pause scene to the scene stack. When this screen is removed from the stack, the HelloWorld scene will show up because it was the displayed screen before the pause scene was pushed into the scene stack. The following code listing shows how we can easily pause our game:

Organizing our resources files

When we created our Cocos2d-x project, some resources such as images and fonts have been added by default to the Resources folder of our project. We are going to organize them, so that it is easier to handle them. For that matter, we are going to create an Image folder in the Resources directory. In this new folder, we are going to put all our images. Later on in this chapter, we will explain how we are going to organize...