不从GameViewController菜单移动到GameScene Swift

问题描述:

我在GameViewController中创建了我的游戏菜单。然后当Go按钮被按下时,我尝试移动到GameScene。我使用默认代码来呈现GameScene文件。不从GameViewController菜单移动到GameScene Swift

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) 
} 

我有故事板中制作的菜单。我认为这是为什么它不起作用。我应该如何解决这个问题?

尼尔

在SpriteKit我们使用的场景中,GameScene高于在GameViewController。 GameViewController向您显示GameScene。

+0

我不明白你在说什么。此代码是我的菜单(GameViewController)中的播放功能。当我尝试执行移动到GameScene时遇到问题 –

+0

您在GameViewController上做了菜单,菜单将在GameScene上而不是GameViewController –

+0

是的,抱歉,我忘了回复。我刚刚重新制作了GameScene上的菜单 –