--- a/game/__init__.py +++ b/game/__init__.py @@ -50,8 +50,8 @@ self.pauseMenu = PyxelMenu( self.pauseConf['start_x'] + 2, self.pauseConf['start_y'] + 12, - ['Continue', 'Main menu', 'Save & exit', 'Exit'], - 4 + ['Continue', 'Main menu', 'Save'], + 3 ) self.pauseMenu.set_text_color(4) self.pauseMenu.set_highlight_color(6) @@ -68,7 +68,7 @@ # Init Pyxel and load assets pyxel.init(constants.SCREEN_W, constants.SCREEN_H, title='Ticoban', display_scale=3, - capture_scale=2, capture_sec=40) + capture_scale=2, capture_sec=40, quit_key=pyxel.KEY_NONE) pyxel.load('assets.pyxres') # We check if a save file exists to continue the game. @@ -134,10 +134,6 @@ elif selected == 2: if self.withLoadSave: self.loadSave() - else: - pyxel.quit() - else: - pyxel.quit() elif btn_pressed == 'up': self.mainMenu.move_up() elif btn_pressed == 'down': @@ -253,8 +249,6 @@ self.game_state = constants.GAME_MAIN_MENU elif self.pauseMenu.get_current_pos() == 2: self.saveGame() - elif self.pauseMenu.get_current_pos() == 3: - pyxel.quit() elif btn_pressed == 'up': self.pauseMenu.move_up() elif btn_pressed == 'down': @@ -501,7 +495,10 @@ } Saves.save(data, 'savegame') - pyxel.quit() + # FredyGames: quitting only freezes the page on the web, so after saving the game goes on + self.withLoadSave = True + self.pauseMenu.set_cursor_pos(0) + self.game_state = constants.GAME_PLAYING def setMainMenuOpts(self): """ Defines the main menu options depending on whether or not the save file exists. """ @@ -514,6 +511,4 @@ if path.isfile(path.join(SAVES_DIR, 'savegame.json')): opts.append('Load save') - opts.append('Exit') - self.mainMenu.set_options(opts) --- a/game/saves.py +++ b/game/saves.py @@ -9,6 +9,9 @@ __dir = path.dirname(__file__) SAVES_DIR = path.join(__dir, 'saves') +# FredyGames: the browser build keeps the saves in /saves/ticoban (IndexedDB, kept by the page) +if path.isdir('/saves/ticoban'): + SAVES_DIR = '/saves/ticoban' class Saves: