Chapter 10: Coding the Bat and Ball

As we have done so much theory and preparation work in the previous two chapters, we can quickly make some progress on this one. We already have our bare-bones game engine coded and ready to update, draw, and track time down to the nearest millisecond.

Now we can add code to the Bat and the Ball classes. By the end of the chapter, we will have a moving ball and a player-moveable bat. Although we will need to wait until the next chapter before the ball bounces off the walls and the bat, we will also code the necessary methods in the Ball class so that this last step will be easy to achieve.

In this chapter, we are going to do the following:

  • Coding the Ball class
  • Implementing an instance of Ball in the game ...

Get Learning Java by Building Android Games - Third Edition 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.