I am a beginner programmer developing a game in Xcode's sprite-kit. I want to make a game-over scene using a different SKScene. I know that using the view-controller, if you transition to a second view-controller (say from the game view to the game-over view), when we want to go back to a previous view-controller we would use the following line of code:
[self.navigationController popViewControllerAnimated:YES];
Is there an equivalent to this for SKScene? The method I am using seems to create a new instance of the game SKScene (so the memory increases a lot each time I go between scenes).
Specifically I'm using the following (1) to go from game scene to the game-over scene and (2) to go from game-over scene to the game scene:
(1) (this is GamePlayScene.m)
SKScene *gameOverScene = [[LTGameOverScene alloc] initWithSize:self.size loss:YES];
SKTransition *reveal = [SKTransition fadeWithDuration:0.5];
[self.view presentScene:gameOverScene transition:reveal];
(2) (these is GameOverScene.h)
-(id)initWithSize:(CGSize)size loss:(BOOL)loss
...
SKTransition *reveal = [SKTransition flipHorizontalWithDuration:0.5];
MyScene * scene = [MyScene sceneWithSize:self.view.bounds.size];
scene.scaleMode = SKSceneScaleModeAspectFill;
[self.view presentScene:scene transition: reveal];