WorldText
A line of text drawn in the room rather than on a screen: a damage number, a name tag, an interaction prompt. Placed at a point from the node's own position plus an offset, not inside a box. Holds a fixed size on screen as the camera zooms.
On this page
Add it
+ Add node → World Text creates a node with it already on. Already have a node for it? Add component → WorldTextComponent.
From a script
A script on the same node writes these fields by name. WorldTextComponent is the name to pass.
rgs
set_text("WorldTextComponent", "text", "Text");
set_number("WorldTextComponent", "scale", 1.0);
set_colour("WorldTextComponent", "color", vec4(1.0, 1.0, 1.0, 1.0));
set_point("WorldTextComponent", "offset", vec2(0.0, -24.0));
set_flag("WorldTextComponent", "pixel_size", true);
set_flag("WorldTextComponent", "unshaded", false);
set_colour("WorldTextComponent", "outline", vec4(0.0, 0.0, 0.0, 1.0));
set_number("WorldTextComponent", "outline_width", 1.0);
set_colour("WorldTextComponent", "shadow", vec4(0.0, 0.0, 0.0, 0.0));
set_point("WorldTextComponent", "shadow_offset", vec2(1.0, 1.0));
set_number("WorldTextComponent", "shadow_softness", 0.0); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Text | text | text, several lines | Text | What it says. Press Enter for a new line. |
| Scale | scale | number, 0.1 to 16, step 0.1 | 1 | Scales the size of the text. |
| Color | color | colour | #ffffff | Colour of the text, including how see-through it is. |
| Align | align | one of Left, Center, Right | Center | Which edge of the text lines up with where it's placed. |
| Offset | offset | two numbers (x, y) | (0, -24) | How far from the node's own position it sits, in world units. |
| Pixel Size | pixel_size | checkbox | on | Hold a fixed size as the camera zooms. |
| Sort Layer | layer | number | 1 | Sort layer it draws on, over the sprite it labels. |
| Font | font | asset | none | Font to draw with; leave it unset to use the UI font. |
| Unshaded | unshaded | checkbox | off | Keep its colour under the room's lights, as a sprite's Unshaded does: a number in a dark crypt stays readable. |
| Effects | ||||
| Effect Mode | effect_mode | one of Copies, DistanceField | Copies | Copies draws the outline and shadow as offset copies of the words, in any font; Distance Field draws them in one pass from the font's distance field, sharp at any zoom, and is the one that softens a shadow. |
| Outline | outline | colour | #000000 | Colour of the outline drawn behind the letters. Fully transparent draws no outline. |
| Outline Width | outline_width | number, 0 to 8, step 0.5 | 1 | How far the outline reaches, in world units. Zero draws none. |
| Shadow | shadow | colour | #000000, 0% opaque | Colour of the drop shadow behind the letters. Fully transparent draws no shadow. |
| Shadow Offset | shadow_offset | two numbers (x, y) | (1, 1) | How far the shadow is offset from the letters, in world units. |
| Shadow Softness | shadow_softness | number, 0 to 16, step 0.5 | 0 | How far the shadow's edge is blurred, in world units. |