Hit Flash Shader (Custom Color)

Hi Godoteam,

I’m working on a little platformer and made this little shader for a hit effect !

You can custom the color and the strength of the flash effect

 

* Update : Added hint_range so you can only tweak from 0 to 1 the value

Shader code
shader_type canvas_item;

uniform vec4 hit_color : hint_color = vec4(1.0, 1.0, 1.0, 1.0);
uniform float hit_strength : hint_range(0.0,1.0) = 0.0;

void fragment() {
	vec4 custom_color = texture(TEXTURE, UV);
	custom_color.rgb = mix(custom_color.rgb, hit_color.rgb, hit_strength);
	COLOR = custom_color;
}
Tags
attack, flash, hit, shader

Related shaders

Hit Flash Effect Shader

color splash (show only one color)

Gradient Color Fog

The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.
guest
4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
romanticist_20
romanticist_20
3 months ago

Awesome! I hated having to use raw-mode modulate because the sprite would alway glow with my WorldEnvironment settings. So this is exactly what I needed to fix that. Thank you!

John Brent
John Brent
3 months ago

Bro, you literally took this from a YouTube video and pretended you came up with this on your own. The least you can do is credit the person you got this from. In fact, I’ll do it for you: https://youtu.be/ctevHwoRl24