Documentation Archive

Developer

Xcode Overview

Adding Particle Emitter Effects

Especially useful for developers of iOS and Mac games, Sprite Kit provides a graphics rendering and animation infrastructure. This infrastructure includes particle emitters. Particle emitters can range from a single image that barely moves, to thousands of small particles flying across the screen. You can use particle emitters to simulate fire, rain, smoke, snow, sparks, and other animated effects.

Xcode provides eight particle emitter templates and an editor for manipulating the appearance and behavior of particles.

Create a Sprite Kit–enabled game from the New Project template in Xcode, or use the General pane in the project editor to add the Sprite Kit framework to an existing target. To add a particle emitter to your project, choose File > New > File, and then choose Resource > SpriteKit Particle File.

image: ../art/AddParticleEmitterFile.pdf

Select the particle template from the pop-up menu, and click Next. Enter a name for the emitter in the Save As field. Select the checkbox associated with your project in the Targets area. Xcode creates a file with the extension .sks.

Select your particle emitter file in the project navigator, and Xcode opens the file in the particle emitter editor.

image: ../art/MagicParticles.pdf

Modify the look and feel of the particles with the Particle Emitter inspector (image: ../art/ParticleEmitterInspector.pdf). For example, you can change the rate at which particles are created, what a particle looks like, and how it acts after it is created. Changes made to the inspector take effect immediately and can be viewed in the editor.

For more detail, see the Particle Emitter Editor Guide.