Skip to main content

Module tilemap

Module tilemap 

Source
Expand description

TileMap document schema, TOML serialization, coordinate math, and layer management.

Stores sparse tile layers referencing atlas frames. TOML (.ptmap) is canonical and human-readable, consistent with .ptscn.

Structs§

TileCell
An individual placed tile entry in a sparse layer: (column, row, frame_name).
TileMapDoc
Canonical .ptmap document.
TileMapLayer
A named layer of placed tiles within a TileMapDoc.

Functions§

load_tilemap
Loads and validates a .ptmap file from disk.
map_to_world
Convert grid coordinate (col, row) to world center position (x, y).
parse_tilemap_str
Parses a tilemap document from a TOML string.
save_tilemap
Serializes and writes a TileMapDoc to disk at the specified path.
world_to_map
Convert world position to tilemap grid coordinate (col, row).