2016-09-18 36 views
0

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

我有故事板中製作的菜單。我認爲這是爲什麼它不起作用。我應該如何解決這個問題?

尼爾

回答

0

在SpriteKit我們使用的場景中,GameScene高於在GameViewController。 GameViewController向您顯示GameScene。

+0

我不明白你在說什麼。此代碼是我的菜單(GameViewController)中的播放功能。當我嘗試執行移動到GameScene時遇到問題 –

+0

您在GameViewController上做了菜單,菜單將在GameScene上而不是GameViewController –

+0

是的,抱歉,我忘了回覆。我剛剛重新制作了GameScene上的菜單 –

相關問題