Can I somehow turn off all the music in the scene at once?
import Foundation import SpriteKit import AVFoundation class Start: SKScene, SKPhysicsContactDelegate { var isPlaying = false var audioN: AVAudioPlayer! //Кнопка func buttonTap(sender:UIButton){ if (sender.tag == 1){ if isPlaying { isPlaying = false if (isPlaying == false){ } dispatch_async(dispatch_get_main_queue(), { }) } else { isPlaying = true if (isPlaying == true){ audioN = try? AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("PlayM", ofType: "mp3")!)) } dispatch_async(dispatch_get_main_queue(), { }) } } //И дальше мне эти звуки еще использовать нужно будет func PlayGame(){ audioN.play() }
var audioN= try? AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("PlayM", ofType: "mp3")!))var audioN= try? AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("PlayM", ofType: "mp3")!))- LeciaudioN.stopcan help - Max MikheyenkoaudioN= try? AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("PlayM", ofType: "mp3")!))audioN= try? AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("PlayM", ofType: "mp3")!))So stop here will not work - Leci