Parallax is a 3D effect that is achieved using scrolling 2D images. Instead of using just one background image, a scene's background can be comprised of several overlaid images. Parallax is achieved if the foreground image scrolls fastest and each image that represents a depth that is further away from the viewer scrolls progressively slower, as shown in the example below.
Example of a parallax background (Run Example).
In this example, we have three overlaid images, each moving at different speeds
gameObjects = new ScrollingBackgroundImage(skyImage, 30); gameObjects = new ScrollingBackgroundImage(middleImage, 40); gameObjects = new ScrollingBackgroundImage(foregroundImage, 50);