Skip to content

Search

Documentation

sprite

A textured 2D quad at the node, sized by pixels_per_unit. A sprite_sheet in sheet cuts it into frames frame picks.

On this page

2d · render · 14 properties · 2D

A textured 2D quad at the node, sized by pixels_per_unit. A sprite_sheet in sheet cuts 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
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
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
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 the region
size vec2 [0,0] Whole size in world units; [0, 0] sizes from the texture
texture asset · texture — Image file, project-relative, or a texture asset that reads it with settings of its own. Empty draws nothing

Asset types this component references: material, sprite_sheet, texture.

Are you sure?