2D sprites
· One min read
Sprites are in. A sprite is a textured 2D quad sized in pixels per unit,
with flipbook sheets, atlas regions, flips, a tint and a material.
textureandpixels_per_unitsize the quad from the image, andhalf_extentsoverrides the size in world units.- A
sprite_sheetcuts the image into a flipbook, bycolumnsandrowsor frame by frame.framepicks a cell, left to right then top to bottom, and an animation clip keys it like any other property. region_originandregion_size, in texture pixels, draw one rectangle of a larger image and size the quad from it.flip_x,flip_y, acolortint, and amaterialfor a custom shader round it out.
[[nodes]]
name = "Hero"
[nodes.sprite]
texture = "art/hero.png"
pixels_per_unit = 32
columns = 8
rows = 1
frame = 0
Sprites draw in z order with the other 2D shapes. A 2D light map lights them without a material. The component reference lists every key.