Everything is in the Player script and dealing with the Damage() method.
- Open the Player script.
- Head down below the Damage() method.
- Make an “IEnumerator InvulnerabilityRoutine()” method:
4. Then start the coroutine right below where “_lives — “ is.
So whenever you get damaged, you can’t be hit for 1 second. This also makes it where you can’t pick up Powerups, so be careful!
That was how to make your Player invulnerable after getting damaged! Easy enough, right!? Next, I will make a new kind of Enemy that comes in from the side and goes down at an angle!
Thank you for your time!