Chapter 4
Animation and Game Programming
In This Chapter
Using threads to control animation
Creating a bouncing ball
Creating a whole room full of bouncing balls
Devising a simple Pong-like game
Because of its powerful drawing capabilities, Java lends itself especially well to creating game programs — especially games that are created as applets so they can be played over the Internet. Game programming is a huge subject, big enough for a whole shelf of books. In this chapter, I just scratch the surface of creating basic animations and playing simple games. Specifically, you find out how to get a ball bouncing in an applet, how to create a paddle to hit the ball, and how to find out when you miss.
In other words, welcome to the 1970s! You're going to create an applet that plays Pong!
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access
This chapter combines features that are presented in several chapters throughout this book. Specifically, you find information about drawing shapes in Book IX, Chapter