def from_json(json_data): width = json_data.get('width') height = json_data.get('height') tiles_json = json_data.get('tiles') game_map = GameMap(width, height) game_map.tiles = Tile.from_json(tiles_json) return game_map
def from_json(json_data): width = json_data.get('width') height = json_data.get('height') tiles_json = json_data.get('tiles') floor = json_data.get('floor') game_map = GameMap(width, height, floor) game_map.tiles = [[ Tile.from_json(tile_json) for tile_json in tile_row_json ] for tile_row_json in tiles_json] return game_map
def from_json(json_data): width = json_data.get('width') height = json_data.get('height') dungeon_level = json_data.get('dungeon_level') tiles_json = json_data.get('tiles') game_map = GameMap(width, height) game_map.initialize_tiles() game_map.dungeon_level = dungeon_level for y in range(height): for x in range(width): game_map.tiles[x][y] = Tile.from_json(tiles_json[x][y]) return game_map
def place_room(self, room, tiles): #Place a room object on the map for x in range(0, room.width - 1): for y in range(0, room.height - 1): self.tiles[x + room.x + 1][y + room.y + 1] = Tile.from_json( tiles[room.grid[y][x]])