Bringing a scene to life with sprites
Here, we come to the topic which might be considered to be the most necessary aspect to creating any 2D game. Sprites allow us to display 2D images on our scene which can be used to display buttons, characters/avatars, environments and themes, backgrounds, and any other entity in our game which may require representation by means of an image file. In this recipe, we'll be covering the various aspects of AndEngine's Sprite
entities which will give us the information we need to continue to work with Sprite
objects later on in more complex situations.
Getting ready…
Before we dive into the inner-workings of how sprites are created, we need to understand how to create and manage AndEngine's BitmapTextureAtlas
/BuildableBitmapTextureAtlas
objects as well as the ITextureRegion
object. For more information, please refer to the recipes, Working with different types of textures and Applying texture options in Chapter 1, AndEngine Game Structure.
Once these recipes...