make screen flash red

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ceayo

make screen flash red in 3d, as in: the player takes damage, so the screen flashes red…

:bust_in_silhouette: Reply From: Inces

easiest shader ever.
To apply screen shader to 3d You need to child some ColorRect to root node and extend it to whole screen ( remember to set mouse filter to ignore )
You add material and new shader to ColorRect.
Set up uniform float switch
in fragment() do :

COLOR = mix(vec4(0.0),vec4(1.0,0.0,0.0,1.0),switch)

and now You can turn your blood flash on with


and of


which You should switch between player being hit and some timer countdown after hit

If You don’t know about shaders yet, just check the documentation and my code will become clear to You