Hey so i have this game where you collect gems to unlock characters, i have the gems spawning and in my didBeginContct i have collision detecting setup, my problem is that it detects more than one touch and adds more than one gem! Please help i tried fixing it myself but i couldnt get the logic working right! Thanks in advance
func didBeginContact(contact: SKPhysicsContact) {
let fadeIn = SKAction.fadeAlphaTo(1, duration: 0.2)
let contactMask = contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask
switch(contactMask) {
case colisionType.Player.rawValue | colisionType.Triangle.rawValue: {
}
case colisionType.Player.rawValue | colisionType.Diamond.rawValue:
diamond.removeFromParent()
gems++
default:
return
}
}