← All interactive demos

Invincibility Frames — Interactive Demo

This runs the same calculation as the video "Why Do Games Give You Invincibility Frames After Damage?". Every 1/60 second (one frame), it checks whether the player's box and an enemy's box overlap. If they do, the player takes 10 damage (HP 100). Taking damage starts an invincibility timer, and while the timer is running, no damage is taken (the player blinks during that time).

1. Walk it yourself

Move the player with the ← → keys (on a phone, the buttons below).
Task 1: set invincibility to 0 and run into one enemy. How many frames until you are defeated?
Task 2: set invincibility to 3 seconds (180 frames) and see how many hits it takes to get through the group of 4.
 

2. Count over 1000 corridors (the player just walks straight)

Red = share of the enemies you touched that hit you 2 or more times. Yellow = share you touched but took 0 damage from (passed through). The white line is the invincibility time on the slider above.

This page uses the same calculation as the diagrams in the video (60 frames per second, 40-wide boxes, 10 damage, HP 100). These are not values from any real game. The rates change with enemy spacing and speed, and there is no single right invincibility time. It always calculates in fixed steps of 1/60 second, however often the screen refreshes.
Sources and credits: same as the video description (AI was used to make the diagrams and script; no game footage or characters are used).