Sensors and InputControllers

Sensors are a common way to control games on smartphones. They work fine when the only controls in the game are left and right (like a car racing game). If you plan to also move up and down, you need to ask the player to do a calibration at the beginning of the game to make it usable. Note that, when you are using only one axis, such calibration is not necessary.

In addition to this, the up and down movement tends to interfere with the sensorLandscape orientation. So, the use of sensors is not a very good idea for YASS.

Note

Sensors are good controls only in certain cases.

You also have to consider that, while sensors are a replacement for directions, you still need to place the action buttons on the screen—in our case, ...

Get Android Game Programming: A Developer’s Guide 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.