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