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

diff --git a/Assets/SFX/Player Grunt.wav b/Assets/SFX/Player Grunt.wav
new file mode 100644 (file)
index 0000000..b7226a3
Binary files /dev/null and b/Assets/SFX/Player Grunt.wav differ
index a4d5d25d109a7577b387c27f4da70f5681c747a6..48eeb324daf5394e6b8cb24c9806b6b56a0375b2 100644 (file)
--- a/Enemy.py
+++ b/Enemy.py
@@ -22,6 +22,10 @@ class Enemy(Actor):
     for i in range(attack_gif.n_frames):
         attack_frames.append(pg.transform.scale(pil_to_game(get_gif_frame(attack_gif, i)), (180, 180)))
 
+    #SFX
+    player_grunt = pg.mixer.Sound("Assets/SFX/Player Grunt.wav")
+    player_grunt_channel = pg.mixer.Channel(4)
+
     def __init__(self, pos, collision_layer, collision_mask):
         super().__init__(pos, collision_layer, collision_mask)
 
@@ -57,6 +61,7 @@ class Enemy(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)