I have created a template particle file in my project and want to use it with different texture images.
I have created this and use this method...
func addEmitterWithTexture(image: UIImage, size: CGSize, advanceTime: NSTimeInterval, scene: SKScene) {
let emitter = SKEmitterNode(fileNamed: "MyParticle")!
scene.addChild(emitter)
emitter.particleTexture = SKTexture(image: image)
emitter.position = CGPoint(x: size.width * 0.5, y: size.height * 0.5)
emitter.particlePositionRange = CGVector(dx: size.width, dy: size.height)
emitter.advanceSimulationTime(advanceTime)
emitter.zPosition = 3.0
}
I would like the images to pop in at different times so I use the advanceSimulationTime
. But it doesn't seem to have an effect. All the images use the same simulation time.
I'm guessing this is because the simulation time is on the parent?
Edit Hmm... that doesn't seem to be the case.
I wonder if all the emitters are on a global simulation timer? In that case, is there any way to start the emitters at different times?
Is that the case or am I doing something wrong?
I got around it in the end by using a waitAction on the scene and adding the emitters in a runBlock action after the wait.