Im am trying to pause or stop an SKAction that is being repeated forever which should happen when the user presses the pause button. I have found a way to stop the music but i cant call the function it is in because of this error. It says exactly: Missing argument for parameter 'coder' in call.
Class GameViewController: UIViewController, SwiftrisDelegate, UIGestureRecognizerDelegate {
@IBAction func didPause(sender: UIButton) {
if self.scene.paused == false{
self.scene.stopTicking()
self.scene.paused = true
GameScene().stopGameMusic() //error on this line
}
}
}
class GameScene: SKScene {
runAction(SKAction.playSoundFileNamed("theme.mp3", waitForCompletion: true), withKey:("themeSong"))
func stopGameMusic() {
removeActionForKey("themeSong")
}
}
GameScene()creates a new instance of the classGameScene. Is it your intention to do that?