Chapter 8

Creating a Complex Title Screen

In This Chapter

arrow Starting Whack-a-Mole

arrow Implementing a title screen with SurfaceView

arrow Adding options menus to your games

arrow Enabling and disabling sound

This chapter sets you on your way toward making an arcade-style game with animations and sounds: a mobile-game version of the classic carnival game Whack-a-Mole. In case you’ve never heard of the game or played it yourself, it typically has a play area littered with a series of holes. When the game starts, a pesky mole pops up from one or more of the holes. The player’s task is to whack the mole on the head as fast as possible, using a hand or a striking object, such as a mallet. The game ends after a set time limit expires or when the player doesn’t whack the moles fast enough.

In your digital version, the play screen displays a field of seven holes, with moles popping up at random locations. You start slowly and then increase the rate at which the moles appear. Figure 8-1 shows a mock-up of the play screen.

When a mole pops up from a hole, the player’s score is rendered in the lower left corner; ...

Get Android Game Programming For Dummies 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.