TileMap

A Tiled map containing multiple layers of tiles.

Constructor

TileMap(tmx_path: str, border_size: int = 0)

Parameters

  • tmx_path : Path to the TMX file.
  • border_size : Optional border (in pixels) around each tile in the tileset. Defaults to 0.

Methods


Get Layer

get_layer(name: str, type: TileLayer.Type = TileLayer.TILE) TileLayer

Get a layer object from the tile map by name and type.

Returns

TileLayer : The layer object with the specified name and type.

Get Layers

get_layers() list[TileLayer]

Get all layers in the tile map.

Returns

list[TileLayer] : A list of all layers in the tile map.

Get Tile Collection

get_tile_collection(layers: Sequence[TileLayer]) list[Tile]

Get all tiles from the specified layers.

Returns

list[Tile] : A list of all tiles from the specified layers.

Render

render() None

Render all visible layers.