From: 711215 <711215@pdsb.net> Date: Wed, 13 Jul 2022 16:09:48 +0000 (-0400) Subject: skeleton damage sfx X-Git-Url: http://git.skullheadx.com/pfp.webp?a=commitdiff_plain;h=e5b420a6e991bd7513bb1dd3fce89f1a17d6120c;p=Pygame-Jam.git skeleton damage sfx --- diff --git a/Assets/SFX/Skeleton_Damaged.wav b/Assets/SFX/Skeleton_Damaged.wav new file mode 100644 index 0000000..a2d5095 Binary files /dev/null and b/Assets/SFX/Skeleton_Damaged.wav differ diff --git a/Enemy.py b/Enemy.py index 48eeb32..d6c953f 100644 --- a/Enemy.py +++ b/Enemy.py @@ -167,6 +167,7 @@ class Skeleton(Actor): self.current_frame = 0 elif 4 < self.current_frame: target.attack(self, self.weapon, self.direction) + self.player_grunt_channel.play(self.player_grunt) # Deals with collision and applying velocity self.position, self.velocity = self.move_and_collide(self.position.copy(), self.velocity.copy(), delta) diff --git a/Player.py b/Player.py index 93c818a..c4e3822 100644 --- a/Player.py +++ b/Player.py @@ -39,6 +39,7 @@ class Player(Actor): landing_sound_channel = pg.mixer.Channel(3) # Enemy SFX grunt_sound = pg.mixer.Sound("Assets/SFX/Grunt Sound.wav") + skeleton_damaged_sound = pg.mixer.Sound("Assets/SFX/Skeleton_Damaged.wav") width, height = idle_frames[0].get_size() @@ -296,9 +297,12 @@ 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) + enemy_type = str(type(enemy)) if enemy.health > 0: - pg.mixer.Sound.play(self.grunt_sound) + if enemy_type == "": + pg.mixer.Sound.play(self.grunt_sound) + if enemy_type == "": + pg.mixer.Sound.play(self.skeleton_damaged_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(