Double Buffering and Animation

From draggable lightweights, it's not too far a leap to a sprite class that can animate itself, as shown in Figure 24-1.

Figure 24-1. Sprites Animated on a Playfield

Sprites animate through a sequence of images; their movement, speed, and rate of animation are all settable. In the Sprite Animation chapter, you'll find a discussion of the Sprite class, a playfield on which that sprites are animated, animate on, in addition to collision detectors capable of detecting collisions between sprites and between sprites and the boundaries of their playfield.

Get Graphic Java™ 1.2, Volume I: AWT, 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.