2021年1月2日星期六

Sprite kit second node is not removing from parent

I am creating a game where the player must collect the gems(which are the nodes). The first gem is disappearing because of the following condition.

    if collision.matches(.player, .reward) {                            if contact.bodyA.node?.name == "jewel" {                  contact.bodyA.node?.physicsBody?.categoryBitMask = 0                  contact.bodyA.node?.removeFromParent()                  }              else if contact.bodyB.node?.name == "jewel" {                  contact.bodyB.node?.physicsBody?.categoryBitMask = 0              }                               if rewardIsNotTouched {                  rewardTouch()                  rewardIsNotTouched = false              }              run(sound.reward.action)          }  

Please help me to hide the second node and the third and the rest when the bodyA is intefrifing with BodyB

https://stackoverflow.com/questions/65502798/sprite-kit-second-node-is-not-removing-from-parent December 30, 2020 at 02:10PM

没有评论:

发表评论