kill your characters – animating explosions with SKAnimations in Sprite Kit

explosionThis is the fun part of developing games. You have to find ways how your character’s gonna die. On PoBo we had some triggers that we call bad_stones. First of all we got a stone that bursts out a fire spray when the player’s coming into contact with it.
After that we thought about other ways how the character can die when he collides with this triggers. We decided to take two more ways to die. A circular saw, that will cut the player into two halfs and a simple explosion that splats PoBo-blood across the screen .

Once you decided in your imagination how it should look like the rest will follow easily. And that’s what it looks like

Animating explosions with SKAnimations in Sprite Kit

For animations it’s more than just adding a fire for example to an object. The important thing is to think about how an animation reacts with the environment that simulates a real physical reaction for example. So lets see what we need for an explosion:

  • A SKEmitterNode to show the explosion fire
    use the Xcode built in emitter template spark for example and customize it to your needs
  • A SKEmitterNode to show the smoke that an explosion will cause
    here also the smoke emitter template does a good job

skemitter_template

  • Some kind of a splat image that will cover the screen to make it look like the camera is full of the pieces that will be blown away from the explosion source
    This can be simply drawn by your own with any common image software
  • An animation that will shake the environment
    This is a very important issue. To make an explosion look real the environment have to react like on a real explosion. To create this effect shake all the sprites with a small range of pixels from left to right and back again within a very small time range for example 0.1 seconds. We also scaled the whole background within a small time range up a very little and back again to make it look pulsating.
  • An explosion sound sample
    If you don’t have your own sample library, some samples can be easily found for example at www.freesound.org
    Just keep an eye on the usage with the copyrights for commercial products…

This is our method sourcecode for xcode using Sprite Kit to bring this points to life to simulate an explosion

 

 

 

 

One thought on “kill your characters – animating explosions with SKAnimations in Sprite Kit

  1. Great post! Glad to see you are using SpriteKit to get such great effects working in your game!

    Could you kindly share the code for the Circular Saw death effect please? I’d be keen to see and learn how that works.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.

*
*
Website