The Player’s shield should last for three hits and have an indicator that the shield is weakening. I’m going to make it more transparent the more hits it takes by lowering the alpha each hit.
In the Player script, provide a reference to the shield’s Sprite Renderer.
When the Player is damaged when shields are active, decrement shields left.
- At two shields remaining, lower the alpha to 0.7f
- At one shield remaining, lower the alpha to 0.4f
- When no shields remain, deactivate the shield effect and deactivate the visual
Each time the Player collects a Shield powerup, reset the Color to have full alpha of 1f, and set shields remaining to three.