Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

ParallaxBackground

Inherits: CanvasLayer < Node < Object

A node used to create a parallax scrolling background.

Description

A ParallaxBackground uses one or more ParallaxLayer child nodes to create a parallax effect. Each ParallaxLayer can move at a different speed using ParallaxLayer.motion_offset. This creates an illusion of depth in a 2D game. If not used with a Camera2D, you must manually calculate the scroll_offset.

Note: Each ParallaxBackground is drawn on one specific Viewport and cannot be shared between multiple Viewports, see CanvasLayer.custom_viewport. When using multiple Viewports, for example in a split-screen game, you need create an individual ParallaxBackground for each Viewport you want it to be drawn on.

Properties

int

layer

-100 (overrides CanvasLayer)

Vector2

scroll_base_offset

Vector2(0, 0)

Vector2

scroll_base_scale

Vector2(1, 1)

bool

scroll_ignore_camera_zoom

false

Vector2

scroll_limit_begin

Vector2(0, 0)

Vector2

scroll_limit_end

Vector2(0, 0)

Vector2

scroll_offset

Vector2(0, 0)


Property Descriptions

Vector2 scroll_base_offset = Vector2(0, 0)

  • void set_scroll_base_offset ( Vector2 value )

  • Vector2 get_scroll_base_offset ( )

The base position offset for all ParallaxLayer children.


Vector2 scroll_base_scale = Vector2(1, 1)

  • void set_scroll_base_scale ( Vector2 value )

  • Vector2 get_scroll_base_scale ( )

The base motion scale for all ParallaxLayer children.


bool scroll_ignore_camera_zoom = false

  • void set_ignore_camera_zoom (