Chapter 6

Accelerometer and Actions




Your test device is probably covered in smudges from all that heartfelt touching in the last chapter. The first thing we'll look at this chapter is using the Accelerometer, which is one of the coolest ways of touch-free interaction with your device. So give your iPad a good wipe down and it should stay that way for a bit.

We'll also spend a long time looking into CCAction classes, which are typically just a couple lines of code that handle animating things like fades, movements, rotations, and even special effects similar to the Filters in Photoshop. Actions can also be composed together to play through a sequence or repeat endlessly. The best part is that they are incredibly easy to set up, so all you ...

Get iOS Game Programming with Xcode and Cocos2d now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.