Is there a way to pause SKActions?

I would like to create a pause menu, but I donโ€™t know how to do it ... I think that an easy way would be to pause all my SKActions, but I could not find any method in the link. Thanks for the help.

+8
ios objective-c iphone game-engine sprite-kit
source share
2 answers

The documentation says that the parent SKView object has a suspended property . Set it to YES to pause the scene.

Paused

A Boolean value indicating whether scene animations are paused.

@property (getter = isPaused, non-atomic) BOOL paused

The discussion . If the value is YES, then the contents of the scenes are fixed on the screen. No actions are being performed, and physical modeling is not being performed. "

 //the parent SKView spriteView = (SKView *) self.view; //pause button -(IBAction)goPauseButton { if(!spriteView.paused){ spriteView.paused = YES; }else{ spriteView.paused = NO; } } 
+13
source share

You can also pause all SKActions by setting the scene speed to zero - this means that all actions will stop, and you do not need to worry about them moving to where they would not be if you didnโ€™t pause it

 self.speed = 0; 

easy as

+8
source share

All Articles