SpriteShape
A shape that draws its own edge art, fill and collision at once, so a ledge's outline, its texture and the ground under it cannot drift apart: an island, a cliff edge, a rooftop. Needs a Collider on the same node for the collision rules.
On this page
Add it
+ Add node → Sprite Shape creates a node with it already on. Already have a node for it? Add component → SpriteShapeComponent.
From a script
A script on the same node writes these fields by name. SpriteShapeComponent is the name to pass.
rgs
set_flag("SpriteShapeComponent", "closed", false);
set_flag("SpriteShapeComponent", "smooth", false);
set_number("SpriteShapeComponent", "corner_threshold", 30.0);
set_flag("SpriteShapeComponent", "fill", false);
set_number("SpriteShapeComponent", "fill_tile_scale", 1.0);
set_colour("SpriteShapeComponent", "fill_color", vec4(1.0, 1.0, 1.0, 1.0));
set_flag("SpriteShapeComponent", "fill_opaque", false);
set_flag("SpriteShapeComponent", "collider", true);
set_number("SpriteShapeComponent", "collider_step", 32.0);
set_number("SpriteShapeComponent", "collider_thickness", 32.0);
set_number("SpriteShapeComponent", "collider_offset", 0.0); Fields
| Field | Script name | Kind | Default | What it does | |||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Points | points | list | empty | The control points, in order. | |||||||||||||||||||||||||||||||||||
| Closed | closed | checkbox | off | Whether the end joins back to the start. | |||||||||||||||||||||||||||||||||||
| Smooth | smooth | checkbox | off | Whether the corners are rounded off into a smooth curve. | |||||||||||||||||||||||||||||||||||
| Art | |||||||||||||||||||||||||||||||||||||||
| Edges | edges | list | empty | The bands of edge art, chosen by which way each edge faces. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||
| Corners | corners | list | empty | The corner art, chosen by which way each corner faces. | |||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||
| Corner Threshold | corner_threshold | number, 0 to 180 | 30 deg | How sharp a turn has to be, in degrees, before it is a corner. | |||||||||||||||||||||||||||||||||||
| Sort Layer | layer | number | 0 | Lower draws first. | |||||||||||||||||||||||||||||||||||
| Fill | |||||||||||||||||||||||||||||||||||||||
| Fill | fill | checkbox | off | Whether the interior is filled. | |||||||||||||||||||||||||||||||||||
| Texture | fill_texture | asset | none | Covers the shape as Fit says. | |||||||||||||||||||||||||||||||||||
| Fit | fill_fit | one of Stretch, Tile | Stretch | Stretch spreads the picture once across the shape's extent; Tile repeats it at its own size times Tile Scale, from the node's origin. | |||||||||||||||||||||||||||||||||||
| Tile Scale | fill_tile_scale | number, at least 0.01 | 1 | World units each art pixel covers when Fit is Tile: 1 draws the picture at its own size, 2 at twice it. | |||||||||||||||||||||||||||||||||||
| Color | fill_color | colour | #ffffff | Fill tint colour, alpha included. | |||||||||||||||||||||||||||||||||||
| Opaque | fill_opaque | checkbox | off | Draw the fill without blending, for ground nothing shows through: its see-through parts, and a see-through Color, come out dark instead of showing what is behind. | |||||||||||||||||||||||||||||||||||
| Collision | |||||||||||||||||||||||||||||||||||||||
| Collide | collider | checkbox | on | Whether this shape doubles as the collision shape. | |||||||||||||||||||||||||||||||||||
| Step | collider_step | number, at least 0 | 32 u | How long each collision box is, in local units. | |||||||||||||||||||||||||||||||||||
| Thickness | collider_thickness | number, at least 0 | 32 u | How far each collision box reaches into the shape, in local units. | |||||||||||||||||||||||||||||||||||
| Surface Offset | collider_offset | number | 0 u | Push the collision surface outward, in local units. | |||||||||||||||||||||||||||||||||||
Buttons
- Reverse