sprite component
A textured 2D quad at the node, sized by pixels_per_unit. columns and rows, or a sprite_sheet in sheet, cut it into frames frame picks.
En esta página
2d · render · 27 properties · 2D
A textured 2D quad at the node, sized by pixels_per_unit. columns and rows, or a sprite_sheet in sheet, cut it into frames frame picks.
In a scene, sprite is the node key that applies it. A script reaches each property below as a field on node.sprite: reading one asks the running component, and assigning one leaves the rest alone. The whole table is node.sprite.get() and node.sprite.set(table).
Properties
| property | type | default | description |
|---|---|---|---|
blend_mode |
enum | auto |
How the surface lands on what is under it: straight alpha, a colour that already carries its alpha, added light, multiplied shade, screen, or opaque. auto is premultiplied for a texture uploaded with premultiply, else alpha One of auto, alpha, premultiplied, add, multiply, screen, opaque. |
centered |
bool | true |
Centre the image on the node; off puts its top-left corner there |
color |
color | [1,1,1,1] |
Tint, as channel floats or #rrggbb / #rrggbbaa |
cull_back_faces |
bool | false |
Skip a triangle whose back faces the viewer, as a negative scale turns one |
dot_color |
color | [1,1,1,1] |
The dots' colour |
dot_size |
float | 0 |
Size of a dot drawn on every vertex; zero draws none At least 0. |
dot_sizing |
enum | world |
What dot_size counts: world is world units, which the camera's zoom scales, screen is pixels One of world, screen. |
draw_surface |
bool | true |
Whether the surface draws; off leaves the wireframe and the dots alone |
flip_x |
bool | false |
Mirror horizontally |
flip_y |
bool | false |
Mirror vertically |
frame |
int | 0 |
Current sheet cell, counted left-to-right then top-to-bottom At least 0. |
material |
asset · material |
— | The material this draws with; empty draws with the built-in one |
nine_slice_margins_pixels |
vec4 | [0,0,0,0] |
Left, right, top and bottom margins in texture pixels: the corners keep their size at pixels_per_unit while the edges and the middle stretch to size. All zero takes the margins from the sheet's first slice with a center, drawing that slice's part of the frame, and draws one plain quad without one |
normal_map |
asset · texture |
— | A tangent-space normal map: the node then draws lit per pixel by every light2d, after the light map and over what it lit, with no shadow. Empty leaves it to the light map. Give the image srgb = false |
normal_strength |
float | 1 |
How far the normal map bends the surface; zero lights it flat At least 0. |
offset |
vec2 | [0,0] |
Where the image sits against the node, in texture pixels with y down; turns and scales with the node |
pixels_per_unit |
float | 0 |
Texture pixels per world unit; 0 takes the texture's own pixels_per_unit import setting, which is 100 unless it says At least 0. |
region_origin |
vec2 | [0,0] |
Top-left corner of the atlas cell to draw, in texture pixels; used with region_size |
region_size |
vec2 | [0,0] |
Size of the atlas cell to draw, in texture pixels; [0, 0] draws the whole image and sizes the quad from the cell |
sheet |
asset · sprite_sheet |
— | A sprite_sheet whose frames frame indexes; its texture is drawn unless texture names another, and it wins over columns, rows and the region |
shininess |
float | 16 |
How tight the highlight is on a normal-mapped node; higher is smaller and sharper At least 1. |
size |
vec2 | [0,0] |
Whole size in world units; [0, 0] sizes from the texture |
specular_strength |
float | 0 |
How bright a light's highlight is on a normal-mapped node; zero draws none At least 0. |
texture |
asset · texture |
— | Image file, project-relative, or a texture asset that reads it with settings of its own. Empty draws nothing |
wireframe_color |
color | [1,1,1,1] |
The wireframe's colour |
wireframe_sizing |
enum | world |
What wireframe_width counts: world is world units, which the camera's zoom scales, screen is pixels One of world, screen. |
wireframe_width |
float | 0 |
Width of a line drawn along every triangle edge, not the outline; zero draws none At least 0. |
Asset types this component references: material, texture, sprite_sheet.