From: 711215 <107773170+711215@users.noreply.github.com> Date: Tue, 12 Jul 2022 03:48:17 +0000 (-0400) Subject: landing sound added X-Git-Url: http://git.skullheadx.com/nixos/static/gitweb.css?a=commitdiff_plain;h=22a84df706a0d005c17156736a5a9c07b918b327;p=Pygame-Jam.git landing sound added --- diff --git a/Player.py b/Player.py index 73d4b54..1251c9c 100644 --- a/Player.py +++ b/Player.py @@ -33,6 +33,8 @@ class Player(Actor): running_sound_channel = pg.mixer.Channel(1) sword_swing_sound = pg.mixer.Sound("Assets/SFX/Sword_Swing.wav") sword_swing_channel = pg.mixer.Channel(2) + landing_sound = pg.mixer.Sound("Assets/SFX/Jump_Landing.wav") + landing_sound_channel = pg.mixer.Channel(3) width, height = idle_frames[0].get_size() @@ -97,8 +99,6 @@ class Player(Actor): if len(self.potion_bag) > 0: self.potion_bag[0].get_input(self) - # print(self.state, self.previous_state) - # Deals with collision and applying velocity self.position, self.velocity = self.move_and_collide(self.position.copy(), self.velocity.copy(), delta) @@ -113,7 +113,9 @@ class Player(Actor): if self.velocity.x == 0 and self.state == "RUN": self.state = "IDLE" - + if self.on_ground == True and self.previous_ground_state == False: + self.landing_sound_channel.play(self.landing_sound) + if self.state == "IDLE": self.display_offsets["player"] = pg.Vector2(0, 0)