I have problem when i updating score in the game i make i dont know what is the problem but when i shoot something the score should increment by 1 but in my code sometimes it increment by 2 or 3 sometimes 1 it not constant i dont know why this happen here is the code i used
@interface GameScene () {
SKLabelNode* _scoreLabelNode;
NSInteger _score;
}
-(void)didMoveToView:(SKView *)view {
_score = 0;
_scoreLabelNode = [SKLabelNode labelNodeWithFontNamed:@"Silom Regular"];
_scoreLabelNode.fontSize = 50;
_scoreLabelNode.position = CGPointMake(self.size.width - 335 , self.size.height - 60);
_scoreLabelNode.zPosition = 100;
[self addChild:_scoreLabelNode];
_scoreLabelNode.text = [NSString stringWithFormat:@"%d",_score];
}
if (contact.bodyB.categoryBitMask == ObjectCategory) {
_score++;
_scoreLabelNode.text = [NSString stringWithFormat:@"%d",_score];
}