Chapter     13

Handling Device Input

Although our bowling game is up and running on iOS, it’s not quite in a playable state, because we don’t have any working player controls. Which brings us to the issue of input handling, perhaps the most obvious difference between desktop and mobile games.

Instead of reading the mouse or keyboard, an iOS game has to use one of its device sensors, typically the touchscreen (tapping and swiping) or accelerometer (shaking and tilting). We’ll opt for touchscreen input to control the bowling ball, but we’ll do some shake detection with the accelerometer and play with the device camera a little bit, too.

The project for this chapter on http://learnunity4.com/ has the script changes introduced in this chapter, and ...

Get Learn Unity 4 for iOS Game Development 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.