brief safety after each hit
Invincibility frames, or i-frames, are a window of 0.5 to 1 s after a hit during which the character ignores further damage. Without them, a bolt that overlaps the character for 9 frames deals damage on all 9, and three bolts empty the top health bar. The bottom character takes one hit, gets knocked back, and blinks for 1 s while the next bolt passes through without dealing damage.
Add invincibility frames: after the player takes damage, ignore all further damage for 0.5 to 1 s, blink the sprite on and off at about 10 Hz during that window, and apply a knockback impulse that pushes the player away from the damage source.