tilemap — Luau Binding

require("tilemap"): load grid levels, read and write tiles, and test tile collision. The programmatic surface of the tilemap system. Every function is [antos].

Status: design. Not built yet.

local tilemap = require("tilemap")
Call Returns Does
tilemap.new(w, h, tileset) map a blank w × h map over a tileset
tilemap.load(path) map load a level from a file
map:tile(x, y) / map:set(x, y, id) id / ok read / write a cell
map:solid(x, y) bool is the cell's tile flagged solid
map:query(x1, y1, x2, y2) list the tiles in a region — for streaming or edits
tilemap.tileset(defs) tileset id → { sprite, solid, … } flags
local tilemap = require("tilemap")
local level = tilemap.load("world1.map")
-- tile collision: a target's feet vs the grid, O(1)
if level:solid(math.floor((hero.x)/16), math.floor((hero.y+8)/16)) then
    physics.velocity(hero, nil, 0)   -- landed
end

Where to go next

Important: The Ant64 family of home computers are at early design/prototype stage, everything you see here is subject to change.