O'Reilly logo

Build iOS Games with Sprite Kit by Josh Smith, Jonathan Penn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Loading Particle Emitter Files

Unfortunately, loading particle emitter files into memory isn’t as straightforward as loading sound files into actions, as we saw in Playing Sound Effects in the Scene. For the moment, the Sprite Kit API doesn’t give us a single method call to load and cache the file for later reuse. But that doesn’t mean we can’t implement it ourselves!

The *.sks files are archived SKEmitterNode instances. When we manipulate what we see in the Xcode particle editor, we’re actually manipulating the real properties on this kind of node. When Xcode writes the particle emitter to disk, it uses the NSKeyedArchiver mechanism.

We can retrieve a copy of that node by loading it from the app bundle. To mimic the similar API that Apple ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required