SpriteKit Tutorial: Create an Interactive Children’s Book with SpriteKit and Swift 3

Learn how to create an interactive book app with very little code by using SpriteKit with Swift 3 to build a children’s book. By Caroline Begbie.

Leave a rating/review
Save for later
Share
You are currently viewing page 5 of 5 of this article. Click here to view the first page.

Particles

These pages about winter and snow are lacking an important ingredient — snow!

In my opinion, no interactive book is complete without particles. These are elements like fire and rain and explosions and snow. A particle is usually one small image. This image is repeated many times in different sizes, colors and directions.

SpriteKit particles are really easy to create with the SpriteKit Particle Editor. Click File/New/File…. Choose the iOS/Resource/SpriteKit Particle File template and click Next.

From the Particle Template dropdown, choose Snow. I encourage you to experiment with the other particle templates later.

Click Next and name the file Snow, then click Create. The particle file will open and “real” snow will animate in front of you.

snow

Each particle is an instance of a spark texture, but the image is sized differently for each particle. The snowflakes also descend in different speeds and directions. Playing with particles is unfortunately beyond the scope of this tutorial, but all these settings can be changed in the Attributes Inspector.

Open Scene01.sks. You’ll notice that there are two backgrounds here. The backgrounds are exactly the same except that backgroundAlpha has a transparent section for the window. You’ll sandwich the snow between these two backgrounds.

Drag your Snow.sks file from the Project navigator to the top center of the window in the background image. Change:

  • Name: snow
  • Position: X: 263, Y: 200, Z: -8

Here you set the Z position so that the emitter is sandwiched between the two background nodes.

Click Animate to see the snow fall outside the window! Now it’s looking really wintry.

simulator-final

Where To Go From Here?

I hope you enjoyed working through this tutorial. I love working with Tammy Coron’s art. :]

At this point the story is up to you! You can download the complete sample project and compare notes if you’d like.

simulator-snowman

If you want to learn more about SpriteKit, be sure to check out our book 2D Apple Games by Tutorials.

If you have any questions or comments, feel free to join in the discussion below!

Contributors

Jairo A. Cepeda

Tech Editor

Chris Belanger

Editor

Michael Briscoe

Final Pass Editor

Tammy Coron

Team Lead

Over 300 content creators. Join our team.