The Settings Screen

The settings screen offers the player an option to change the input method, as well as enable or disable audio. Indicate this with three different icons (see Figure 12–4). Touching either the hand or the tilted device will enable the respective input method. The icon for the currently active input method will have a gold color. For the audio icon, do the same as in the previous games.

The choices of the user are reflected by setting the respective Boolean values in the Settings class. Make sure these settings are instantly saved to the SD card each time one of them changes, via a call to Settings.save(). Listing 12–5 shows you the code.

Listing 12–5. SettingsScreen.java, the Settings Screen

package com.badlogic.androidgames.droidinvaders; ...

Get Beginning Android 4 Games 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.