C H A P T E R  6

A Ball and Paddle Game

In Chapter 5, you built a simple game in which a player dodged moving bombs. This gave you an excuse to use many of features and programming concepts central to creating games on an Android tablet. In this chapter, you build a more sophisticated game.

Your big task for this chapter is to build a pong-type game in which players use a paddle to keep a ball bouncing as they attempt to hit and destroy blocks with the ball. My first experience with a mobile game was on an old Blackberry where the only offering was this simple game. I had to control the paddle with the clumsy Blackberry trackball, and the small screen size and low resolution made the effort less than satisfying. Surprisingly, that game was written with the powerful Java language, the same one you use here to create your much more engrossing and fun game.

As you build the paddle game, you’ll master new skills you can add to your toolbox. You add additional images to your resource files. You replace the character and bombs from the Chapter 5 AllTogether game with a paddle and blocks. To keep the ball in motion, you manage the interaction of the sprites and detect a greater number of collisions. You have to add some additional physics to the game, requiring more calculations on the fly. You also reward players more effectively with sounds and disappearing blocks. Finally, you learn a technique to initialize multiple blocks with a single XML layout file.

Let’s get started.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.50.29