Handle Hit-Testing and Touch Events
To fix the problem with not being able to move Blob, you first need to better understand touch events and hit-testing. Hit-testing in SpriteKit involves checking to see what nodes were hit during a mouse or touch event. For a node to be considered during hit-testing, its isUserInteractionEnabled property must be set to true; the default value is false for all nodes except a scene node. If a node is hit, and it’s set up to ignore the interaction, the event will move on to the next closest node. The order in which nodes are tested happens in the reverse of the drawing order.
While hit-testing is undoubtedly an option, there’s another way to see what node was at an intersect location.
Before you begin, you need ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access