reckfellENGINE

Parallax2D

A node used to create a parallax scrolling background.

On this page
class Parallax2DReckfellSharpInherits Entity2D

A node used to create a parallax scrolling background.

A Parallax2D is used to create a parallax effect. It can move at a different speed relative to the camera movement using Parallax2D.ScrollScale. This creates an illusion of depth in a 2D game. If manual scrolling is desired, the Camera2D position can be ignored with Parallax2D.IgnoreCameraScroll. Note: Any changes to this node's position made after it enters the scene tree will be overridden if Parallax2D.IgnoreCameraScroll is false or Parallax2D.ScreenOffset is modified.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Constructors1

Parallax2DConstructor
# Parallax2D
C#
public Parallax2D();

Properties10

AutoscrollProperty
# Autoscroll
C#
public Vector2 Autoscroll { get; set; }

Velocity at which the offset scrolls automatically, in pixels per second.

FollowViewportProperty
# FollowViewport
C#
public bool FollowViewport { get; set; }

If true, this Parallax2D is offset by the current camera's position. If the Parallax2D is in a CanvasLayer separate from the current camera, it may be desired to match the value with CanvasLayer.FollowViewportEnabled.

IgnoreCameraScrollProperty
# IgnoreCameraScroll
C#
public bool IgnoreCameraScroll { get; set; }

If true, Parallax2D's position is not affected by the position of the camera.

LimitBeginProperty
# LimitBegin
C#
public Vector2 LimitBegin { get; set; }

Top-left limits for scrolling to begin. If the camera is outside of this limit, the Parallax2D stops scrolling. Must be lower than Parallax2D.LimitEnd minus the viewport size to work.

LimitEndProperty
# LimitEnd
C#
public Vector2 LimitEnd { get; set; }

Bottom-right limits for scrolling to end. If the camera is outside of this limit, the Parallax2D will stop scrolling. Must be higher than Parallax2D.LimitBegin and the viewport size combined to work.

RepeatSizeProperty
# RepeatSize
C#
public Vector2 RepeatSize { get; set; }

Repeats the Texture2D of each of this node's children and offsets them by this value. When scrolling, the node's position loops, giving the illusion of an infinite scrolling background if the values are larger than the screen size. If an axis is set to 0, the Texture2D will not be repeated.

RepeatTimesProperty
# RepeatTimes
C#
public int RepeatTimes { get; set; }

Overrides the amount of times the texture repeats. Each texture copy spreads evenly from the original by Parallax2D.RepeatSize. Useful for when zooming out with a camera.

ScreenOffsetProperty
# ScreenOffset
C#
public Vector2 ScreenOffset { get; set; }

Offset used to scroll this Parallax2D. This value is updated automatically unless Parallax2D.IgnoreCameraScroll is true.

ScrollOffsetProperty
# ScrollOffset
C#
public Vector2 ScrollOffset { get; set; }

The Parallax2D's offset. Similar to Parallax2D.ScreenOffset and Entity2D.Position, but will not be overridden. Note: Values will loop if Parallax2D.RepeatSize is set higher than 0.

ScrollScaleProperty
# ScrollScale
C#
public Vector2 ScrollScale { get; set; }

Multiplier to the final Parallax2D's offset. Can be used to simulate distance from the camera. For example, a value of 1 scrolls at the same speed as the camera. A value greater than 1 scrolls faster, making objects appear closer. Less than 1 scrolls slower, making objects appear further, and a value of 0 stops the objects completely.

Methods20

GetAutoscrollVector2
# GetAutoscroll
C#
public Vector2 GetAutoscroll();
Returns Vector2
GetFollowViewportbool
# GetFollowViewport
C#
public bool GetFollowViewport();
Returns bool
GetLimitBeginVector2
# GetLimitBegin
C#
public Vector2 GetLimitBegin();
Returns Vector2
GetLimitEndVector2
# GetLimitEnd
C#
public Vector2 GetLimitEnd();
Returns Vector2
GetRepeatSizeVector2
# GetRepeatSize
C#
public Vector2 GetRepeatSize();
Returns Vector2
GetRepeatTimesint
# GetRepeatTimes
C#
public int GetRepeatTimes();
Returns int
GetScreenOffsetVector2
# GetScreenOffset
C#
public Vector2 GetScreenOffset();
Returns Vector2
GetScrollOffsetVector2
# GetScrollOffset
C#
public Vector2 GetScrollOffset();
Returns Vector2
GetScrollScaleVector2
# GetScrollScale
C#
public Vector2 GetScrollScale();
Returns Vector2
IsIgnoreCameraScrollbool
# IsIgnoreCameraScroll
C#
public bool IsIgnoreCameraScroll();
Returns bool
SetAutoscrollvoid
# SetAutoscroll
C#
public void SetAutoscroll(Vector2 autoscroll);
Parameters
NameTypeDefault
autoscrollVector2—
SetFollowViewportvoid
# SetFollowViewport
C#
public void SetFollowViewport(bool follow);
Parameters
NameTypeDefault
followbool—
SetIgnoreCameraScrollvoid
# SetIgnoreCameraScroll
C#
public void SetIgnoreCameraScroll(bool ignore);
Parameters
NameTypeDefault
ignorebool—
SetLimitBeginvoid
# SetLimitBegin
C#
public void SetLimitBegin(Vector2 offset);
Parameters
NameTypeDefault
offsetVector2—
SetLimitEndvoid
# SetLimitEnd
C#
public void SetLimitEnd(Vector2 offset);
Parameters
NameTypeDefault
offsetVector2—
SetRepeatSizevoid
# SetRepeatSize
C#
public void SetRepeatSize(Vector2 repeatSize);
Parameters
NameTypeDefault
repeatSizeVector2—
SetRepeatTimesvoid
# SetRepeatTimes
C#
public void SetRepeatTimes(int repeatTimes);
Parameters
NameTypeDefault
repeatTimesint—
SetScreenOffsetvoid
# SetScreenOffset
C#
public void SetScreenOffset(Vector2 offset);
Parameters
NameTypeDefault
offsetVector2—
SetScrollOffsetvoid
# SetScrollOffset
C#
public void SetScrollOffset(Vector2 offset);
Parameters
NameTypeDefault
offsetVector2—
SetScrollScalevoid
# SetScrollScale
C#
public void SetScrollScale(Vector2 scale);
Parameters
NameTypeDefault
scaleVector2—
Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.