Search code examples
swiftxcodesprite-kitskscene

Not moving from GameViewController Menu to GameScene Swift


I made my game Menu in GameViewController. Then I try to move to GameScene when the Go button has been pressed. I use the default code for presenting the GameScene file.

 if let scene = GameScene(fileNamed:"GameScene") {

         // Configure the view.
         let skView = self.view as! SKView
         skView.showsFPS = false
         skView.showsNodeCount = false

         /* Sprite Kit applies additional optimizations to improve rendering performance */
         skView.ignoresSiblingOrder = true

         /* Set the scale mode to scale to fit the window */
         scene.scaleMode = .AspectFill

         skView.presentScene(scene)
}

I have the Menu made in the Storyboard. I think this is why it isn't working. How should I fix this?

Niall


Solution

  • In SpriteKit we use scenes, the GameScene is above in GameViewController. The GameViewController show you the GameScene.