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/level.py | |
parent | 27c7e16e4bd808ce1176f18b7a78c02ff4fa88ee (diff) |
stats as object
Diffstat (limited to 'src/sliceitoff/game/level.py')
-rw-r--r-- | src/sliceitoff/game/level.py | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/src/sliceitoff/game/level.py b/src/sliceitoff/game/level.py index ada29d2..a711b0d 100644 --- a/src/sliceitoff/game/level.py +++ b/src/sliceitoff/game/level.py @@ -5,7 +5,6 @@ from status import Status from player import Player from field import Field from enemies import Enemies -from stats import Stats from screens import levelup_screen, gameover_screen, level_screen from .gameplay import Gameplay from .anykey import anykey @@ -14,23 +13,25 @@ from .show import Show class Level: """ One level that can be played """ - def __init__(self, display = None): + def __init__(self, display = None, stats = None): self.display = display - self.status = Status() - self.field = Field() - self.enemies = Enemies() + self.stats = stats + self.status = Status(stats = self.stats) + self.field = Field(stats = self.stats) + self.enemies = Enemies(count = self.stats.enemies) self.player = Player() self.player_single = pygame.sprite.Group() - self.level_info = Show(level_screen()) + self.level_info = Show(level_screen(stats.level)) self.ended = False - self.endscreen = pygame.sprite.Group() + self.endscreen = None self.gameplay = Gameplay( player = self.player, status = self.status, field = self.field, - enemies = self.enemies) + enemies = self.enemies, + stats = self.stats) self.obj_classes = [ self.status, self.field, @@ -55,12 +56,12 @@ class Level: else: self.player_single = pygame.sprite.GroupSingle( sprite = self.player.get_top_sprite()) - Stats.update_bonus(dt) + self.stats.update_bonus(dt) if self.gameplay.step(): self.player_single = pygame.sprite.Group() self.ended = True - if Stats.lives: - self.endscreen = Show(levelup_screen()) + if self.stats.lives: + self.endscreen = Show(levelup_screen(self.stats)) else: self.endscreen = Show(gameover_screen()) self.obj_classes.append(self.endscreen) |