def escape_key(self): screen = self.current_screen if screen is self.editor_screen: self.show_edit_menu_screen() elif screen is self.edit_menu_screen: self.edit_level() elif screen is self.play_screen and self.game.testing: self.game.testing = False self.edit_level() else: HLShell.escape_key(self)
def level_completed(self, result): if self.game.testing or self.game.level_needs_saving: self.game.testing = False self.edit_level() else: HLShell.level_completed(self, result)
def ask_save(self): """If there is unsaved game progress or changes to a level, ask the user whether to save it, and if the answer is yes, do so. Reports errors to the user. Raises Cancel if cancelled or an error occurred.""" HLShell.ask_save_progress(self) self.ask_save_level()