Chapter 9

Creating an Animated Play Screen

In This Chapter

arrow Implementing simple animations

arrow Using sounds in your game

arrow Handling real-time interactivity

Understanding how to layer images to create the visual effects you want in your game, animate elements on the screen, handle real-time interactivity, and load and play sounds are all critical skills necessary to develop many types of games. This chapter will teach you the basic approach to all these skills and put you well on your way to developing your own game using these effects.

On to the meat of the Whack-a-Mole game!

Handling Images for the Play Screen

You actually want your players to be able to whack those onscreen moles. That’s the point of the game. To do that, you need moles to pop out of holes. Figure 9-1 shows what your mole image looks like.

Figure 9-1: Mole image.

9781118235997-fg0901.eps

Scary, isn’t he? The basic approach you take is to have three layers of graphics: the background, the moles, and masks that the mole images sit behind. To make more sense of this, look at Figure 9-2.

Figure 9-2: Play screen with mole and mask for Hole ...

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.