I'm using the following to pause my game
self.scene?.paused = true
When the scene is paused, however, all SKAction
s stop. What can I do to allow some of the actions to continue to work?
Add certain nodes to different SKNode
so instead you can only pause the the layer (SKNode) that you wish to pause. It would look something like this:
let gameLayer = SKNode()
let pauseLayer = SKNode()
Now when you want to add a child to the scene, instead add it to a layer:
gameLayer.addChild(gameSceneNode)
pauseLayer.addChild(pauseSceneNode)
Don't forget to add the layers to the scene too
addChild(gameLayer)
addChild(pauseLayer)
To pause a layer write this:
Swift 3
gameLayer.isPaused = true
Swift 2
gameLayer.paused = true
Note that in this example, all the nodes on the gameLayer
will be paused, however everything on the pauseLayer
will not.