在我的遊戲swift
/SpriteKit
中,當用戶退出應用程序並再次打開它時,出現問題。如果遊戲處於暫停菜單並且所有內容都已暫停,則重新加載遊戲時,遊戲未被暫停,但暫停菜單上的標籤不會消失。當我重新打開遊戲時,如何讓遊戲暫停?我已經嘗試過當遊戲開始運行時運行一個函數iOS - SpriteKit
func applicationWillEnterForeground(application: UIApplication) {
// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
let scene = GameScene(size: CGSize(width: 2048, height: 1356))
scene.view?.paused = true
}
但是這沒有做任何事情。我也嘗試過pause()
,但這會讓事情變得糟糕。任何幫助表示讚賞。
Xcode說「類型'SKView'的值沒有成員'速度' –
我的不好,看我的編輯。你想使用'scene.speed'。 – Gliderman
我把速度設置爲0在func應用程序中:UIApplication的,didFinishLaunchingWithOptions launchOptions:[NSObject的:AnyObject]) - >布爾{ ,FUNC applicationWillResignActive(應用:UIApplication的){ ,FUNC applicationDidEnterBackground(應用:UIApplication的){ ,和FUNC applicationWillEnterForeground(應用:UIApplication的){ 但它不會改變任何東西... –