02 / Impact
Hit flash
one bright beat that says it connected
For a few frames after taking damage, the target is drawn in one bright colour, usually white. It's the cheapest hit confirmation there is (a single shader value), and it reads even when the target is tiny, distant or surrounded by effects. Strike with it on and off: the health bar moves either way, but only the flash makes the hit obvious.
- Enemies, bosses and destructible props taking damage
- Shields absorbing a hit
Prompts to paste
Add a damage flash: give character materials a flash amount (0–1) and colour, set the amount to 1 when damage is applied and back to 0 after about 60 ms, and blend the flat colour over the sprite or mesh while keeping its alpha.
Add a damage flash that works for every character. In the shared sprite or mesh shader, add the uniforms flashAmount (0–1) and flashColor (white by default) and mix the colour over the shaded result by flashAmount, keeping the original alpha. In the damage handler, set flashAmount to 1 and bring it back to 0 after 60 ms, either as a hard cut or a quick fade. Trigger it from the once-per-hit damage event, and change the uniform on the existing material rather than creating a new one.
Examples
Start with white
White reads against nearly every palette, which makes it the safe default.
Colour can carry meaning
Red when the player is hurt, gold for a critical, blue when a shield soaks the damage. Keep the duration the same so they all read as hits.
Show it during the hold
Combined with hit stop, the flash covers the frozen frames, so the moment of contact is the brightest thing on screen.
Pitfalls
Flashing too long
After roughly 120 ms a flash starts to look like a status effect, such as poison or invulnerability, rather than a hit.
A new material per hit
Creating a material on every hit allocates memory and can break batching or other effects. Change one value instead.
Re-flashing every frame of overlap
A hitbox overlapping for several frames should cause one flash, using the same once-per-hit rule as the damage.
Starting values
| Setting | Value | Note |
|---|---|---|
| Duration | 30–80 ms | 2–5 frames |
| Colour | white, or a colour with a meaning | |
| Curve | a hard cut, or a fast fade |