Reputation: 73
I want to change the background music after a specific event in the same scene. Do I have to use Booleans and update() function or is there a way to do delegation in a single scene?
Sample code would be appreciated. Any advice on how to properly ask these type of questions on stackoverflow would be nice.
Upvotes: 0
Views: 85
Reputation: 56
You can try the SKAction methods.
An example:
override func touchesEnded(touches: Set<NSObject>, withEvent event: UIEvent) {
self.runAction(SKAction.playSoundFileNamed("filename.type"), waitForCompletion: false))
}
With this action, u play a sound on toucheEnded, but you can use it everywhere u need a sound.
Upvotes: 1