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 ...

Get Graphic Java™ 1.2, Volume I: AWT, Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.