← Back to Nodes
Shape2D
⚠️ Experimental - Pre-Release
Inheritance Hierarchy
Inherits:
Inheritance Chain:
Node → Node2D → Shape2D
Shape2D is a 2D shape node for rendering geometric shapes. It extends Node2D and can render rectangles, circles, squares, and triangles.
Fields
shape_type: ShapeType2D?
The type of shape to render. Can be Rectangle, Circle, Square, or Triangle. Each variant has its own parameters (e.g., Rectangle has width and height).
@script MyShape extends Shape2D fn init() { // Set shape type self.shape_type = ShapeType2D.Rectangle { width: 100, height: 50 } }color: Color?
Optional color for the shape. If not set, uses default color.
filled: bool
Whether the shape should be filled (true) or outlined (false).
Inherited Fields: Shape2D also has all fields from Node2D: transform, pivot, visible, z_index
