I have a btnPause
that is a SKSpriteNode
and to this node I added two children:
let pauseOrange = SKShapeNode(circleOfRadius: 12)
...
let pauseX = SKSpriteNode(imageNamed: "close")
...
btnPause.addChild(pauseOrange)
btnPause.addChild(pauseX)
self.addChild(btnPause)
Where btnPause
has the same size and position of its pauseOrange
and pauseX
.
But, with the parent node, it does not print anything in the function touchesBegan
if node == self.btnPause { print("btnPause")}
instead with its content if it works in the function touchesBegan
if node == self.pauseOrange { print("pauseOrange")}
Is there any way that if I touch the container of the nodes, this (the container) takes the event in the function touchesBegan
?
What I want to achieve is that by pressing any child node, it is as if the parent node were pressed, thus saving me from doing many ORs in the IF of the function touchesBegan