Skip to content

Components

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

FieldScript nameKindDefaultWhat it does
PointspointslistemptyThe control points, in order.
ClosedclosedcheckboxoffWhether the end joins back to the start.
SmoothsmoothcheckboxoffWhether the corners are rounded off into a smooth curve.
Art
EdgesedgeslistemptyThe bands of edge art, chosen by which way each edge faces.
FieldScript nameKindDefaultWhat it does
TexturetextureassetnoneThe band's texture.
FromfromnumbernoneFirst facing angle this band covers, in degrees.
TotonumbernoneWhere this band's coverage ends, in degrees.
Sizesizetwo numbers (x, y), at least 0noneNominal size: length along the edge by depth into the shape, in local units.
OffsetoffsetnumbernoneNudge away from the surface, in local units.
ColorcolorcolournoneTint colour, alpha included.
CornerscornerslistemptyThe corner art, chosen by which way each corner faces.
FieldScript nameKindDefaultWhat it does
TexturetextureassetnoneThe corner's texture.
FromfromnumbernoneFirst corner angle this piece covers, in degrees.
TotonumbernoneWhere this corner piece's coverage ends, in degrees.
Sizesizetwo numbers (x, y), at least 0noneSize in local units.
Offsetoffsettwo numbers (x, y)noneNudge from the corner, in local units.
ColorcolorcolournoneTint colour, alpha included.
Corner Thresholdcorner_thresholdnumber, 0 to 18030 degHow sharp a turn has to be, in degrees, before it is a corner.
Sort Layerlayernumber0Lower draws first.
Fill
FillfillcheckboxoffWhether the interior is filled.
Texturefill_textureassetnoneCovers the shape as Fit says.
Fitfill_fitone of Stretch, TileStretchStretch 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 Scalefill_tile_scalenumber, at least 0.011World units each art pixel covers when Fit is Tile: 1 draws the picture at its own size, 2 at twice it.
Colorfill_colorcolour#ffffffFill tint colour, alpha included.
Opaquefill_opaquecheckboxoffDraw 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
CollidecollidercheckboxonWhether this shape doubles as the collision shape.
Stepcollider_stepnumber, at least 032 uHow long each collision box is, in local units.
Thicknesscollider_thicknessnumber, at least 032 uHow far each collision box reaches into the shape, in local units.
Surface Offsetcollider_offsetnumber0 uPush the collision surface outward, in local units.

Buttons

  • Reverse