]> Skullheadx's Git Forge - Pygame-Jam.git/commitdiff
enemy grunt sfx
author711215 <711215@pdsb.net>
Wed, 13 Jul 2022 15:01:10 +0000 (11:01 -0400)
committer711215 <711215@pdsb.net>
Wed, 13 Jul 2022 15:01:10 +0000 (11:01 -0400)
Assets/SFX/Grunt Sound.wav [new file with mode: 0644]
PhysicsBody.py
Player.py

diff --git a/Assets/SFX/Grunt Sound.wav b/Assets/SFX/Grunt Sound.wav
new file mode 100644 (file)
index 0000000..887e7a3
Binary files /dev/null and b/Assets/SFX/Grunt Sound.wav differ
index 6b2959ce73358bcf77ebf1eee775640a501443a1..fad56cc8f0d05c195c8c3233c263ec9cd3e820a1 100644 (file)
@@ -18,7 +18,7 @@ class PhysicsBody:
         self.on_ground = False
 
         self.dead = False
-
+        self.health = 0
         self.movable = True
         self.attacked = False
         self.invincibility_frames = self.invincibility_time
index 6c05c185d5ae7750a81476e7235debbed55e896a..93c818a848a350f65bed8fbe11d2b969f11f2c74 100644 (file)
--- a/Player.py
+++ b/Player.py
@@ -37,6 +37,9 @@ class Player(Actor):
     sword_swing_channel = pg.mixer.Channel(2)
     landing_sound = pg.mixer.Sound("Assets/SFX/Jump_Landing.wav")
     landing_sound_channel = pg.mixer.Channel(3)
+    # Enemy SFX
+    grunt_sound = pg.mixer.Sound("Assets/SFX/Grunt Sound.wav")
+    
 
     width, height = idle_frames[0].get_size()
 
@@ -293,6 +296,9 @@ class Player(Actor):
 
                         if not enemy.attacked and get_display_rect(self.weapon.get_collision_rect()).colliderect(
                                 get_display_rect(enemy.get_collision_rect())):
+                            print(enemy.health)
+                            if enemy.health > 0:
+                                pg.mixer.Sound.play(self.grunt_sound)
                             enemy.attack(self, self.weapon, self.direction)
                 for arrow in self.arrows:
                     if not arrow.attacked and get_display_rect(self.weapon.get_collision_rect()).colliderect(