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.
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;
}
}
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With