0
新來Stackoverflow很抱歉,如果我發佈它錯了!謝謝當我單擊「重放」按鈕時,只有GameScene.sks運行,而不是GameScene.swift ...我怎樣才能同時播放?
我的應用程序是一個有時間限制的迷宮遊戲,一旦遊戲結束,遊戲結束並進入屏幕遊戲(單獨的swift文件),它由一個「重放」按鈕組成,顯示了gamescene.sks文件而不是gamescene.swift文件(因此沒有任何功能可以工作)。有兩種方法可以同時顯示嗎?
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
for touch: AnyObject in touches {
let location = touch.locationInNode(self)
let node = self.nodeAtPoint(location) //1
if node.name == "replay" { //2
let reveal : SKTransition = SKTransition.flipHorizontalWithDuration(1)
let scene = GameScene(size: self.size)
scene.scaleMode = .AspectFill
self.view?.presentScene(scene, transition: reveal)
let reveal2 : SKTransition = SKTransition.flipHorizontalWithDuration(1)
let sksScene = SKScene(fileNamed: "GameScene.sks")
sksScene!.scaleMode = .AspectFill
self.view?.presentScene(sksScene!, transition: reveal2)
}
}
}