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.
Asked
Active
Viewed 3,896 times
2 Answers
13
Documentation says that parent SKView
object has a paused property
. Set it to YES
to pause the scene.
Paused
A
Boolean
value 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;
}
}
-
3Thanks 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? :) – user1940136 Oct 13 '13 at 18:18
-
The pausing works fine for me, can you post your code showing how and where you call it? – AndyOS Oct 14 '13 at 07:28
-
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 Oct 14 '13 at 08:30
-
Do you have any Idea how I can fix that? – user1940136 Oct 14 '13 at 08:42
-
Thanks for your help.. I fixed it ;) It was a problem of my code. – user1940136 Oct 15 '13 at 12:41
10
You can also pause all the SKActions by setting the speed of the scene to zero-- this means that all the actions will stop, and you do not need to worry about them moving to where they would not have been if you did not pause
self.speed = 0;
easy as that

Lucas
- 713
- 2
- 8
- 19