โ† All examples

godot shaders

Hit flash, blink and silhouette modes

Flash a sprite toward a colour when it takes damage: mix, additive or full silhouette modes, an amount to animate from a script, and an optional automatic blink for invulnerability frames.

Recorded render of Hit flash, blink and silhouette modes

What this component contains

  • ATTRIBUTION.md
  • LICENSE
  • README.md
  • component.json
  • demo.tscn
  • inspect_shader.py
  • material.tres
  • preview.png
  • sprite_hit_flash.gdshader
  • test_package.py
  • verification/native.json

How it works

Shader type
canvas_item
Parameters
flash_color (vec4 = 1, 1, 1, 1), flash_amount (float = 0), mode (int = 0), auto_blink (bool = no), blink_rate (float = 12), blink_duty (float = 0.5)
Use it on
A Sprite2D (or other textured CanvasItem) with transparent space around its shape, assigned to the node as usual.
Result
The sprite tinted strongly toward red as on a damage frame.
Renderers
compatibility: compiled and rendered, forward plus: not verified, mobile: not verified
Placement
res://baltor/godot_shaders/sprite_hit_flash/

Recorded checks

godot 4.7.2.stable.official.ed1daf0bf

  • contract_static
  • engine_run
  • engine_log_clean
  • shader_in_scene
  • capture_written
  • render_not_uniform
  • shader_changes_pixels

Limits to consider

One flash colour at a time. Driving `flash_amount` per instance needs separate materials (or instance uniforms in your own variant).