def startNewGame(self): print("Starting a new game...") print("Creating player...") self.player = player.Player() self.player.equip(generateNextWeapon(self.player.weapon)) file_manager.saveGame(self.player) #self.setDifficulty() self.player.intro() #self.player.difficulty = self.difficulty self.findKitten() self.running = True
def startNewGame(self): print("Starting a new game...") print("Creating player...") self.player = player.Player() self.player.equip(generateNextWeapon(self.player.weapon)) file_manager.saveGame(self.player) # self.setDifficulty() self.player.intro() # self.player.difficulty = self.difficulty self.findKitten() self.running = True
def run(self): print(self.version) print("Press Ctrl + C to quit.") self.tryLoadExistingSave() while self.running: print() self.beginningOfTurnPrompt() choice = input("\n:") if choice.isdigit() and (int(choice) - 1 in range(len(self._turn_choices))): index = int(choice) - 1 key_list = sorted(self._turn_choices.keys()) chosen_key = key_list[index] method = self._turn_choices.get(chosen_key) method() if self.running: file_manager.saveGame(self.player)
def run(self): print(self.version) print("Press Ctrl + C to quit.") self.tryLoadExistingSave() while self.running: print() self.beginningOfTurnPrompt() choice = input("\n:") if choice.isdigit() and (int(choice) - 1 in range( len(self._turn_choices))): index = int(choice) - 1 key_list = sorted(self._turn_choices.keys()) chosen_key = key_list[index] method = self._turn_choices.get(chosen_key) method() if self.running: file_manager.saveGame(self.player)
print() self.beginningOfTurnPrompt() choice = input("\n:") if choice.isdigit() and (int(choice) - 1 in range( len(self._turn_choices))): index = int(choice) - 1 key_list = sorted(self._turn_choices.keys()) chosen_key = key_list[index] method = self._turn_choices.get(chosen_key) method() if self.running: file_manager.saveGame(self.player) if __name__ == "__main__": if (sys.version_info) < (3, 4): print("Incorrect version. Python 3.4 or later needed.") else: try: game = Game() game.run() except KeyboardInterrupt: if game.running: file_manager.saveGame(game.player) print(game.version) print("\n\tBye!\n\n") except: print(game.version) logging.exception("Something happened ...") input("Press ENTER to quit")
while self.running: print() self.beginningOfTurnPrompt() choice = input("\n:") if choice.isdigit() and (int(choice) - 1 in range(len(self._turn_choices))): index = int(choice) - 1 key_list = sorted(self._turn_choices.keys()) chosen_key = key_list[index] method = self._turn_choices.get(chosen_key) method() if self.running: file_manager.saveGame(self.player) if __name__ == "__main__": if (sys.version_info) < (3, 4): print("Incorrect version. Python 3.4 or later needed.") else: try: game = Game() game.run() except KeyboardInterrupt: if game.running: file_manager.saveGame(game.player) print(game.version) print("\n\tBye!\n\n") except: print(game.version) logging.exception("Something happened ...") input("Press ENTER to quit")