In this chapter, we have reviewed the SpriteSheet and PackedSpriteSheet classes that continue to build out our game engine for Sir Lamorak's Quest. These classes enable us to retrieve sub-images from within a specified image in a number of ways:
- SpriteSheet class: As a new Image instance based on a sprite's grid location.
- PackedSpriteSheet class: As an Image reference based on a sprite's key (for example, the sub-image's original filename).
These important classes enable us to not only manage the number of textures we need, but also provide us with a mechanism for grabbing the images needed to create animation.
Classes such as Image, SpriteSheet, and PackedSpriteSheet are the building blocks that form the backbone of our game engine. Being comfortable with how they work and how they can be used enable you to get the most out of the game engine itself, as well as a clearer view of how to implement your own games. Although the game engine we are building for Sir Lamorak's Quest is not suited to all types of games, it provides you with the basis for any future games you want to develop. This enables you to take the game engine in new directions as your needs and experience grow.
The next chapter covers animation. It's not exactly Pixar Animation,2 but animation nonetheless.