I'd like to create a pause menu but I don't know the simplest way to do this... I think a simple way would be to pause all my SKActions, but I couldn't find any method in the reference. Thanks for help.
2 Answers
Documentation says that parent SKView object has a paused property. Set it to YES to pause the scene.
Paused
A
Booleanvalue that indicates whether the view’s scene animations are paused.@property(getter=isPaused, nonatomic) BOOL paused
Discussion If the value is YES, then the scene’s content is fixed on screen. No actions are executed and no physics simulation is performed."
//the parent SKView
spriteView = (SKView *) self.view;
//pause button
-(IBAction)goPauseButton {
if(!spriteView.paused){
spriteView.paused = YES;
}else{
spriteView.paused = NO;
}
}
5 Comments
user1940136
Thanks for your help! :) Your are right. All the animations and actions stop. But if i set the paused property back to no, the sprite move on where they would be if the view would have never get paused. Any idea why? :)
AndyOS
The pausing works fine for me, can you post your code showing how and where you call it?
user1940136
I know what the problem of my code is... I use the current time from the update: method and the current time does logically not stop. So I have to fix that.
user1940136
Do you have any Idea how I can fix that?
user1940136
Thanks for your help.. I fixed it ;) It was a problem of my code.