I stay away from timers, there really isn’t a need for them in SpriteKit

You have a built in timer function with the update func, or you can Just use actions to control your time.

what you are probably looking for is particle.resetSimulation()

I would do what you need to do like so

you can also put a key on your action and stop it by key name whenever needed

if let spark = self.childNode(withName: "sparkin") as? SKEmitterNode {
    
    self.spark = spark

    //set time here to how long in between restarting the emitter
    let waiter = SKAction.wait(forDuration: 5)
    let resetter = SKAction.run( { self.spark.resetSimulation() } )
    let seq = SKAction.sequence([waiter, resetter])
    let repeater = SKAction.repeatForever(seq)
    run(repeater)
}

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top