The SKEmitter node
The SKEmitterNode
object is a node that automatically creates and renders small sprites. We can configure the emitter node properties from our Xcode itself. We use the particle emitter editor for this purpose.
We can use target nodes to change the destination of particles. Here is a sample code snippet to demonstrate how we can implement the same.
// CREATING THE EMITTER NODE var emitter:SKEmitterNode = (fileNamed: "PlayerCollide.sks") // SETTING THE EMITTER POSITION AND NAME emitter.position = CGPointMake(0,-40) emitter.name = "playerCollide" // SEND THE PARTICLES TO THE SCENE emitter.targetNode = self.scene // ADDING EMITTER NODE self.addChild(emitter)
Let's discuss the properties and methods that are used while implementing Sprite Kit's emitter node.