25 · Camera · 2D (and 2.5D)

Parallax scrolling

Background layers that move slower to fake depth.

Flat 2D games feel deep when far layers scroll slower than near ones. Each layer moves by the camera movement times a factor: mountains 0.2, trees 0.5, the ground 1, and foreground grass a bit above 1. It is cheap and one of the strongest ways to make a 2D world look rich.

←→ moveP parallax on/offHold ◀ ▶ to move

Try this: Run with parallax off: the background is a painted wall. Turn it on with P and run again.

Run left and right.

Prompt bit

Works for 2D or 3D in any engine (Unity, Unreal, Godot, web). Paste the short one for a quick fix, or the detailed one when you want it done properly.

Add parallax background layers: offset each layer by camera position times its depth factor (0.1 for sky, 0.5 for hills, 1 for gameplay, 1.2 for foreground), wrap each layer seamlessly, and snap slow layers to whole pixels so they never shimmer while the camera drifts.

45 words · one sentence to paste as is

Where it's used

Common mistakes

Moving layers by speed instead of by camera position (they drift apart when the camera stops), seams when a layer wraps, foreground layers hiding hazards, and sub-pixel shimmer on slow pixel-art layers.

Writing this with an AI assistant? See our best AI coding assistants for game developers.

Missing a concept? Request one.

Related concepts

New concepts, in your inbox.

One short email when we add new concepts, plus our weekly roundup of AI tools for game devs. Unsubscribe any time.