How can I switch from SKScene to UIView

I use the Sprite framework to create a game. My first scene is MyScene.My Scene is a menu, but I want when you click on the button to go to the first view from the story panel.

So I switch to another SKScene

Scene001 *start = [[Scene001 alloc] initWithSize:self.size];
        SKTransition *reveal = [SKTransition fadeWithColor:[UIColor clearColor] duration:0.5];
        [self.scene.view presentScene: start transition: reveal];

Now the question is how to switch to the storyboard scene and vice versa.

+4
source share
1 answer

I know this is old, but just getting someone to run into it and needs an answer:

, GameViewController SKScene. SKScene, GameViewController, executeSegueWithIdentifier. viewController, , segue. SKScene. SKScene , viewController , . , , .

GameViewController, :

 - (void)viewWillAppear:(BOOL)animated {
        SKView * skView = (SKView *)self.view;

        if (!skView.scene) {  
            MyScene *scene = [MyScene sceneWithSize:self.view.bounds.size];
            scene.delegate = self;
            [skView presentScene:scene];
        }
    }

 // A delegate function
    - (void)onExitGame {
       [self performSegueWithIdentifier:@"GoToNextScene" sender:self];
    }

MyScene, , :

if (self.delegate) {
  self.delegate.onExitGame();
}
0

Source: https://habr.com/ru/post/1534506/


All Articles