Particle Emitters – Story Tellers iOS Starter Kit Documentation

Using particle emitters, or  is incredibly simple in the Story Tellers iOS Starter Kit 2. You can drag an Emitter into your scene, Name it, and treat it like any other node.

Adding an SKEmitterNodes to your SKScene

 

After naming it, you can use Properties to stick the emitter to other nodes, run actions on it, hide / show it, etc. If you want to customize your own particle emitter, you can set the Particle Texture to any image, then begin defining how the particles are emitted using Birthrate, Maximum, Lifetime, etc. You’ll notice in the screenshot above, there’s no shortage of options. And customizing these can take a lot of trial and error. So we have a solution….

If you create a new file in Xcode you can choose SpriteKit Particle File, then choose from a pulldown of pre-made particles. 

Using pre-made Particle files in place of SKEmitterNodes in SKScene

Give your particle file a name, for example, Magic.sks. 

Next, go back to your Scene file and give your emitter the same name (minus .sks). So for example, Magic.

Replacing pre-made Particle files in place of SKEmitterNodes in SKScene

The code will notice this match and replace the emitter in your scene with the preset emitter in Magic.sks

You can modify any of the settings in the .sks file and they’ll be used in the Scene.

And since the placeholder emitter in the Scene defaulted to have 0 values for most options, if you set those to anything other than 0 the kit will use those values.

So your .sks file is essentially a base template, and the placeholder emitter can override the template.

Cool huh! 

 

If you stumbled onto this article, it is part of our documentation for the Story Tellers iOS Starter Kit 2. The kit enables you to make children’s book apps and games without writing any code! But it is Swift 2 based and compatible with iOS9 (or higher) and Xcode 7 (or higher), so kit buyers can even extend the functionality to fit their needs further. Some of what we cover in the kit documentation may apply to Xcode in general, so this article could be worth a read even if you aren’t a user. You can purchase Lifetime Updates the kit here, or subscribe Yearly to CartoonSmart and get the latest version, plus access to all of our other kits / tutorials.

We’ve also created an iBook to document the very latest properties in the kit, so be sure to download that as well.