STEP 1
Flash
Turn the enemy pure white for a couple of frames on impact.
Why it works — The eye catches the contrast instantly: the player knows the hit landed before reading any number.
- Duration: 50–80 ms (3–5 frames at 60 fps)
- Flash = 100 % white, no fade-in
- Make the material local to scene, or every enemy flashes at once
GDScript · Godot 4
# hit_flash.gdshader
shader_type canvas_item;
uniform float flash : hint_range(0.0, 1.0) = 0.0;
void fragment() {
COLOR.rgb = mix(COLOR.rgb, vec3(1.0), flash);
}
# enemy.gd
@onready var sprite: Sprite2D = $Sprite2D
func flash() -> void:
var mat := sprite.material as ShaderMaterial
mat.set_shader_parameter("flash", 1.0)
await get_tree().create_timer(0.06).timeout
mat.set_shader_parameter("flash", 0.0)