From b219c4f736e6b98dd247064b362997576954f0ff Mon Sep 17 00:00:00 2001 From: Viljami Ilola <+@hix.fi> Date: Mon, 18 Mar 2024 17:12:48 +0200 Subject: remove area after losing life --- src/sliceitoff/player/player.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sliceitoff/player/player.py b/src/sliceitoff/player/player.py index 9870c50..241897d 100644 --- a/src/sliceitoff/player/player.py +++ b/src/sliceitoff/player/player.py @@ -48,17 +48,19 @@ class Player(): # self.lazer = True # self.updated = True hitbox = self.field.slice(self.position, self.direction, 4_500) + hit = False if hitbox is not None: for enemy in self.enemies.sprites: if hitbox.colliderect(enemy.rect): - return True + hit = True + break; for field in self.field.sprites: for enemy in self.enemies.sprites: if enemy.rect.colliderect(field.rect): break else: field.remove(self.field.sprites) - return False + return hit def set_direction(self): if not self.lazer: -- cgit v1.2.3