The GameScreen Class

Once the game transitions to the GameScreen class, the player can immediately start playing without having to state that he or she is ready. The only states you have to care about for are these:

  • The running state, where you render the background, the world, and the UI elements, as shown in Figure 12–4.
  • The paused state, where you render the background, the world, and the paused menu, as shown in Figure 12–4.
  • The game-over state, where you render pretty much the same thing.

Follow the same method used in Super Jumper, and have different update() and present() methods for each of the three states.

The only interesting part of this class is how you handle the user input to move the ship. You want your player to be able to ...

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.