TileSet

TileSet represents a collection of tiles and associated metadata. Access via the 'tilemap' submodule.

Properties


NameDescriptionType
columnsNumber of tile columns in the source image.int
first_gidFirst global tile id (GID) in this tileset.int
last_gidLast global tile id (GID) in this tileset.int
marginPixel margin around the source image.int
nameTileset name.str
spacingPixel spacing between tiles in the source image.int
terrainsTerrainList of terrain definitions.list[TileSet.Terrain]
textureSource texture for the tileset.Texture
tile_countTotal number of tiles in the tileset.int
tile_offsetPer-tile offset applied when rendering.Vec2
tile_sizeSize of tiles in pixels.Vec2
tilesTileSetTileList of tile metadata entries.list[TileSet.Tile]

Methods


Get Tile

get_tile(id: SupportsInt) TileSet.Tile

Retrieve tile metadata for a given id.

Args

  • id : Global tile id (GID).

Returns

Tile : The tile metadata, or None if not found.

Has Tile

has_tile(id: SupportsInt) bool

Check whether a global tile id belongs to this tileset.

Args

  • id : Global tile id (GID).

Returns

bool : True if the tileset contains the tile id, False otherwise.