clubsandwich.tilemap¶
Tilemap data structures for 2D grids
-
class
clubsandwich.tilemap.Cell(point)¶ One cell at a point in 2D space. You’ll probably want to subclass this to add your own data.
-
point¶
-
terrain¶ Arbitrary value representing the type of terrain in this cell, if any
-
feature¶ Arbitrary value representing the “feature” (exit, furniture…) on this cell, if any
-
items¶ List of arbitrary values representing any items on this cell.
-
annotations¶ Set of arbitrary values. Original use was to let a level generator give a hint to the draw function. For example if the generator places a rectangular room, it can mark cells as ‘corner-top-left’, ‘wall-vert’, etc.
-
debug_character¶ Another slot for arbitrary debugging data. Intended use is to visually mark cells in a map.
-
-
exception
clubsandwich.tilemap.CellOutOfBoundsError¶ You have tried to access a cell at a coordinates outside of the tilemap
-
class
clubsandwich.tilemap.TileMap(size, cell_class=<class ‘clubsandwich.tilemap.Cell’>)¶ A collection of cells within a rectangular 2D area, with various convenience methods. You’ll probably want to subclass this to add your own.
-
points_of_interest¶ Dict of arbitrary data. Intended use is for the level generator to pass data to game logic, for example to define mob positions.
-
cell(point)¶ Parameters: point (clubsandwich.geom.Point) – Returns the cell at the given point, or raises
CellOutOfBoundsError.As a shortcut, you can use indexing syntax instead of calling this method:
cell = tilemap[Point(x, y)]
-
cells¶ Iterator of all cells in this tilemap
-
contains_point(point)¶ Parameters: point (clubsandwich.geom.Point) – Returns
Trueiff point is within this tilemap’s bounds, otherwiseFalse.
-