Ejemplo n.º 1
0
 def tile(self, point: Point) -> Tile:
     tile = Tile.empty()
     if not self.in_bounds(point):
         tile = Tile.empty(point)
     try:
         tile = self.tile_grid[point.y, point.x]
     except IndexError:
         print("index out of range")
     return tile
Ejemplo n.º 2
0
 def find_tile(self, point: Point) -> Tile:
     label = self.game_map.cave_map[point.x, point.y]
     if label == "CAVE":
         tile = Tile.cave(point)
     elif label == "FLOOR":
         tile = Tile.floor(point)
     else:
         tile = Tile.empty(point)
     return tile
Ejemplo n.º 3
0
    def __init__(self, height: int, width: int):
        self.height: int = height
        self.width: int = width
        self.rooms = []

        self.grid_shape: Tuple[int, int] = (height, width)
        self.tile_grid = numpy.full(shape=self.grid_shape, fill_value=Tile.empty())
        self.region_grid = numpy.full(shape=self.grid_shape, fill_value=-1, dtype=numpy.int)
        self.fov_grid = numpy.zeros(shape=self.grid_shape)
Ejemplo n.º 4
0
 def tile(self, point: Point) -> Tile:
     tile = Tile.empty(point)
     if self.in_bounds(point):
         tile = Tile.from_grid(point, self.grids(point))
     return tile
Ejemplo n.º 5
0
 def clear_dungeon(self):
     """
     Clears the dungeon data by filling the tile grid with empty tiles and region grid with -1
     """
     self.tile_grid = numpy.full(shape=self.grid_shape, fill_value=Tile.empty())
     self.region_grid = numpy.full(shape=self.grid_shape, fill_value=-1, dtype=int)
Ejemplo n.º 6
0
def empty(zeros):
    return Tile.empty(zeros)