A 2D line.
    public class Line2D : Node2D

A line through several points in 2D space.

Inheritance Chain


    public Line2D()


    public LineCapMode BeginCapMode { get; set; }

Controls the style of the line’s first point. Use LINE_CAP_* constants. Default value: LINE_CAP_NONE.

    public Color DefaultColor { get; set; }

The line’s color. Will not be used if a gradient is set.

    public LineCapMode EndCapMode { get; set; }

Controls the style of the line’s last point. Use LINE_CAP_* constants. Default value: LINE_CAP_NONE.

    public Gradient Gradient { get; set; }

The gradient is drawn through the whole line from start to finish. The default color will not be used if a gradient is set.

    public LineJointMode JointMode { get; set; }

The style for the points between the start and the end.

    public Vector2[] Points { get; set; }

The points that form the lines. The line is drawn between every point set in this array.

    public int RoundPrecision { get; set; }

The smoothness of the rounded joints and caps. This is only used if a cap or joint is set as round.

    public float SharpLimit { get; set; }

The direction difference in radians between vector points. This value is only used if joint mode is set to LINE_JOINT_SHARP.

    public Texture Texture { get; set; }

The texture used for the line’s texture. Uses texture_mode for drawing style.

    public LineTextureMode TextureMode { get; set; }

The style to render the texture on the line. Use LINE_TEXTURE_* constants. Default value: LINE_TEXTURE_NONE.

    public float Width { get; set; }

The line’s width.


    public void AddPoint(Vector2 position)

Add a point at the position. Appends the point at the end of the line.

    public LineCapMode GetBeginCapMode()

Getter for BeginCapMode

    public Color GetDefaultColor()

Getter for DefaultColor

    public LineCapMode GetEndCapMode()

Getter for EndCapMode

    public Gradient GetGradient()

Getter for Gradient

    public LineJointMode GetJointMode()

Getter for JointMode

    public int GetPointCount()

Returns the Line2D’s amount of points.

    public Vector2 GetPointPosition(int i)

Returns point i’s position.

    public Vector2[] GetPoints()

Getter for Points

    public int GetRoundPrecision()

Getter for RoundPrecision

    public float GetSharpLimit()

Getter for SharpLimit

    public Texture GetTexture()

Getter for Texture

    public LineTextureMode GetTextureMode()

Getter for TextureMode

    public float GetWidth()

Getter for Width

    public void RemovePoint(int i)

Remove the point at index i from the line.

    public void SetBeginCapMode(LineCapMode mode)

Setter for BeginCapMode

    public void SetDefaultColor(Color color)

Setter for DefaultColor

    public void SetEndCapMode(LineCapMode mode)

Setter for EndCapMode

    public void SetGradient(Gradient color)

Setter for Gradient

    public void SetJointMode(LineJointMode mode)

Setter for JointMode

    public void SetPointPosition(int i, Vector2 position)

Overwrites the position in point i with the supplied position.

    public void SetPoints(Vector2[] points)

Setter for Points

    public void SetRoundPrecision(int precision)

Setter for RoundPrecision

    public void SetSharpLimit(float limit)

Setter for SharpLimit

    public void SetTexture(Texture texture)

Setter for Texture

    public void SetTextureMode(LineTextureMode mode)

Setter for TextureMode

    public void SetWidth(float width)

Setter for Width

Inner Types


Name Value Description
None 0 Don’t have a line cap.
Box 1 Draws the line cap as a box.
Round 2 Draws the line cap as a circle.


Name Value Description
Sharp 0 The line’s joints will be pointy. If [code]sharp_limit[/code] is greater than the rotation of a joint, it becomes a bevel joint instead.
Bevel 1 The line’s joints will be bevelled/chamfered.
Round 2 The line’s joints will be rounded.


Name Value Description
None 0 Takes the left pixels of the texture and renders it over the whole line.
Tile 1 Tiles the texture over the line. The texture need to be imported with Repeat Enabled for it to work properly.
Stretch 2 Stretches the texture across the line. Import the texture with Repeat Disabled for best results.