Вообще, вам нужно создать вложенную-узел первого
override init(size: CGSize){
let playButton = SKLabelNode()
playButton.fontSize = 40
playButton.text = NA_MENU_BTN_PLAY
playButton.position = CGPoint(x: self.frame.midX, y: 300)
//give it an unique name
playButton.name = "Play"
playButton.zPosition = 3
addChild(playButton)
}
затем использовать func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?)
для обработки сенсорного события
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
for touch in (touches){
let location = touch.location(in: self)
let touchNode = atPoint(location)
if !((touchNode.name) != nil) { return }
switch touchNode.name! {
case "Play" :
//your logic here!!
let trialScene = TrialScene(size: self.size)
self.view! .presentScene(trialScene, transition: transition)
}
}
}