当我的子弹触及敌人而不死时我有一个问题我不知道为什么我做错了什么..?
func didBeginContact(contact: SKPhysicsContact) {
let firstBody: SKPhysicsBody = contact.bodyA
let secondBody: SKPhysicsBody = contact.bodyB
if ((firstBody.categoryBitMask == physicsCatagory.Enemy) && (secondBody.categoryBitMask == physicsCatagory.Bullet)) {
collisionWithBullet(firstBody.node as! SKSpriteNode, bullet: secondBody.node as! SKSpriteNode)
}
}
func collisionWithBullet(enemy: SKSpriteNode, bullet: SKSpriteNode){
bullet.removeFromParent()
enemy.removeFromParent()
}
任何人都知道plz帮助我 ty