Using parallax backgrounds to create perspective
Applying a parallax background to a game can result in a visually-pleasing perspective effect. Even though we're working with a 2D engine, we can create a background which will gives off an illusion of depth through the use of parallax values which determine the movement speed of sprites based on the camera movement. This topic is going to introduce parallax backgrounds and how we can use them to add a sense of depth to an otherwise fully 2D world. The classes we will be using are the ParallaxBackground
and the AutoParallaxBackground
classes.
Getting ready…
This recipe requires basic knowledge of the Sprite
object in AndEngine. Please read through the entire recipe, Working with different types of textures in Chapter 1, AndEngine Game Structure. Next, please visit the recipe, Bringing a scene to life with sprites in Chapter 2, Working with Entities.
Once the recipes regarding textures and sprites have been covered, create a new AndEngine project...