API Reference › Sprite
namespace

Sprite

A namespaced spritesheet / atlas API. Sprite.sheet loads one image and remembers its cell grid; Sprite.cell addresses a cell by grid coords and Sprite.cell_span a sprite that spans more than one cell; Sprite.define / Sprite.named name and look up a cell; Sprite.draw / Sprite.draw_scaled blit it (through the camera / zoom / clip). It stands on the variable-size image loader, so a cell can be any size — not just 16x16. (Distinct from the Sprite engine component of the sprite-render system.)

Sprite.sheet(path, cellw, cellh) -> intLoad a spritesheet and remember its cell grid; returns a sheet handle.Sprite.cell(sheet, col, row) -> intOne cell of a sheet, by grid coords; returns a sprite id.Sprite.cell_span(sheet, col, row, cols, rows) -> intA sprite spanning cols x rows cells (tall/wide art).Sprite.define(name, sheet, col, row) -> intName a cell for later lookup; returns its sprite id.Sprite.named(name) -> intLook up a named sprite's id, or -1.Sprite.draw(id, x, y)Blit an atlas sprite at (x, y) through the camera/zoom/clip.Sprite.draw_scaled(id, x, y, scale)Blit an atlas sprite scaled by an integer factor.Sprite.width(id) -> intThe atlas sprite's width in pixels.Sprite.height(id) -> intThe atlas sprite's height in pixels.Sprite.strip(sheet, col, row, count, rows) -> intA run of animation frames as consecutive sprite ids.Sprite.draw_meter(x:, y:, value:, max:, per_icon:, spacing:, full:, half:, empty:)A value as a row of full / half / empty icons.
← All symbols