I am new in stackoverflow and Swift both. I am doing a skeet game with Swift and SpriteKit and I would like to implement the broken ceramic effect when I touch a object. I have all about it except this effect. I have just created my "Myparticle.sks" and selected the image, the number of particles,... Also, I was trying and I add my emitter node in the didMoveToView() method and I observed that I could see it the effect when the scene is displayed but when I add my emitter node in the touchesBegan() method I didn't see it.
I am a little confused for that.
Thanks!
-------Edit--------
I wrote this code in my Class.
private struct Particle{
static let untypedEmitter : AnyObject = NSKeyedUnarchiver.unarchiveObjectWithFile(NSBundle.mainBundle().pathForResource("MyParticle", ofType: "sks")!)!;
}
let emitter:SKEmitterNode = Particle.untypedEmitter as! SKEmitterNode
Then I wrote this other in the didMoveToView() method. With this I could see the effect.
emitter.position=CGPoint(x:self.frame.width/2,y:self.frame.height/2)
self.addChild(emitter)
Finally, If I add the emitter as before in my touchesBegan() method I didn't see anything.