Skip to reading
GDScript Programming & Godot

Set2DParallax()

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

Set 2D Layer Parallax

Change a named 2D layer's parallax ratio.

Source table from Set2DParallax(), page 153
Option key / fieldMeaning and inputDefault
Room (empty = current) sceneIdChoose a scene ID. May be blank.Blank
2D Layer ID layerIdText.Blank
Parallax Ratio XY ratio[X, Y] numeric array.[1.0, 1.0]

Timing. Waits for the runtime routine to return; no further completion wait is promised by this schema.

Code example
await Set2DParallax({"sceneId": "lab", "layerId": "", "ratio": [1.0, 1.0]})

In use. Use a smaller camera-motion ratio for a distant sky and a larger one for nearby scenery. The layer must already be set up with suitable artwork and coverage; a ratio does not extend the bitmap.

Page 153 of 378Permalink
Go to page