This demo project demonstrates how to create a lightning effect for your Sprite Kit game.
The project contains three ways to create a lightning:
- by using SKShapeNode
- by using CAShapeLayer
- by using SKSpriteNode (best way IMHO, enabled by default)
If you want to try another approach, such as SKShapeNode or CAShapeLayer do the following:
- open SpriteKitLightning\ViewController.m file
- replace Scene3 by Scene1 or Scene2 respectively
Please refer to http://andreygordeev.blogspot.com/2014/11/sprite-kit-lightning.html blog post for more info.
I realize that these approaches may be not ideal, so pull requests are welcome!
Swift version: https://github.com/andrew8712/SpriteKitLightning-Swift
The code is under IDC (I don't care) license, so go ahead and create something amazing with using this effect!