Is there a way to only run a SKemitter one time? I have a explosion when it is colliding with another node. The problem is that the explosion happens multiple times since it hits multiple times. How would I go about only running it once time?
Asked
Active
Viewed 121 times
1 Answers
1
SKEmitterNode can be made to stop emitting after emitting numParticlesToEmit
if that property is set: https://developer.apple.com/documentation/spritekit/skemitternode/1398043-numparticlestoemit
I believe that most “explosion” type emitters should already have that property set. However I suspect your problem is that you are adding a new SKEmitterNode each time there is a hit.
You could usee a Boolean var wasHit = false
to track the hit state.
Then when the hit occurs, check wasHit
before adding the emitter, and then set wasHit
to true.

Aaron Kreipe
- 309
- 3
- 8