O'Reilly logo

Learning iPhone Game Development with Cocos2D 3.0 by Kirill Muzykov

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

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 ...

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