Day 19 of my Developer Journey: Creating the Shield Powerup logic
Objective: Create logic for a shield that takes 1 hit for the player
First we will set up our shield powerup as we set up those before. We will give it all of the properties we gave those before it in the inspector window, however we will set the ID to 2.
Next we slightly adjust the random number value in the Spawn Manager so that it can spawn our new powerup.
Now, lets set up how this will work. First, we need a bool to check if shields are active.
Next we will create a void method to switch this bool.
Now for the logic of not taking damage for 1 hit. We will achieve this by ending the damage method early with the return command, which will happen after the variable was switched back to false. This we will do to avoid a bug which will makes us immortal.
Lastly we will call the shields method from our powerup.
Objective: COMPLETED