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
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
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)
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
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)
def empty(zeros): return Tile.empty(zeros)