O'Reilly logo

Beginning Android 4 Games Development by Robert Green, Mario Zechner

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required