Documentation
¶
Overview ¶
A Parallax2D is used to create a parallax effect. It can move at a different speed relative to the camera movement using ScrollScale. This creates an illusion of depth in a 2D game. If manual scrolling is desired, the Camera2D position can be ignored with IgnoreCameraScroll.
Note: Any changes to this node's position made after it enters the scene tree will be overridden if IgnoreCameraScroll is false or ScreenOffset is modified.
Index ¶
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode2D() Node2D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsParallax2D() Instance
- func (self Instance) Autoscroll() Vector2.XY
- func (self Instance) FollowViewport() bool
- func (self Instance) ID() ID
- func (self Instance) IgnoreCameraScroll() bool
- func (self Instance) LimitBegin() Vector2.XY
- func (self Instance) LimitEnd() Vector2.XY
- func (self Instance) RepeatSize() Vector2.XY
- func (self Instance) RepeatTimes() int
- func (self Instance) ScreenOffset() Vector2.XY
- func (self Instance) ScrollOffset() Vector2.XY
- func (self Instance) ScrollScale() Vector2.XY
- func (self Instance) SetAutoscroll(value Vector2.XY)
- func (self Instance) SetFollowViewport(value bool)
- func (self Instance) SetIgnoreCameraScroll(value bool)
- func (self Instance) SetLimitBegin(value Vector2.XY)
- func (self Instance) SetLimitEnd(value Vector2.XY)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetRepeatSize(value Vector2.XY)
- func (self Instance) SetRepeatTimes(value int)
- func (self Instance) SetScreenOffset(value Vector2.XY)
- func (self Instance) SetScrollOffset(value Vector2.XY)
- func (self Instance) SetScrollScale(value Vector2.XY)
- func (self Instance) Virtual(name string) reflect.Value
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsCanvasItem ¶
func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
func (*Extension[T]) AsParallax2D ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.Parallax2D
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AsParallax2D ¶
func (Instance) Autoscroll ¶
Velocity at which the offset scrolls automatically, in pixels per second.
func (Instance) FollowViewport ¶
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.
func (Instance) IgnoreCameraScroll ¶
If true, Parallax2D's position is not affected by the position of the camera.
func (Instance) LimitBegin ¶
Top-left limits for scrolling to begin. If the camera is outside of this limit, the Parallax2D stops scrolling. Must be lower than LimitEnd minus the viewport size to work.
func (Instance) LimitEnd ¶
Bottom-right limits for scrolling to end. If the camera is outside of this limit, the Parallax2D will stop scrolling. Must be higher than LimitBegin and the viewport size combined to work.
func (Instance) RepeatSize ¶
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.
func (Instance) RepeatTimes ¶
Overrides the amount of times the texture repeats. Each texture copy spreads evenly from the original by RepeatSize. Useful for when zooming out with a camera.
func (Instance) ScreenOffset ¶
Offset used to scroll this Parallax2D. This value is updated automatically unless IgnoreCameraScroll is true.
func (Instance) ScrollOffset ¶
The Parallax2D's offset. Similar to ScreenOffset and Node2D.Position, but will not be overridden.
Note: Values will loop if RepeatSize is set higher than 0.
func (Instance) ScrollScale ¶
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.
func (Instance) SetAutoscroll ¶
SetAutoscroll sets the property returned by [GetAutoscroll].
func (Instance) SetFollowViewport ¶
SetFollowViewport sets the property returned by [GetFollowViewport].
func (Instance) SetIgnoreCameraScroll ¶
SetIgnoreCameraScroll sets the property returned by [IsIgnoreCameraScroll].
func (Instance) SetLimitBegin ¶
SetLimitBegin sets the property returned by [GetLimitBegin].
func (Instance) SetLimitEnd ¶
SetLimitEnd sets the property returned by [GetLimitEnd].
func (Instance) SetRepeatSize ¶
SetRepeatSize sets the property returned by [GetRepeatSize].
func (Instance) SetRepeatTimes ¶
SetRepeatTimes sets the property returned by [GetRepeatTimes].
func (Instance) SetScreenOffset ¶
SetScreenOffset sets the property returned by [GetScreenOffset].
func (Instance) SetScrollOffset ¶
SetScrollOffset sets the property returned by [GetScrollOffset].
func (Instance) SetScrollScale ¶
SetScrollScale sets the property returned by [GetScrollScale].