Skip to main content
2D sprites

2D sprites

· One min read
Balaur

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.

  • texture and pixels_per_unit size the quad from the image, and half_extents overrides the size in world units.
  • A sprite_sheet cuts the image into a flipbook, by columns and rows or frame by frame. frame picks a cell, left to right then top to bottom, and an animation clip keys it like any other property.
  • region_origin and region_size, in texture pixels, draw one rectangle of a larger image and size the quad from it.
  • flip_x, flip_y, a color tint, and a material for 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.