I am making an Elden RIng type game. I am working on short invincibility for dodging, and don't quite know how to do that

Could you help?

Those are called “i frames” in games! There are 2 ways that I know of:

Way 1

When the player dodges, you can set an “i frames” variable to a number (bigger value = longer invisibility). In an “on game update” or “forever” loop, add a “change (i frames) by (-1)”. Then, whenever the enemy attacks, only let the player get attacked when the “i frames” variable isess than it equal to 0 (if <(i frames) <= (0)> then). If done right, it should not get hurt when dodging!

Way 2

when the player starts to dodge, set the players SpriteKind to something like DodgingPlayer. when the enemy attacks, it fiirst checks if the players kind is Player, and if not, attack. (if <((player) kind) == ([Player])> then). in the timers extension, use the “after (…) do” (bigger number = longer invincibility) block to set the player’s kind back to Player.

should be pretty easy, you just need to set the damage trigger to only damage the player when the variable == (something, like 1), and whenever the player dodges, just set the variable to 0, then when they are done dodging, set it back to 1 (and if you don’t want the player to just keep dodging and become invulnurable, just set a cooldown between dodges). hope that helped :grin: .

I am familiar with invincibility frames, and came up with this, and I’m not sure if it works. Thank you for reaching out to help!

When the player hits the dodge button, make the sprite ghost through walls like below

that way any other sprites touching that sprite will not affect or deal dammage.

1 Like

Instead of pause, use the timer extension

1 Like

Thank you!

Which block should I use? I’m a week into makecode, and I’m not quite familiar with the timers extension.

After () do

is better than pause, but if you don’t know how, then you can do pause