Buffing up the Player Shield!

We already have a shield powerup in the game… but it feels somewhat lacking right now. That’s why today, we are going to take a look at how we could buff it up a little bit!


Allow the shield to withstand three hits before collapsing. Visualize current shield strength.


First up, I have decided to visualize the current shield strength with the color of the shield itself. I have decided to go with a blue = full power, purple = damaged, red = almost depleted.

I have created an animation for each color and set each animation as a different ‘State’ in the ‘Animator.’- the ‘Transition’ tracking is done via an int ‘Parameter’ I have called ‘ShieldStrength.’

I have also decided on creating a new script, ‘ShieldBehavior,’ which controls…well, the behavior of the shield.

Here I have created three methods:

  • AreShieldsActive() - This method returns a boolean variable that stores whether the shields are active or not
  • ActivateShields() - This method turns on the shield powerup, and if they are already on, sets the HP value of the shield to the maximum.
  • DamageShields() - This method is responsible for decreasing the shields' HP and switching up the animator transitions. Also, if the shields are fully damaged, turn off the shield GameObject.

Now all I need to do is to change the ‘Damage()’ method in the ‘Player’ script.

Now the shield power-up is a bit stronger and can withstand more shots - it may seem more alluring for the player to risk trying to pick up the power-up!

But that is it for now, thank you for reading and feel free to follow me for more articles - and as always, good luck and see you next time!



Aspiring and eager beginner Unity developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store