Images in Java (part 4)

Outline

Complete code to demonstrate animation of sprite

In this program, we read in two images: one is an asteroid, the other is a spritesheet of explosions. Both images are below. You can right click on them and save them in order to run this yourself.

Java Code


Explode.java

Sprites and Images


"green_asteroid.png"

There are 8 rows. Each has 14 sprites in it. Each sprite is 64x64 pixels.
This is not the best spritesheet as you can see that some are truncated. "explosions.png"