summaryrefslogtreecommitdiff
path: root/src/sliceitoff/game
diff options
context:
space:
mode:
authorViljami Ilola <+@hix.fi>2024-03-23 20:19:38 +0200
committerViljami Ilola <+@hix.fi>2024-03-23 20:19:38 +0200
commit87cd7293498d6b30389e056a59b2e69eb7b3a418 (patch)
tree392e2e15446a533d0bdc1faddd5a6e2d8fc731ee /src/sliceitoff/game
parentb03cb075e7a2042764a355a46d649b187f66343b (diff)
enemies as group
Diffstat (limited to 'src/sliceitoff/game')
-rw-r--r--src/sliceitoff/game/gameplay.py14
-rw-r--r--src/sliceitoff/game/level.py2
2 files changed, 12 insertions, 4 deletions
diff --git a/src/sliceitoff/game/gameplay.py b/src/sliceitoff/game/gameplay.py
index cc20c3b..6296a5a 100644
--- a/src/sliceitoff/game/gameplay.py
+++ b/src/sliceitoff/game/gameplay.py
@@ -5,14 +5,22 @@ from stats import Stats
class Gameplay:
""" Logic of the playfield """
- def __init__(self, player = None, field = None, status = None):
+ def __init__(
+ self,
+ player = None,
+ field = None,
+ status = None,
+ enemies = None):
self.status = status
self.player = player
self.field = field
+ self.field = enemies
def fire(self):
- if self.player.fire_lazer() and Stats.lose_life():
- return True
+ if self.player.fire_lazer():
+ field.kill_if_not_colliding(enemies.sprites())
+ if Stats.lose_life():
+ return True
return Stats.percent < 20
def quit(self):
diff --git a/src/sliceitoff/game/level.py b/src/sliceitoff/game/level.py
index e5dc9f6..a417d8f 100644
--- a/src/sliceitoff/game/level.py
+++ b/src/sliceitoff/game/level.py
@@ -31,7 +31,7 @@ class Level:
self.display.update( (
self.status.sprites,
self.field,
- self.enemies.sprites,
+ self.enemies,
self.player.sprites) )
if self.gameplay.step():