--- a/game.py +++ b/game.py @@ -28,7 +28,7 @@ def __init__(self): # We start Pyxel, load the assets, the image of the initial screen and enable the mouse. pyxel.init(WITH, HEIGHT, title='X-masmatch', display_scale=3, - capture_scale=2, capture_sec=60) + capture_scale=2, capture_sec=60, quit_key=pyxel.KEY_NONE) pyxel.load('assets.pyxres') pyxel.images[1].load(0, 0, 'main_screen.png') @@ -107,7 +107,6 @@ {'x': center, 'y': 104, 'w': 60, 'h': 14, 'text': 'Hard', 'level': 'hard'}, {'x': center, 'y': 120, 'w': 60, 'h': 14, 'text': 'Very hard', 'level': 'very_hard'}, {'x': center, 'y': 136, 'w': 60, 'h': 14, 'text': 'HELL!', 'level': 'hell'}, - {'x': center, 'y': 152, 'w': 60, 'h': 14, 'text': 'Exit', 'level': 'exit'}, ) self.flip_down = False # If true, the cards will be turned face down. @@ -348,9 +347,6 @@ pyxel.mouse_x >= btn['x'] and pyxel.mouse_x <= btn['x'] + btn['w'] and pyxel.mouse_y >= btn['y'] and pyxel.mouse_y <= btn['y'] + btn['h'] ): - if btn['level'] == 'exit': - pyxel.quit() - self.initGame(btn['level']) elif self.getBtnPressed() == 'up' and self.gamepad_cursors['main'] > 0: @@ -358,9 +354,6 @@ elif self.getBtnPressed() == 'down' and self.gamepad_cursors['main'] < len(self.levels_btns) - 1: self.gamepad_cursors['main'] += 1 elif self.getBtnPressed() == 'a' or self.getBtnPressed() == 'start': - if self.gamepad_cursors['main'] == len(self.levels_btns) - 1: - pyxel.quit() - __level = self.levels_pos[self.gamepad_cursors['main']] self.initGame(__level) self.gamepad_cursors['main'] = 0