func didBeginContact(contact: SKPhysicsContact) {
if ( contact.bodyA.categoryBitMask & BodyType.shield.rawValue ) == BodyType.shield.rawValue {
contact.bodyB.node?.removeFromParent()
counter++
println(counter)
} else if ( contact.bodyB.categoryBitMask & BodyType.shield.rawValue ) == BodyType.shield.rawValue {
contact.bodyA.node?.removeFromParent()
counter++
println(counter)
}
}
One physics body is from a texture shield.physicsBody = SKPhysicsBody(texture: shieldTexture, size: shieldTexture.size())
the other is from a circle sand.physicsBody = SKPhysicsBody(circleOfRadius: sand.size.width/2)
When the tow objects contact each other sometimes sand.physicsBody = SKPhysicsBody(circleOfRadius: sand.size.width/2)
gets called multiple times. How do i get it to only get called once for each object even though i remove it from the parent as soon as it contacts.