O'Reilly logo

Cocos2d Cross-Platform Game Development Cookbook - Second Edition by Siddharth Shekar

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 3. Gestures, Touches, and the Accelerometer

The topics covered in this chapter are as follows:

  • Understanding swipe
  • Implementing tap
  • Adding LongPress
  • Adding pinch/zoom controls
  • Adding rotation objects
  • Adding panning
  • Including touches
  • Creating objects with touchBegan
  • Moving objects with touchMoved
  • Customizing touches in the sprite class
  • Adding an accelerometer
  • Adding a directional pad

Introduction

Gestures and touches are the main way to interact with any application. The gestures are swipe, tap, hold, pinch/zoom, rotate, and pan. All these gestures are used in a wide array of applications and are widely used in games as well.

Apart from gestures, there are also touches that can be used to make custom touch interactions. The touch functions keep track ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required