Images in Java (part 4)


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

Sprites and Images


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"