def launch_game(self, server=False): """ Function to launch the game, use precedant user choices to initiate the game with level and characters selected. """ players = [] for i in range(0, len(self.screens["characters"].players)): if self.screens["characters"].players[i] != 0: file_name = ( self.screens["characters"].game_data['character_file'][ self.screens["characters"].players[i]]) if self.screens["characters"].checkboxes_ai[i].get_value(): file_name = file_name.replace("characters/", "characters/AI") players.append(file_name) if len(players) > 1: game = Game(self.screen, self.screens["level"].get_level(), players) #thread.start_new_thread(self.loading, ()) #self.goto_screen("ingame.usfgui", False) #self.state="game" return game
def init_standalone(self): ''' start a non network instance of the game ''' self.init_screen() self.text_thread = "Loading sounds and musics..." thread = threading.Thread(None, self.loading_screen) thread.start() self.init_sound() self.ai_instance = AI() # if a level was provided and at least two players in the option # immediatly jump into game mode if len(self.players) > 1 and self.level is not None: self.game = Game(self.screen, self.level, self.players) self.state = "game" self.menu = Gui(self.screen) self.menu.handle_reply({'goto': 'configure'}) else: self.lock.acquire() self.text_thread = "Loading GUI..." self.lock.release() self.menu = Gui(self.screen) self.state = "menu" self.game = None self.level = None self.lock.acquire() self.stop_thread = True self.lock.release() thread.join()