Class ParallaxBackground
- Namespace
- Godot
- Assembly
- GodotSharp.dll
A ParallaxBackground uses one or more ParallaxLayer child nodes to create a parallax effect. Each ParallaxLayer can move at a different speed using MotionOffset. This creates an illusion of depth in a 2D game. If not used with a Camera2D, you must manually calculate the ScrollOffset.
Note: Each ParallaxBackground is drawn on one specific Viewport and cannot be shared between multiple Viewports, see CustomViewport. 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.
public class ParallaxBackground : CanvasLayer, IDisposable
- Inheritance
-
ParallaxBackground
- Implements
- Inherited Members
Constructors
ParallaxBackground()
public ParallaxBackground()
Properties
ScrollBaseOffset
The base position offset for all ParallaxLayer children.
public Vector2 ScrollBaseOffset { get; set; }
Property Value
ScrollBaseScale
The base motion scale for all ParallaxLayer children.
public Vector2 ScrollBaseScale { get; set; }
Property Value
ScrollIgnoreCameraZoom
If true
, elements in ParallaxLayer child aren't affected by the zoom level of the camera.
public bool ScrollIgnoreCameraZoom { get; set; }
Property Value
ScrollLimitBegin
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 ScrollLimitBegin { get; set; }
Property Value
ScrollLimitEnd
Bottom-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.
public Vector2 ScrollLimitEnd { get; set; }
Property Value
ScrollOffset
The ParallaxBackground's scroll value. Calculated automatically when using a Camera2D, but can be used to manually manage scrolling when no camera is present.
public Vector2 ScrollOffset { get; set; }
Property Value
Methods
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.