Where every child node is a Sprite. I want to be able to drag any of them and in case two sprites are overlapping both of them should be dragged at the same time. But it seems I cannot capture the same touch event on two nodes that are not child-parent related (or in a direct hierarchy line). How can I do this?
I think we cannot get the same event on the brothers because the event bubble flows to the parent.
What I would do is identify the touch position and then check if its on the childrens, select those childrens and move them.
Here the parent will wait some child be touched, then verify if the touch is on the boundingBox of any other child, select them and move them together.
Thank you very much! Seems like the best solution indeed.
Nevertheless I would love to have the option to allow events pass through the top receiving node with for example a return flag on the callback function. Something like this:
onTouchStart(touchEvent) {
…
return false; // This for allowing the events not being consumed would be awesome
}
But given the current limitations, your solution as I said before is the way to go.
I’m testing here…
I can also get the touch events from the parent node if I listen ( this.node.on ), and get the touched node from the touch event. ( event.target )
But again, seems we are not going to receive from all the childrens, just from the sprite on the top