summaryrefslogtreecommitdiff
path: root/src/sliceitoff/game/level.py
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-04-08 21:03:40 +0300
committerViljami Ilola <+@hix.fi>2024-04-08 21:03:40 +0300
commit9548295de1d343e831baaa2e1c908f70cef0e33a (patch)
treee9cb817de24b179beb842ec356e542ce22cde086 /src/sliceitoff/game/level.py
parentc99a7138e78352c4e26483dd4dad36b009a72e4f (diff)
life group. indicator for lost life
Diffstat (limited to 'src/sliceitoff/game/level.py')
-rw-r--r--src/sliceitoff/game/level.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/sliceitoff/game/level.py b/src/sliceitoff/game/level.py
index c6633fd..845c960 100644
--- a/src/sliceitoff/game/level.py
+++ b/src/sliceitoff/game/level.py
@@ -2,7 +2,7 @@
import pygame
from status import Status
-from player import Player
+from player import Player, Life
from field import Field
from enemies import Enemies
from screens import levelup_screen, gameover_screen, level_screen
@@ -19,6 +19,7 @@ class Level(pygame.sprite.Group):
self.field = Field(stats = self.stats)
self.enemies = Enemies(count = self.stats.enemies)
self.player = Player()
+ self.life = Life()
self.level_info = Show(level_screen(stats.level))
self.ended = False
self.active = True
@@ -28,7 +29,8 @@ class Level(pygame.sprite.Group):
player = self.player,
field = self.field,
enemies = self.enemies,
- stats = self.stats)
+ stats = self.stats,
+ life = self.life)
def update(self, dt = 0):
""" Updates groups, calls gameplay and adds sprites for drawing """
@@ -36,6 +38,7 @@ class Level(pygame.sprite.Group):
self.status.update(dt = dt)
self.field.update(dt = dt)
self.enemies.update(dt = dt, field_rects = self.field.active_rects())
+ self.life.update(dt = dt)
self.add(self.status, self.field, self.enemies)
if self.level_info.active:
@@ -57,3 +60,4 @@ class Level(pygame.sprite.Group):
self.endscreen = Show(levelup_screen(self.stats))
else:
self.endscreen = Show(gameover_screen())
+ self.add(self.life)