summaryrefslogtreecommitdiff
path: root/src/sliceitoff/game
diff options
context:
space:
mode:
Diffstat (limited to 'src/sliceitoff/game')
-rw-r--r--src/sliceitoff/game/game.py23
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()