This question is an exact duplicate of:
- Do an SKAction if the colors of two sprites aren't the same? [duplicate]
How can I check if, when I collide with an SKSpriteNode in the middle of two rectangles with a ball, the ball and the two rectangles are the same color?
For example, if my two rectangles are red, and my ball is blue, I want it to detect that the colors of my rectangle and the ball are different. If they are the same color, then I don't want anything to happen. If they aren't, I'll write the code that makes the player lose. But how can I detect the color difference when the ball collides the skspritenode located in the middle and in between the two rectangles?