The game is looking good, it would be nice to start adding those little extra touches to enhance the game experience. You are going to be adding both a particle effect and sound effect whenever a seal gets destroyed. SpriteKit has a great integrated particle effect designer which you are going to use to define the style of your first particle effect.

Build a particle

Create a new particle effect File > New > File > SpriteKit Particle File

Set Name to SealExplosion SpriteKit Particle File

SpriteKit Particle File

SpriteKit Particle Black Smoke

I ended up making a more subtle smoke effect. You can copy the property values shown or feel free to go crazy and create your own unique look.

Particle attributes:

Particle Attributes 1

You can use the color ramp to create interesting cycles of color.

Particle Attributes 2

This should look something like that:

SpriteKit Particle Grey Smoke

Feel free to spend some time playing around with different values.

Particle effect in code

Let's add some code that adds the particle effect to the scene whenever a seal gets eliminated.

Add the following code to the start of the dieSeal method:

/* Load our particle effect */
let particles = SKEmitterNode(fileNamed: "SealExplosion")!

/* Convert node location (currently inside LevelHolder, to scene space) */
particles.position = convert(node.position, from: node)

/* Restrict total particles to reduce runtime of particle */
particles.numParticlesToEmit = 25

/* Add particles to scene */

You load in a particle effect and place it at the seals's position directly before the seal is removed from the scene. The runtime of the particle can be controlled by adjusting the numParticlesToEmit, it takes a bit of trial and error to get a value that looks right.

You can drag the SealExplosion.sks into the GameScene.sks to see what it looks like in-game, just hit Animate.


Adding sound effects is quite straight forward in SpriteKit, you can make use of the playSoundFileNamed SKAction to play sounds.

Download our SFX Pack Once the download is complete, unpack the folder and add it to the project. Ensure Copy items if needed is checked. SFX Added Note: Although this SFX is an asset it's a not a graphic asset so don't put it in the assets.atlas folder.

Add this code after the particle code in the dieSeal method:

/* Play SFX */
let sealSFX = SKAction.playSoundFileNamed("sfx_seal", waitForCompletion: false)

Run the game... Bask in the majestic.... Moos? .... of the seal :]

Find better SFX.


Well done! You learnt to:

  • Create your own custom particle effects and make them play when certain events in your game occur
  • Play SFX

In the next chapter you will be adding animated penguins to the sidelines.


If you have feedback on this tutorial or find any mistakes, please open issues on the GitHub Repository or comment below.

Summer academy

An iOS Development Summer Course

Design, code and launch your own app. Locations in San Francisco and Asia

Find your location

Product College

A computer science college

Graduate into a successful career as a founder or software engineer.

Learn more

Cookies on Make School's website

We have placed cookies on your device to ensure that we give you the best experience on our website.

This site uses cookies to deliver our services. By using our site, you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Your use of Make School’s Products and Services is subject to these policies and terms.

Please note that Make School no longer supports Internet Explorer

We recommend upgrading to a modern web browser. Learn more