From: 711215 <711215@pdsb.net> Date: Wed, 13 Jul 2022 15:01:10 +0000 (-0400) Subject: enemy grunt sfx X-Git-Url: http://git.skullheadx.com/nixos/static/links.html?a=commitdiff_plain;h=21332208356971dfd0b82094c07c51054ba854d3;p=Pygame-Jam.git enemy grunt sfx --- diff --git a/Assets/SFX/Grunt Sound.wav b/Assets/SFX/Grunt Sound.wav new file mode 100644 index 0000000..887e7a3 Binary files /dev/null and b/Assets/SFX/Grunt Sound.wav differ diff --git a/PhysicsBody.py b/PhysicsBody.py index 6b2959c..fad56cc 100644 --- a/PhysicsBody.py +++ b/PhysicsBody.py @@ -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 diff --git a/Player.py b/Player.py index 6c05c18..93c818a 100644 --- 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(