当玩家联系硬币时,分数随机增加,我希望它增加1
func didBegin(_ contact: SKPhysicsContact) {
let firsBody = contact.bodyA
let secondBody = contact.bodyB
if firsBody.categoryBitMask == scoreCatagory && secondBody.categoryBitMask == playerCatagory || firsBody.categoryBitMask == playerCatagory && secondBody.categoryBitMask == scoreCatagory {
score = score + 1
scoreLable.text = "\(score)"
}