O'Reilly logo

Mastering Android Game Development by Raul Portales

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Parallax backgrounds

Another typical feature of 2D games that is deeply related to the DrawThread is parallax backgrounds.

The idea of a parallax background is to have an image that moves slower than the elements in the foreground, giving the impression of depth.

Note

Parallax backgrounds are used to create an illusion of depth in 2D games.

To make this effect better, we can use multiple background images at different speeds. This is commonly used in 2D scrollers. For example with trees in the near plane and mountains and clouds at the very back.

For YASS, we will use a star field that moves down slowly as a background.

We are going to use the same convention of units as we used for the sprites. The image we use for the background should be designed ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required