Hit Flash Effect Shader

 

Hit Flash Effect Shader

How To Use:

Add The Shader to the Sprite

Make an animationplayer

and toggle through the active and inactive state

Shader code
shader_type canvas_item;

uniform bool active = false;

void fragment() {
	vec4 previous_color = texture(TEXTURE, UV);
	vec4 white_color = vec4(1.0, 1.0, 1.0, previous_color.a);
	vec4 new_color = previous_color;
	if (active == true)
	{
		new_color = white_color
	}
	COLOR = new_color;
}
Tags
hit flash, shader
The shader code and all code snippets in this post are under MIT license and can be used freely. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

Related shaders

Hit flash effect

Color cycling hit effect

Flash Shader

Subscribe
Notify of
guest

2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
KyleSzklenski
3 years ago

Just wanted to say: I was looking exactly for a hit-effect shader that did exactly what this one does, and it is setup/functions exactly as I expected it to, so that’s perfect. Nice work!

Jackson.D
1 year ago

Thanks for making this, this was exactly what I needed.