I'm trying to make a button that's an SKLabelNode
. When it gets pressed, it's supposed to change scenes, but there is something wrong with the line where location is declared.
override func touchesBegan(touches: Set<NSObject>, withEvent event: UIEvent) {
super.touchesBegan(touches, withEvent: event)
let location = touches.locationInNode(self)
let touchedNode = self.nodeAtPoint(location)
if touchedNode.name == "startGameButton" {
let transition = SKTransition.revealWithDirection(SKTransitionDirection.Down, duration: 1.0)
let scene = GameScene(size: self.scene.size)
scene.scaleMode = SKSceneScaleMode.AspectFill
self.scene.view.presentScene(scene, transition: transition)
}
}
The error is here on the line.
let location = touches.locationInNode(self)
It reads
'Set< NSObject>' does not have a member named 'locationInNode'
I'm not sure how to fix it. I've looked at a lot of working button templates, but mine always has an error.