Applying a background
AndEngine's Scene
object allows us to apply a static background to it. The background can be used to display a solid color, an entity, a sprite, or a repeating sprite which are not affected by changes to the Camera
object's position or zoom factor. In this recipe, we're going to take a look at how to apply the different types of backgrounds to our Scene
object.
How to do it..
The Background
object is the most basic type of background for our Scene
object in AndEngine. This object allows the scene to visually represent a solid color. We will start this recipe off by setting up the Scene
object to display a Background
object in order to become familiar with how applying backgrounds to a scene works. Later on in this recipe we'll be introducing the majority of the remaining Background
object's subtypes in order to cover all options as far as applying backgrounds to our scene goes. Setting the Scene
object up with a background involves just two steps as follows:
Define the...