def get_connected_points(self, level, start, open_tile, connected_points): """ Get all points that are connected to a given point Args: level: level to check start: start location open: ID of tile considered open Returns: list of connected points """ x_loc = start[0] y_loc = start[1] if start in connected_points: return None if get_tile(level, start) is None: return None if wall_tile(level, start) is None: connected_points.append(start) self.get_connected_points(level, (x_loc, y_loc - 1), open_tile, connected_points) self.get_connected_points(level, (x_loc, y_loc + 1), open_tile, connected_points) self.get_connected_points(level, (x_loc - 1, y_loc), open_tile, connected_points) self.get_connected_points(level, (x_loc + 1, y_loc), open_tile, connected_points) self.get_connected_points(level, (x_loc - 1, y_loc - 1), open_tile, connected_points) self.get_connected_points(level, (x_loc - 1, y_loc + 1), open_tile, connected_points) self.get_connected_points(level, (x_loc - 1, y_loc - 1), open_tile, connected_points) self.get_connected_points(level, (x_loc + 1, y_loc + 1), open_tile, connected_points) return connected_points
def decorate_level(self, level): """ Decorate level :param level: level to decorate :type level: Level """ for location, tile in get_tiles(level): if tile['\ufdd0:floor'] == self.floor: floor_tile(level, location, self.get_floor_tile(level, location)) for location in self.second_pass: if get_tile(level, location): floor_tile(level, location, self.check_nook(level, location))
def decorate_level(self, level): """ Decorate level :param level: level to decorate :type level: Level """ floor = self.configuration.floor for location, tile in get_tiles(level): if tile['\ufdd0:floor'] == floor: floor_tile(level, location, self.get_floor_tile(level, location)) for location in self.second_pass: if get_tile(level, location): floor_tile(level, location, self.check_nook(level, location))
def is_wall(level, location, wall_tiles): "check if given location is considered as a wall" return (get_tile(level, location) is None or wall_tile(level, location) in wall_tiles)