0

So I'm trying to play a sound called 'Jump10.wav' I've saved the file in the in the folder with my project but when I run my code I get an error saying: File Directory not Found. Here is my code:

  self.snd_dir = path.join(self.dir, 'snd')
            self.jump_sound = pg.mixer.Sound(path.join(self.snd_dir, 'Jump10.wav'))

And then in another method I've put:

  self.jump_sound.play()

I don't understand why the file can't be found because I've saved it.

Charlotte
  • 11
  • 2
  • 3
    Put the result of `path.join(self.snd_dir, 'Jump10.wav')` into a variable and examine its value. – Robert Harvey Dec 26 '19 at 22:05
  • That worked in getting the sound to play but now whenever I press the spacebar which runs the self.jump_sound.play() line the sound will play 2 of 3 times even if i only press it once. Do you know how to sort it out so it only plays once? – Charlotte Dec 26 '19 at 22:18
  • 1
    @RobertHarvey actually I worked it out I was putting the jump_sound.play line in the wrong place – Charlotte Dec 26 '19 at 22:24

0 Answers0