A node used to create a parallax scrolling background.
    public class ParallaxBackground : CanvasLayer

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.

Inheritance Chain

Constructors

    public ParallaxBackground()

Properties

    public Vector2 ScrollBaseOffset { get; set; }

Base position offset of all ParallaxLayer children.

    public Vector2 ScrollBaseScale { get; set; }

Base motion scale of all ParallaxLayer children.

    public bool ScrollIgnoreCameraZoom { get; set; }

If true elements in ParallaxLayer child aren’t affected by the zoom level of the camera.

    public Vector2 ScrollLimitBegin { get; set; }

Top 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.

    public Vector2 ScrollLimitEnd { get; set; }

Right bottom 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.

    public Vector2 ScrollOffset { get; set; }

The ParallaxBackground’s scroll value. Calculated automatically when using a Camera2D, but can be used to manually manage scrolling when no camera is present.

Methods

    public Vector2 GetLimitBegin()

Getter for ScrollLimitBegin

    public Vector2 GetLimitEnd()

Getter for ScrollLimitEnd

    public Vector2 GetScrollBaseOffset()

Getter for ScrollBaseOffset

    public Vector2 GetScrollBaseScale()

Getter for ScrollBaseScale

    public Vector2 GetScrollOffset()

Getter for ScrollOffset

    public bool IsIgnoreCameraZoom()

Getter for ScrollIgnoreCameraZoom

    public void SetIgnoreCameraZoom(bool ignore)

Setter for ScrollIgnoreCameraZoom

    public void SetLimitBegin(Vector2 ofs)

Setter for ScrollLimitBegin

    public void SetLimitEnd(Vector2 ofs)

Setter for ScrollLimitEnd

    public void SetScrollBaseOffset(Vector2 ofs)

Setter for ScrollBaseOffset

    public void SetScrollBaseScale(Vector2 scale)

Setter for ScrollBaseScale

    public void SetScrollOffset(Vector2 ofs)

Setter for ScrollOffset

Tags: