From: Skullheadx <704277@pdsb.net> Date: Wed, 6 Jul 2022 17:56:07 +0000 (-0400) Subject: death detection X-Git-Url: http://git.skullheadx.com/nixos/NN_Heuristic%20MST.png?a=commitdiff_plain;h=274e6ab87168c5e2a6b34a2004c7d37cf1503607;p=Pygame-Jam.git death detection --- diff --git a/Actors.py b/Actors.py index c27570a..141239c 100644 --- a/Actors.py +++ b/Actors.py @@ -39,11 +39,14 @@ class Actor: # Apply gravity self.velocity.y += self.gravity - def is_dead(self): + def is_dead(self,reason=None): if self.health <= 0: self.dead = True - def modify_health(self): + + def modify_health(self,amount, reason): + self.health += amount + self.is_dead(reason) diff --git a/Game.py b/Game.py index ffc32ae..93adab0 100644 --- a/Game.py +++ b/Game.py @@ -25,7 +25,7 @@ class Game: for enemy in self.enemies: enemy.update(delta, self.player) if enemy.dead: - print('a') + print('enemy died') for block in self.blocks: block.update(delta)