I am building a SpriteKit game in which two nodes, one moving and one stationary make contact. This contact increments a variable holding the score.
Everything is working, but the two nodes that make contact will often record more than one contact, resulting in several increments when it should only be returning one.
The strangest part about it is that I have the stationary node CHANGES PLACES upon contact, so why would it detect multiple collisions for just one hit if it doesn't even stay stationary? I've even tried just removing it upon contact to get it to increment only once upon a hit, and even that still results in multiple collisions.
As of right now I am just using:
if firstBody.categoryBitMask == HeroCategory && secondBody.categoryBitMask == BellCategory {
score1++
scoreText.text = "\(score1)"
}
But have tried many other situations including using
didEndContact
and changing the
restitution
Any help would be much appreciated.