Creating Animation Using Images

After you have graphics files loaded into Image objects, animating them requires the same techniques you used to move around text, circles, and other graphics. The biggest difference is that you have to devise a way to display the right images in the right places.

The best way to show how to animate images is to work through an example. The next project, one of the longest you will undertake, is an application that draws a cartoon penguin walking across a backdrop of ice blocks and stone barriers.

Pixel Pete Takes a Walk

The Pete application features an animated penguin called Pixel Pete, a character in a Java game applet called Iceblox that was written by Karl Hörnell. Hörnell, who publishes his games on the Web ...

Get Sams Teach Yourself Java 2 in 21 Days, Second 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.