Invincibility

How do you make invincibility and knockback after getting hit? I’ve tried doing it with my own knowledge, but I haven’t gotten anything.

3 Likes

One way to do invincibility is using lifespans and the sprite “on destroyed” event! The basic idea is, when the sprite is hit, you change the kind and set a lifespan (invincibility duration). When that lifespan ends, you re-create the sprite with the original properties.

Here is an example: https://makecode.com/_gmy7EM7KAJF0

5 Likes

Thank you thank you! Was trying to get complicated with a function and a boolean and a pause etc etc. this is way cleaner.

3 Likes