Chapter 4

Animation and Game Programming

In This Chapter

arrow Using threads to control animation

arrow Creating a bouncing ball

arrow Creating a whole room full of bouncing balls

arrow 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!

tip.eps This chapter combines features that are presented in several chapters throughout this book. Specifically, you find information about drawing shapes in Book IX, Chapter 2. For information about working ...

Get Java All-in-One For Dummies, 4th 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.