O'Reilly logo

Graphic Java™ 1.2, Volume I: AWT, Third Edition by David M. Geary

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Sequences and Sprites

Sprites must be able to perform two major functions:

  • Cycle through a sequence of images

  • Move about on a double buffered container

As previously mentioned, the rate at which each of these functions occurs can be set. A Sprite is responsible for moving itself about and timing its movement; however, it delegates the responsibility for cycling through a sequence of images to another object: a Sequence.

Sequence

Figure 25-1 shows the Sequence class diagram.

Figure 25-1. Sequence Class Diagram

As you can see, a Sequence maintains a vector of images that it cycles through. It also uses a stopwatch to control the rate at which it cycles ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required