Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning AndEngine

You're reading from   Learning AndEngine Design and create Android games with the simple but powerful tool AndEngine

Arrow left icon
Product type Paperback
Published in Sep 2014
Publisher
ISBN-13 9781783985968
Length 286 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Martin Varga Martin Varga
Author Profile Icon Martin Varga
Martin Varga
Arrow right icon
View More author details
Toc

Parallax background

When travelling by train, mountains in the distance seem to be static, but trees and grass next to the track move very fast. In 2D games, a similar effect is simulated by a parallax background. It adds a feeling of depth to the game. A parallax background contains a few layers. The player is usually in the front, but there can be a layer in front of the player as well. This simulates objects that are closer to the camera.

When the camera moves, the layers in the back are scrolled slowly and the layers in front are scrolled faster; the same as in our train example.

In platformers, we often use a static background with a few parallax layers. It's a good idea to make the background less prominent and less distracting, but nevertheless beautiful. Some of the layers can move automatically; for example, clouds can move even though the camera is static.

Here's a typical example of a parallax background: a blue sky and a sun as a background, clouds that can move a little...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime