summaryrefslogtreecommitdiff
path: root/src/sliceitoff/game/game.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/sliceitoff/game/game.py')
-rw-r--r--src/sliceitoff/game/game.py12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/sliceitoff/game/game.py b/src/sliceitoff/game/game.py
index 2ef377f..f85a544 100644
--- a/src/sliceitoff/game/game.py
+++ b/src/sliceitoff/game/game.py
@@ -6,13 +6,14 @@ from pathlib import Path
import pygame
+from sliceitoff.settings import settings
from sliceitoff.display import Display
from sliceitoff.stats import Stats
from sliceitoff.screens import (
hiscores_screen,
instructions1_screen,
instructions2_screen)
-from sliceitoff.hiscores import HiScores
+from sliceitoff.hiscores import hi_scores
from sliceitoff.text import fonts
from sliceitoff.sfx import sfx
@@ -32,7 +33,6 @@ class Game:
self.clock = pygame.time.Clock()
self.display = Display()
self.stats = None
- self.hiscores = HiScores()
pygame.mouse.set_visible(False)
def __del__(self):
@@ -49,7 +49,7 @@ class Game:
def show_highscores(self):
""" displays highscores and waits a key """
sfx.music("pimpelipompeli")
- his = Show(hiscores_screen(str(self.hiscores)))
+ his = Show(hiscores_screen(str(hi_scores)))
while his.active:
his.update(dt = self.clock.tick())
self.display.update( [his] )
@@ -94,6 +94,8 @@ class Game:
while True:
match self.mainmenu():
case MenuItems.QUIT:
+ hi_scores.save()
+ settings.save()
break
case MenuItems.HISCORES:
self.show_highscores()
@@ -103,6 +105,6 @@ class Game:
self.settings()
case MenuItems.NEWGAME:
self.newgame()
- if self.hiscores.high_enough(self.stats.score):
- self.hiscores.add( self.stats.score, self.initials())
+ if hi_scores.high_enough(self.stats.score):
+ hi_scores.add( self.stats.score, self.initials())
self.show_highscores()