Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

ParallaxLayer

Inherits: Node2D < CanvasItem < Node < Object

A parallax scrolling layer to be used with ParallaxBackground.

描述

A ParallaxLayer must be the child of a ParallaxBackground node. Each ParallaxLayer can be set to move at different speeds relative to the camera movement or the ParallaxBackground.scroll_offset value.

This node's children will be affected by its scroll offset.

Note: Any changes to this node's position and scale made after it enters the scene will be ignored.

属性

Vector2

motion_mirroring

Vector2(0, 0)

Vector2

motion_offset

Vector2(0, 0)

Vector2

motion_scale

Vector2(1, 1)


Property Descriptions

Vector2 motion_mirroring = Vector2(0, 0)

The ParallaxLayer's Texture2D repeating. Useful for creating an infinite scrolling background. If an axis is set to 0, the Texture2D will not be repeated.

If the length of the viewport axis is bigger than twice the repeated axis size, it will not repeat infinitely, as the parallax layer only draws 2 instances of the texture at any given time.

Note: Despite its name, the texture will not be mirrored, it will simply be repeated.


Vector2 motion_offset = Vector2(0, 0)

  • void set_motion_offset ( Vector2 value )

  • Vector2 get_motion_offset ( )

The ParallaxLayer's offset relative to the parent ParallaxBackground's ParallaxBackground.scroll_offset.


Vector2 motion_scale = Vector2(1, 1)

  • void set_motion_scale ( Vector2 value )

  • Vector2 get_motion_scale ( )

Multiplies the ParallaxLayer's motion. If an axis is set to 0, it will not scroll.