Book Image

Cocos2d Game Development Blueprints

By : Jorge Jordán
Book Image

Cocos2d Game Development Blueprints

By: Jorge Jordán

Overview of this book

Table of Contents (15 chapters)
Cocos2d Game Development Blueprints
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Developing virtual game controls


I think that one of the reasons why beat 'em up games have lost popularity on smartphones is the fact that there is no game pad to control the character's movements. Touchable screens have conditioned games to be played by using the accelerometer or handling touches; that's why it's not usual to find titles like the classic arcade games. In the case of existing games, their playability is not comparable to handling a joystick and beating almost-indestructible buttons.

Despite this, we can emulate game pads by designing some places on the screen to react to touches and convert them into movements and actions. These touchable areas must be well-defined to track fingers moving on them, so let's get to work and make our own controller.

We're going to create a separate class to specify the pad's behavior due to the amount of methods and variables we will need to manage:

  1. Right-click on the Classes group in the project navigator and select New File….

  2. Click on iOS |...