Parallax Background
A background that moves with the camera at a factor (0 = fixed, 1 = world), repeating and optionally drifting.
Type: ParallaxNode · Category: Graphics & Rendering · Also found as: parallax, parallaxlayer
Properties
Section titled “Properties”| Property | Type | Default | Description |
|---|---|---|---|
texturePath |
string | "" |
Background texture. |
factor |
vec2 | (0.5, 0.5) |
Movement relative to the camera: 1 moves with the world, 0 stays fixed on screen. Range 0 to 2. |
repeatX |
boolean | true |
Tile horizontally to fill the view. |
repeatY |
boolean | false |
Tile vertically to fill the view. |
scrollSpeed |
vec2 | (0, 0) |
Drifts by itself (px/s; clouds). Range -1000 to 1000. |
tint |
color | #ffffffff |
Multiplies the texture’s colours (white = unchanged; alpha fades it). |
Plus the common properties every node has.
Lua methods
Section titled “Lua methods”Call them on the node (self.node in its script, or self.node:get_node("path")). Every node also has the Node methods.
ParallaxNode:get_property(path)
Section titled “ParallaxNode:get_property(path)”Reads an Inspector property by its path (vectors and colours as tables); “script.
local value = self.node:get_property("texturePath")pathParallaxNodeProperty|string
Returns any
ParallaxNode:set_property(path, value, y)
Section titled “ParallaxNode:set_property(path, value, y)”Sets an Inspector property by its path: vectors as {x, y} or x, y; colours as {r, g, b[, a]} 0..1 or “#rrggbb[aa]”; enums by name; “script.
self.node:set_property("texturePath", "text")pathParallaxNodeProperty|stringvalueanyy?number
In a scene file
Section titled “In a scene file”{ "type": "ParallaxNode", "name": "ParallaxBackground", "position": [ 0, 0 ], "properties": { "texturePath": "", "factor": [ 0.5, 0.5 ], "repeatX": true }}