I am stuck on this problem.
我被这个问题困住了。
I laid a SpriteKit node over a SceneKit Scene. I'm trying to use SpriteKit to display labels and those labels switch scenes when touched. Imagine "Game Start", "Quit", "Shop" as buttons.
我在SceneKit场景上放置了一个SpriteKit节点。我正在尝试使用SpriteKit来显示标签,这些标签在被触摸的时候会切换场景。把“游戏开始”、“退出”、“购物”想象成按钮。
But it doesn't work.
但它不工作。
How should I switch scenes in SceneKit from interaction with SpriteKit labels?
如何切换SceneKit中与SpriteKit标签交互的场景?
GameStart形象
override func touchesBegan(touches: Set<UITouch>, withEvent event: UIEvent?) {
/* Called when a touch begins */
for touch: AnyObject in touches {
let location = touch.locationInNode(self)
let touchNode:SKNode = self.nodeAtPoint(location)
if(touchNode.name == "elementButton"){
//let scene = ElementsScene(size: self.size)
self.view?.presentScene(scene)
} else if (touchNode.name == "classicButton"){
//let scene = ClassicScene(size: self.size)
self.view?.presentScene(scene)
} else if (touchNode.name == "quitButton"){
//Quit Game
}
}
1 个解决方案
#1
2
The API for scene transition is the following (ObjC version):
场景转换的API如下(ObjC版本):
- (void)presentScene:(SCNScene *)scene withTransition:(SKTransition *)transition incomingPointOfView:(nullable SCNNode *)pointOfView completionHandler:(nullable void (^)())completionHandler NS_AVAILABLE(10_11, 9_0);
"presentScene" with just one argument doesn't exist.
只有一个参数的"presentScene"并不存在。
#1
2
The API for scene transition is the following (ObjC version):
场景转换的API如下(ObjC版本):
- (void)presentScene:(SCNScene *)scene withTransition:(SKTransition *)transition incomingPointOfView:(nullable SCNNode *)pointOfView completionHandler:(nullable void (^)())completionHandler NS_AVAILABLE(10_11, 9_0);
"presentScene" with just one argument doesn't exist.
只有一个参数的"presentScene"并不存在。