【发布时间】:2015-03-19 21:22:00
【问题描述】:
我有一些带有 SKAction() 的精灵节点; 它们是名为 world 的 sknode 的子节点
如果我在游戏中按下暂停按钮,它的 spirenodes 动画
func pause(){
if(isGamePaused)
isGamePaused = false;
world.paused = false;
} else {
isGamePaused = true;
world.paused = true;
}
}
但在后台运行时我无法暂停游戏
NSNotificationCenter.defaultCenter().addObserver(self, selector: Selector("goBG:"), name: UIApplicationWillResignActiveNotification, object: nil);
func goBG(sender: AnyObject){
self.isGamePaused = true;
self.world.paused = true;
println("bg"); // called
println(world.paused);// return true
}
【问题讨论】:
-
SpriteKit 会在您的应用移至后台时自动暂停,并在应用处于活动状态时恢复。
标签: ios8 sprite-kit skspritenode skaction