December 2011
Beginner
693 pages
19h 56m
English
As with the Assets class, you can again reuse what you wrote for the previous games, to some extent. You can now store an additional Boolean that tells you whether the user wants to use the touchscreen or the accelerometer for moving the ship. You can drop the high-score support, as you don't need to keep track of this. As an exercise, you can, of course, reintroduce both the high-score screen and the saving of these scores to the SD card. Listing 12–2 shows you the code.
Listing 12–2. Settings.java, Same Old, Same Old
package com.badlogic.androidgames.droidinvaders;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter; ...Read now
Unlock full access