diff options
Diffstat (limited to 'turtetris_master/state_machine.py')
-rw-r--r-- | turtetris_master/state_machine.py | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/turtetris_master/state_machine.py b/turtetris_master/state_machine.py index 182ce7b..3c07acb 100644 --- a/turtetris_master/state_machine.py +++ b/turtetris_master/state_machine.py @@ -25,8 +25,13 @@ class StateMachine: elif state == "game": if self.state == "screen_checker" or self.state == "game-over": self.game = Game(self.matrix) + elif self.state == "game-pause": + pass else: __exception__() + elif state == "game-pause": + if self.state != "game": + __exception__() elif state == "game-over": if self.state != "game": __exception__() @@ -45,8 +50,16 @@ class StateMachine: else: self.screen_checker.tick() elif self.state == "game": - if not self.game.tick(inpt): + if inpt['start']: + self.__update_state__('game-pause') + elif not self.game.tick(inpt): self.__update_state__('game-over') + elif self.state == "game-pause": + if inpt['start']: + self.__update_state__('game') + elif inpt['select']: + self.game = Game(self.matrix) + self.__update_state__('game') elif self.state == "game-over": if inpt['start']: self.__update_state__('game') |