Sprite
Draws a texture on this node, tinted, sized and anchored as set here. The most common way anything in a scene becomes visible.
On this page
Add it
+ Add node → Sprite, Animated Sprite, Parallax, Shader Material, Root Motion Character creates a node with it already on. Already have a node for it? Add component → SpriteComponent.
From a script
A script on the same node writes these fields by name. SpriteComponent is the name to pass.
rgs
set_point("SpriteComponent", "size", vec2(1.0, 1.0));
set_point("SpriteComponent", "anchor", vec2(0.5, 0.5));
set_colour("SpriteComponent", "color", vec4(1.0, 1.0, 1.0, 1.0));
set_number("SpriteComponent", "flash", 0.0);
set_flag("SpriteComponent", "opaque", false);
set_flag("SpriteComponent", "unshaded", false);
set_flag("SpriteComponent", "light_only", false);
set_number("SpriteComponent", "specular", 0.0);
set_number("SpriteComponent", "slice_border", 0.0);
set_point("SpriteComponent", "tile", vec2(0.0, 0.0));
set_text("SpriteComponent", "region_name", ""); Fields
| Field | Script name | Kind | Default | What it does | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Texture | texture | asset | none | The picture or sprite sheet this sprite draws. | |||||||||||||||
| Size | size | two numbers (x, y) | (1, 1) | Size in local units before the node transform is applied. | |||||||||||||||
| Anchor | anchor | two numbers (x, y), 0 to 1, step 0.01 | (0.5, 0.5) | Anchor point on the sprite: 0, 0 is the top-left corner, 0.5, 0.5 is the centre. | |||||||||||||||
| Color | color | colour | #ffffff | Tints the art; alpha fades it out. | |||||||||||||||
| Flash | flash | number, 0 to 1, step 0.05 | 0 | Washes the picture toward white and keeps its shape: 1 is a white silhouette, for a hit. | |||||||||||||||
| Sort Layer | layer | number | 0 | Lower draws first. | |||||||||||||||
| Flip | flip | section | — | Mirroring. | |||||||||||||||
| |||||||||||||||||||
| Opaque | opaque | checkbox | off | Draw without blending — for the backmost layer. | |||||||||||||||
| Blend | blend | one of Alpha, Add, Multiply, Screen, Subtract | Alpha | Additive for glows and explosions, multiply for shadows. | |||||||||||||||
| Unshaded | unshaded | checkbox | off | Ignore lighting: always draw at full brightness. | |||||||||||||||
| Light Only | light_only | checkbox | off | Draw only where light falls. | |||||||||||||||
| Normal Map | normal_map | asset | none | Adds surface detail to how light falls on this sprite. | |||||||||||||||
| Specular | specular | number, 0 to 1, step 0.05 | 0 | How brightly this surface catches a highlight, from none to full. | |||||||||||||||
| Draw mode | |||||||||||||||||||
| Draw Mode | draw_mode | one of Simple, Sliced, Tiled | Simple | Nine-slice for a panel that stretches, tiled for a fence or a chain. | |||||||||||||||
| Slice Border | slice_border | number, at least 0, step 0.5 | 0 | How many pixels of each corner keep their size while the middle stretches. | |||||||||||||||
| Tile Size | tile | two numbers (x, y), at least 0 | (0, 0) | How far apart the repeats sit. | |||||||||||||||
| Atlas Region | region_name | text | empty | Named area within the sheet; empty draws the whole picture. | |||||||||||||||
| Mask | mask | section | none | Draw only inside (or outside) a mask channel. | |||||||||||||||
| |||||||||||||||||||