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

Chapter 4. User Input

So far, we have added the graphics that move around the screen and collide with each other, but it is not fun yet, since the player cannot control our main character and it would not be a game unless our user can interact with it. In this chapter we will add user interaction to our game. The following topics will be covered within this chapter:

  • Understanding the Event Dispatcher mechanism

  • Handling the touch event

  • Handling the accelerometer events

  • Keeping the screen alive

  • Handling the Android back key pressed event