How to make a flickering torch light with SKEmitterNode and SKAction

If you need a torch in your game, you can do that easily with an emitter. The built in emitter editor in XCode has even a fire template. If you use this fire .sks file you can easily put that in your game scene as a SKEmitterNode. But a fire or a torch need also some ambient light and effects to look suitable in your game.

The ambient light

Let’s first add a ambient background light around the fire emitter. This is not so easy if you want to do it without the forthcoming SKLightNode in iOS8 or customize the ambient shine. The trick is to add a sprite node with a transparent  gradient with the light color like this image
shine
The effect is that this will also enlight dark backgrounds in your scene.

The flickering animation

In detail you can see that some rays are added to the shining image above. A simple flickering effect can be done with animating this sprite. The animation should contain some scaling for the pulsating effect and some minimal rotation for the flickering effect to make it look like in the video above.

Here is the complete class :

 

Schreibe einen Kommentar

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

*
*
Website