def make(game_name, map_name, players): # Generating Game Data game_data = { "game_name": game_name, "map_name": map_name, "game_end": False, "current_player": None, # will be generated on load. "players": [ get_player_data(player["name"], player["colour"]) for player in players ], "world": get_world_data(map_name) } game_data = assign_spawns(game_data) # Creating 'saved' directory if it doesn't exist. if not os.path.exists(paths.gamePath): os.mkdir(paths.gamePath) data.save(game_data, paths.gamePath + game_name)
def make(game_name, map_name, players, is_internet): """ where players = [[name, colour], [name,colour]...]""" game = model.Model(game_name, map_name, players, is_internet) # creates "blank" game # Creating 'saved' directory if it doesn't exist. if not os.path.exists(paths.gamePath): os.mkdir(paths.gamePath) data.save(game, paths.gamePath + game_name)
def save(self, filename): level = { "tile-size": self.TILE_SIZE, "map-size": self.MAP_SIZE, "map-format": self.format, "keys": self.keys, "enemies": self.enemies, } try: data.save(level, filename) return True except IsADirectoryError: return False
def save(self): data.save(self.game_model, paths.gamePath + self.game_reference)
def make(game_name, map_name, players): """ where players = [[name, colour], [name,colour]...]""" game = model.Model(game_name, map_name, players) # creates "blank" game data.save(game, paths.gamePath + game_name)
def save(self): data.save(self.game_model.get_save_data(), paths.gamePath + self.game_reference)