In video games, invincibility frames are the period of time when a player is invulnerable to a game’s hazards. They allow the player to make a mistake and have enough time to quickly move away from hazards. Without invincibility frames, moments of high challenge become frustrating for players that don’t have a high level of skill. While not every game requires invincibility frames, they are a feature that grants players a margin of error for how many times they can make a mistake.
To start, create 3 sprites and name them Spr_Player, Spr_Wall and Spr_Enemy1.
Then create 3 objects and name them Obj_Player, Obj_Wall and Obj_Enemy1
Select Obj_Wall and have Solid turned on
Then open up Obj_Player and put in these events:
Now make a sound file with the sound icon.
Select an MP3 file from your computer and in Target Options, Set it to Stereo and 16 bit.
In the Create event, enter the Control tab on the right. In the Variables section, select Set Variable and put in the following:
In the Alarm 0 event, put in the following:
In the Step event, put in the following:
In the Collision event with Obj_Enemy1, put in the following:
In the Draw event, put in the following: (For the code icon, put in image_alpha = Flash)
Once a room has been made and these 3 objects are placed in that room, the player should flash when coming into contact with the enemy and a sound effect will play. Do not hesitate to point out flaws and inaccuracies with this tutorial and I hope this has helped your title in progress.