]> Skullheadx's Git Forge - Pygame-Jam.git/commitdiff
death detection
authorSkullheadx <704277@pdsb.net>
Wed, 6 Jul 2022 17:56:07 +0000 (13:56 -0400)
committerSkullheadx <704277@pdsb.net>
Wed, 6 Jul 2022 17:56:07 +0000 (13:56 -0400)
Actors.py
Game.py

index c27570ae50e0d12807a2489e921345df4cd8a320..141239c5625c360fb619ec5f763bffc645311dde 100644 (file)
--- 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 ffc32aefa63d061483fea49c31cf41e79b68f157..93adab04c8724f8de453c227ec8105f2bb454459 100644 (file)
--- 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)