Search code examples
iosswiftflappy-bird-clone

Flappy bird screen flash when you die? - Swift


When you collide with a pipe in Flappy Bird, an extremely brief white flash fills the screen. How can I reproduce this in my own game? It almost resembles the same white flash that occurs when you take a screen shot, but it's much shorter in duration. How can I reproduce this short flash of white light? This code would obviously go inside of my if died == true statement, just asking about the code that would go inside of it to make the white flash.


Solution

    • Create a SKShapeNode with the size of screen.
    • Make its backgroundColor to be white.
    • Add a SKAnimation, change the alpha from 0 to 1 then from 1 to 0.

    done.