FlxCamera
contains a built-in FlxCamera.flash()
function which will fill the whole camera with a solid color that fades out over some time.
// flash the screen red, and have it fade after 1 second
FlxG.camera.flash(FlxColor.RED, 1);
FlxCamera
contains a built-in FlxCamera.flash()
function which will fill the whole camera with a solid color that fades out over some time.
// flash the screen red, and have it fade after 1 second
FlxG.camera.flash(FlxColor.RED, 1);
package;
import flixel.FlxG;
import flixel.FlxState;
import flixel.util.FlxColor;
class PlayState extends FlxState
{
var timer:Float = 2;
override function update(elapsed:Float)
{
timer -= elapsed;
if (timer <= 0)
{
timer = 2;
FlxG.camera.flash(FlxColor.fromHSB(FlxG.random.int(0, 360), 1, 1));
}
super.update(elapsed);
}
}