Make Animated Explosions
We could make an explosion with a single image, but it wouldn’t look very convincing. Our explosion starts as a bright yellow ball of flame and then fades away, turning a darker orange and getting smaller. You do this by drawing sixteen images in the same location. When the explosion first appears, you draw the first in the sequence of images. Each subsequent time the game runs the draw method, the next image in the sequence is drawn.
Use a Sprite Sheet
One way to load your images would be to copy sixteen individual image files into your project and then load them into an array of images. This would work fine, though it might involve a lot of typing. Game artists often group related images together by stitching them ...
Get Learn Game Programming with Ruby 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.