Skip to content

Components

Parallax

A background layer that moves at a fraction of the camera's own motion, so distant art drifts slower than the room and reads as further away.

On this page

Add it

+ Add node → Parallax creates a node with it already on. Already have a node for it? Add component → ParallaxComponent.

From a script

A script on the same node writes these fields by name. ParallaxComponent is the name to pass.

rgs
set_point("ParallaxComponent", "factor", vec2(0.5, 0.5));
set_point("ParallaxComponent", "offset", vec2(0.0, 0.0));
set_point("ParallaxComponent", "autoscroll", vec2(0.0, 0.0));
set_colour("ParallaxComponent", "color", vec4(1.0, 1.0, 1.0, 1.0));
set_flag("ParallaxComponent", "repeat_x", true);
set_flag("ParallaxComponent", "repeat_y", false);
set_point("ParallaxComponent", "repeat_period", vec2(0.0, 0.0));

Fields

FieldScript nameKindDefaultWhat it does
Factorfactortwo numbers (x, y), 0 to 1, step 0.01(0.5, 0.5)How much of the camera's own motion this layer is carried along by, per axis.
Offsetoffsettwo numbers (x, y)(0, 0)A constant shift applied on top of the parallax scrolling.
Autoscrollautoscrolltwo numbers (x, y)(0, 0)World units per second this layer drifts on its own.
Colorcolorcolour#ffffffTint applied to everything drawn under this layer; a light keeps its own colour.
Repeat Xrepeat_xcheckboxonRepeat horizontally so the layer never runs out: its sprites and tilemaps are copied, and everything else under it is drawn once.
Repeat Yrepeat_ycheckboxoffRepeat vertically, for a shaft or a well the camera falls down: its sprites and tilemaps are copied, and everything else under it is drawn once.
Repeat Periodrepeat_periodtwo numbers (x, y), at least 0(0, 0)With Repeat X or Y on, how far apart the whole layer's copies sit. At zero, each sprite is copied by its own size and each tilemap by the area its painted tiles cover.