1

I am learning Spritekit and I would like to know how I can convey the impression of lightning by lighting up the scene. I DON'T want to show the actual lightning bolt. But I want the clouds in the sky (for example) lighting up, or the entire scene (followed by appropriate sounds) to convey a lightning effect during stormy weather.

Any help will be greatly appreciated. Thanks.

1 Answers1

1

One way I believe you could do this is by creating an if statement and the changing the color to white then back to it's form. Also, a new zPosition would be needed if everything would be lite up.

if lightUpThePlace = true {

background.color = SKColor.white

background.zPosition = 100

//and then do either  : (Because the language is read top to bottom)

background.color = SKColor.//the regular color

background.zPosition = //default zPosition

}

Otherwise, you could make a white sprite node big enough for the screen and move it to the center instantly and then have it despawn.

let flash = SKSpritenode(imageNamed: "//white sprite node")

let move = SKAction.moveTo...

let despawn = flash.removeFromParent()

let sequence = SKAction.sequence([move, despawn])    

Hope This Helped!

Selaron
  • 6,105
  • 4
  • 31
  • 39
Qod33
  • 17
  • 4