SKSpriteNode Touch on non transparent area


I have a problem that don’t found solution, I search and read a lot of post but nothing work.
I have some SKSpriteNode with transparent area and I need detect the touch only on the non transparent area.


if let touchedBody:SKPhysicsBody = self.physicsWorld.body(at: pos) {   
            if let theSprite:SKSpriteNode = touchedBody.node as? SKSpriteNode {

Only work the last one SKSpriteNode and only at some locations inside the non transparent sprite.


for node in nodes(at: pos) {
            if ( != "gameboard"){    
                print("Node position \(node.position) name \(") 

I get all the nodes at location, but only is valid the non transparent.
I try to get the alpha value of the texture but I’m blocked… :frowning:

Any other way to solve this? What I’m doing wrong?

This topic was automatically closed after 166 days. New replies are no longer allowed.