diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-31 13:56:46 +0300 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-31 13:56:46 +0300 |
commit | 551289aa0d40b80e8c2f8e6e732dbfc8b03e5e96 (patch) | |
tree | e5ed0fc3e0119304df5dce4dbbcbf7dab1cc3f46 /src/sliceitoff/game | |
parent | 20b23c0cd4cf613a2634cc57bf6f2430cc9fc364 (diff) |
mainloop
Diffstat (limited to 'src/sliceitoff/game')
-rw-r--r-- | src/sliceitoff/game/game.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/sliceitoff/game/game.py b/src/sliceitoff/game/game.py index 18c47b2..fea5151 100644 --- a/src/sliceitoff/game/game.py +++ b/src/sliceitoff/game/game.py @@ -11,7 +11,7 @@ from text import Fonts from stats import Stats from screens import welcome_screen, hiscores_screen from hiscores import HiScores -from mainmenu import Mainmenu +from mainmenu import Mainmenu, MenuItems from .level import Level from .show import Show @@ -73,10 +73,17 @@ class Game: return menu.selection def run(self): - """ This is the main loop of the game (not loop at the moment) """ - self.mainmenu() - self.welcome() - self.newgame() - if self.hiscores.high_enough(self.stats.score): - self.hiscores.add( self.stats.score, self.initials()) - self.show_highscores() + """ This is the main loop of the game """ + while True: + match self.mainmenu(): + case MenuItems.QUIT: + break + case MenuItems.HISCORES: + self.show_highscores() + case MenuItems.INSTRUCT: + self.welcome() + case MenuItems.NEWGAME: + self.newgame() + if self.hiscores.high_enough(self.stats.score): + self.hiscores.add( self.stats.score, self.initials()) + self.show_highscores() |