2015-01-21 5 views
0

나는 SKAction(); 나는 게임에서 spirenodes일시 중지 게임 WillResignActive

func pause(){ 
    if(isGamePaused) 
     isGamePaused = false; 
     world.paused = false; 
    } else { 
     isGamePaused = true; 
     world.paused = true; 
    } 
} 

자사의 애니메이션을 일시 정지 버튼을 눌러하지만 배경에 갈 때 나는 게임을 일시 중지 할 수 없습니다 경우 그들은 이름을 세계

와 자녀의 sknode의이다

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 
} 
+0

SpriteKit 자동으로 배경에 때 앱 움직임을 일시 중지하고 응용 프로그램이 활성화되면 다시 시작합니다. – 0x141E

답변

0

UIApplicationWillResignActiveNotification 알림 대신 UIApplicationDidEnterBackgroundNotification을 추가하거나 게임을 일시 중지하는 AppDelegate 메서드 applicationDidEnterBackground에서 함수를 호출하여 추가 할 수 있습니다 .

+0

예를 들어 주시겠습니까? –

+0

UIApplicationDidEnterBackgroundNotification - SKAction을 일시 중지하지 않습니다. –

관련 문제