Time for action – alternative control using a gyroscope

It will be even more fun to control our hunter using a gyroscope.

Note

A Gyroscope is a device that measures an iPhone's orientation. Using a gyroscope, you can tell how your iPhone is positioned in the world. This way, if you track the gyroscope information, you can track when the user tilts or rotates a device in hands. A gyroscope is often used in racing games, where you can use your iPhone as a steering wheel. We'll use it to control the hunter's aim.

Unfortunately, only happy owners of the iOS devices and participants of the Apple iOS Developer Program can test the code in this part of the chapter, as you cannot test a gyroscope on the simulator.

Note

You can still follow this chapter to ...

Get Learning iPhone Game Development with Cocos2D 3.0 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.