0

I want to be able to turn off sound effects that I run with SKAction. This code is in my GameScene.

override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {

if (//an argument) {
   let playSound = SKAction.playSoundFileNamed("SoundDing.wav", waitForCompletion: false)
                   self.runAction(playSound)

   }
}

I want the button that will mute the sounds to be in my GameStartScene. How do I go about doing this.

1 Answers1

0

You can't stop audio from playing when run from SKAction.

Use AVAudioPlayer. It allows you to start, stop, pause, control volume, number of loops and other features.

Refer below posts for more Info:

Community
  • 1
  • 1
Dharmesh Kheni
  • 71,228
  • 33
  • 160
  • 165