How to implement temporary player invincibility after being hit

I am making a platformer game in which thee are enemies that can deal damage to the player. I am trying to implement a feature such that for a few seconds after being hit, while the player sprite is still flashing, the player cannot take damage. What am going for kinda like in smash bros when your character falls of the map and you loose a life, your character will get transported back into the ring and their sprite is flashing, while flashing, other characters cannot hit the player.
Also is there any way to make the character sprite flicker after being hit, like making them flash a certain color like white or black for a few seconds after taking damage??

Add a variable for object before collisions happens, and may use the flash extension

at the beginning of scene ,trigger once, action: canbehit = 1

if canbehit=1,(“collision condition”)–trigger once, actions: make player flash and canbehit=0

if !(not)player flashing & canbehit=0----------------action:canbehit=1

Please can I see how it will be implemented in the engine.