Struct ParallaxBackground

A node used to create a parallax scrolling background.

struct ParallaxBackground ;

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

Properties

NameTypeDescription
scrollBaseOffset[get, set] Vector2The base position offset for all ParallaxLayer children.
scrollBaseScale[get, set] Vector2The base motion scale for all ParallaxLayer children.
scrollIgnoreCameraZoom[get, set] boolIf true, elements in ParallaxLayer child aren't affected by the zoom level of the camera.
scrollLimitBegin[get, set] Vector2Top-left limits for scrolling to begin. If the camera is outside of this limit, the background will stop scrolling. Must be lower than scrollLimitEnd to work.
scrollLimitEnd[get, set] Vector2Bottom-right limits for scrolling to end. If the camera is outside of this limit, the background will stop scrolling. Must be higher than scrollLimitBegin to work.
scrollOffset[get, set] Vector2The ParallaxBackground's scroll value. Calculated automatically when using a Camera2D, but can be used to manually manage scrolling when no camera is present.

Methods

NameDescription
_cameraMoved
getLimitBegin
getLimitEnd
getScrollBaseOffset
getScrollBaseScale
getScrollOffset
isIgnoreCameraZoom
setIgnoreCameraZoom
setLimitBegin
setLimitEnd
setScrollBaseOffset
setScrollBaseScale
setScrollOffset