diff options
author | Viljami Ilola <+@hix.fi> | 2024-03-29 00:30:39 +0200 |
---|---|---|
committer | Viljami Ilola <+@hix.fi> | 2024-03-29 00:30:39 +0200 |
commit | 5c5df6e068b2957987cb51b34d6930769424f8ca (patch) | |
tree | 1f6ce6ff479ee787a3da6f51a9c337bcd24b841a /src/sliceitoff/game/gameplay.py | |
parent | 27c7e16e4bd808ce1176f18b7a78c02ff4fa88ee (diff) |
stats as object
Diffstat (limited to 'src/sliceitoff/game/gameplay.py')
-rw-r--r-- | src/sliceitoff/game/gameplay.py | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/sliceitoff/game/gameplay.py b/src/sliceitoff/game/gameplay.py index 028536c..ef708c4 100644 --- a/src/sliceitoff/game/gameplay.py +++ b/src/sliceitoff/game/gameplay.py @@ -1,8 +1,6 @@ """ Reads user input and does actions when game play is on. """ import pygame -from stats import Stats - class Gameplay: """ Logic of the playfield """ def __init__( @@ -10,11 +8,13 @@ class Gameplay: player = None, field = None, status = None, - enemies = None): + enemies = None, + stats = None): self.status = status self.player = player self.field = field self.enemies = enemies + self.stats = stats def fire(self): """ Lazer is fired. Actions to be taken. """ @@ -24,16 +24,16 @@ class Gameplay: 4_000) if not zap_sprite: return False - Stats.add_score(-500) + self.stats.add_score(-500) if pygame.sprite.spritecollideany(zap_sprite, self.enemies): - if Stats.lose_life(): + if self.stats.lose_life(): return True self.field.kill_if_not_colliding(self.enemies.sprites()) self.field.update_stats() - return Stats.percent < 20 + return self.stats.percent < 20 def quit(self): - Stats.lives = 0 + self.stats.lives = 0 return True def step(self): |