CLASS v1.8.0

tilemap.TileLayer

pykraken.tilemap.TileLayer

TileLayer represents a grid of tiles within the map.

More about tilemap.TileLayer

Attributes

  • opacity (float) — Layer opacity (0.0-1.0).
  • tiles (TileLayerTileList) — List of Tile entries for the layer grid.

Methods

  • get_from_area — Return tiles intersecting a Rect area.
  • get_from_point — Return the tile at a given world position.
  • draw — Draw the tile layer.

Inherits Layer

Reference

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

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

name

property
name: str

Layer name.

offset

property
offset: Vec2

Per-layer drawing offset.

opacity

property
opacity: float

Layer opacity from 0.0 to 1.0.

tiles

property

TileLayerTileList of tiles in the layer grid.

type

property

Layer type enum.

visible

property
visible: bool

Whether the layer is visible.

draw

method
draw(self, angle: float = 0.0, pivot: Vec2 = Vec2(0.500000, 0.500000)) -> None

Draw the tile layer.

Args

  • angle (float, optional) — Rotation angle in degrees. Defaults to 0.0.
  • pivot (Vec2, optional) — Rotation pivot as normalized coordinates relative to the map size. Defaults to (0.5, 0.5).
get_from_area(self, area: Rect) -> list[tilemap.TileLayer.TileResult]

Return tiles intersecting a Rect area.

Args

  • area (Rect) — World-space area to query.

Returns

list[TileLayer.TileResult]: List of TileResult entries for tiles intersecting the area.

get_from_point(self, position: Vec2) -> tilemap.TileLayer.TileResult | None

Return the tile at a given world position.

Args

  • position (Vec2) — World-space position to query.

Returns

Optional[TileLayer.TileResult]: TileResult entry if a tile exists at the position, None otherwise.

Find your next step

Start typing to search the manual.