I have a SKShapeNode and i set a name for it, but when i try to detect it in touch began it doesn't work the way you use with other sprites.
override func touchesBegan(touches: NSSet, withEvent event: UIEvent) {
/* Called when a touch begins */
for touch: AnyObject in touches {
let location = touch.locationInNode(self)
if let body = self.nodeAtPoint(location) as? SKSpriteNode {
if var name: String = body.name {
switch name {
case "myShape":
println("Shape Touched")
case "enemy":
println("Enemy Touched")
default:
}
}
}
}
}
enemy is a SKSpriteNode and it gets detected correctly, but shape which is SKShapeNode doesn't. And i typed the string name correctly.