当我尝试将SKEmitter添加到我的节点时,由于某种原因,我得到了一个断点。谁能解释这样做的正确方法?
我的代码:
func didBegin(_ contact: SKPhysicsContact) {
let bodyA = contact.bodyA
let bodyB = contact.bodyB
if bodyA.categoryBitMask == 1 && bodyB.categoryBitMask == 2 || bodyB.categoryBitMask == 1 && bodyA.categoryBitMask == 2 {
let player = SKNode(fileNamed: "player")
let explostion = SKEmitterNode(fileNamed: "explosion.sks")
explostion?.position = (player?.position)!
self.addChild(explostion!)
}
}