This playground includes sample code to explore SpriteKit. The scene, derived from what was shown on stage at WWDC 2014, contains two cannons that each fire balloons at random intervals. When the balloons collide, they pop and disappear. In this playground, you’ll learn just how easy it is to create an engaging scene with custom motions and effects.

As you change the code, you’ll see the effects live in the playground and you can have fun by changing and breaking things.

Let's get started!

Presenting the Scene in the Timeline

SpriteKit content is presented in an SKView object. The view runs simulations and renders the content. All content is represented in an SKScene object, which is the root node for all nodes in a tree of SKNode objects. In this scene, you’ll add nodes and create your game’s content.

The scene was loaded from a SpriteKit scene file, which we created in Xcode’s SpriteKit Level Designer. All resources, including scenes and image assets, have been embedded in the playground bundle and are available for us to use. You can add your own images in the bundle, too. Just right-click on the Balloons.playground file in the Finder and choose Show Package Contents.