API Reference › Tiled
namespace

Tiled

Load and draw Tiled maps. Both native format families — TMX/TSX/TX (XML) and TMJ/TSJ/TJ (JSON) — read onto one intermediate, a Value tree in Tiled's JSON schema, with layer data decoded to a dense GID list; so a CSV .tmx and a base64+zlib .tmj of the same map read identically. Tiled.read returns that intermediate tree for a map file and Tiled.read_tsx for a tileset file. Spliced on demand when a program mentions Tiled.*, alongside the Xml, Base64 and Value runtimes it builds on.

Tiled.read(path: string) -> valueRead a map file into the intermediate value tree.Tiled.read_tsx(path: string) -> valueRead a tileset file into a value object.Tiled.load(path: string) -> mapLoad a map file into the runtime map model.Tiled.gid(map, layer: int, x: int, y: int) -> intThe raw GID at a cell in a tile layer.Tiled.resolve(map, gid: int) -> gidinfoDecode a GID into tileset, local id and flip flags.Tiled.width(map) -> intThe map width in tiles.Tiled.height(map) -> intThe map height in tiles.Tiled.layer_count(map) -> intHow many layers the map has.Tiled.layer_name(map, index: int) -> stringA layer's name by index.Tiled.draw(map, camx: int, camy: int) -> voidDraw every visible tile layer.Tiled.project(map, layer: int) -> voidProject a collision layer to the byte tilemap.Tiled.tree(map) -> valueThe underlying intermediate value tree.Tiled.tile_prop(map, gid: int, name: string) -> intWhether a GID's tile carries a bool property.Tiled.collide(map, layer: int) -> voidDrive collision from per-tile metadata.Tiled.collision_kind(map, gid: int) -> intClassify a GID's collision from its tile metadata.Tiled.tile_shapes(map, gid: int) -> intWhether a GID's tile has a collision shape.Tiled.draw_anim(map, camx: int, camy: int, frame: int) -> voidDraw with animated tiles advanced to a frame.Tiled.frame_gid(map, gid: int, frame: int) -> intThe current GID of an animated tile at a frame.Tiled.animated(map, gid: int) -> intWhether a GID's tile is animated.Tiled.object_count(map, layer: int) -> intHow many objects an object layer holds.Tiled.object(map, layer: int, index: int) -> valueAn object on an object layer by index.Tiled.object_shape(object) -> stringClassify an object's shape.Tiled.prop(container, name: string) -> stringA custom property's value, with class-default fallback.Tiled.prop_int(container, name: string) -> intA custom property parsed as an integer.Tiled.prop_type(container, name: string) -> stringA custom property's declared type.Tiled.load_types(path: string) -> intLoad a project custom-type table.Tiled.template(path: string) -> valueRead a template file into an object value.Tiled.spawn(map, object, model: string) -> intSpawn a Ludic entity from an object.Tiled.spawn_layer(map, layer: int, model: string) -> intSpawn every object on a layer.Tiled.cell_x(map, x: int, y: int) -> intThe screen x of a tile cell for the map orientation.Tiled.cell_y(map, x: int, y: int) -> intThe screen y of a tile cell for the map orientation.Tiled.layer_kind(map, layer: int) -> intA layer's kind.Tiled.layer_opacity(map, layer: int) -> stringA layer's opacity.Tiled.layer_tint(map, layer: int) -> stringA layer's tint colour.Tiled.layer_offsetx(map, layer: int) -> intA layer's horizontal offset.Tiled.layer_offsety(map, layer: int) -> intA layer's vertical offset.Tiled.world(path: string) -> valueRead a .world file.Tiled.world_count(world) -> intHow many maps a world stitches.Tiled.world_map(world, index: int) -> valueA world member map by index.
← All symbols