1
我有SKLabelNode的子類,真實實例化三分四次,每一個名字和一個目標:分類爲SKLabelNode以呈現場景,如何?
//
import SpriteKit
class MenuButton: SKLabelNode {
var goesTo = SKScene()
override init() {
super.init()
print("test... did this get called? WTF? HOW/WHY/WHERE?")
}
convenience init(text: String, color: SKColor, destination: SKScene){
self.init()
self.text = text
self.color = color
goesTo = destination
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
let nextScene = goesTo
// .....?????????????????
// HOW DO I GET THIS TO FIND ITS SCENE...
// THEN ITS VIEW, THEN PRESENT this nextScene????
}
required init?(coder aDecoder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
}
我在茫然,如何在視圖得到我需要調用現場改變。
謝謝你!比我對這個問題的方法好得多;)'let myPointlessView = SKView()myPointlessView.presentScene(nextScene)' – Confused