CLASS v1.8.0

tilemap.TileSet

pykraken.tilemap.TileSet

TileSet represents a collection of tiles and associated metadata.

More about tilemap.TileSet

Attributes

  • first_gid (int) — First global tile ID in the tileset.
  • last_gid (int) — Last global tile ID in the tileset.
  • name (str) — Name of the tileset.
  • tile_size (Vec2) — Size of individual tiles.
  • spacing (int) — Pixel spacing between tiles in the source image.
  • margin (int) — Margin in the source image.
  • tile_count (int) — Total number of tiles.
  • columns (int) — Number of tile columns in the source image.
  • tile_offset (Vec2) — Offset applied to tiles.
  • terrains (TerrainList) — List of terrain definitions.
  • tiles (TileSetTileList) — List of tile metadata.
  • texture (Texture) — Source texture for this tileset.

Methods

  • has_tile — Check whether a global tile id belongs to this tileset.
  • get_tile — Retrieve tile metadata for a given id.

Reference

PYTHON API
tilemap.TileSet(/, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

columns

property
columns: int

Number of tile columns in the source image.

first_gid

property
first_gid: int

First global tile id (GID) in this tileset.

last_gid

property
last_gid: int

Last global tile id (GID) in this tileset.

margin

property
margin: int

Pixel margin around the source image.

name

property
name: str

Tileset name.

spacing

property
spacing: int

Pixel spacing between tiles in the source image.

terrains

property

TerrainList of terrain definitions.

texture

property
texture: Texture

Source texture for the tileset.

tile_count

property
tile_count: int

Total number of tiles in the tileset.

tile_offset

property
tile_offset: Vec2

Per-tile offset applied when rendering.

tile_size

property
tile_size: Vec2

Size of tiles in pixels.

tiles

property

TileSetTileList of tile metadata entries.

get_tile

method
get_tile(self, id: int) -> tilemap.TileSet.Tile

Retrieve tile metadata for a given id.

Args

  • id (int) — Global tile id (GID).

Returns

  • Tile — The tile metadata, or None if not found.

has_tile

method
has_tile(self, id: int) -> bool

Check whether a global tile id belongs to this tileset.

Args

  • id (int) — Global tile id (GID).

Returns

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

Find your next step

Start typing to search the manual.