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.py23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/sliceitoff/game/game.py b/src/sliceitoff/game/game.py
index 146e34e..bcb04e7 100644
--- a/src/sliceitoff/game/game.py
+++ b/src/sliceitoff/game/game.py
@@ -21,12 +21,10 @@ class Game:
pygame.init()
self.clock = pygame.time.Clock()
self.display = Display()
-
- pygame.mouse.set_visible(False)
-
- Fonts.load_fonts( Path(__file__).parent.parent.resolve() )
-
+ self.stats = None
self.hiscores = HiScores()
+ Fonts.load_fonts( Path(__file__).parent.parent.resolve() )
+ pygame.mouse.set_visible(False)
def welcome(self):
ws = Show(welcome_screen())
@@ -43,15 +41,14 @@ class Game:
self.display.update( [his] )
def newgame(self):
- Stats.new_game()
-
- while Stats.lives:
- level = Level(display = self.display)
+ self.stats = Stats()
+ while self.stats.lives:
+ level = Level(display = self.display, stats = self.stats)
dt = 0
while level.step(dt):
dt = self.clock.tick()
- if Stats.lives:
- Stats.level_up()
+ if self.stats.lives:
+ self.stats.level_up()
def initials(self):
initials = Initials()
@@ -64,8 +61,8 @@ class Game:
def run(self):
self.welcome()
self.newgame()
- if self.hiscores.high_enough(Stats.score):
- self.hiscores.add( Stats.score, self.initials())
+ if self.hiscores.high_enough(self.stats.score):
+ self.hiscores.add( self.stats.score, self.initials())
self.show_highscores()