Space Shooter Features: Shield Strength

Shield Strength feature:

  • Visualize the strength of the shield. This can be done through UI onscreen or color changing of the shield.
  • Allow for 3 hits on the shield to accommodate visualization.

Steps

  1. Add a Scrollbar UI element and a Text element to the Canvas object. Set the correct position for these elements and rename the Text element to “Shield”.

2. Create a variable for the Scrollbar UI object, turn off the visibility of the screenbar at startup, and create a method that will update the scrollbar.

3. Update the Damage method in the Player script to make the shield last for 3 hits, after which time the shield and shield bar will be disabled.

Two UI objects and small modifications in 2 scripts were needed to create this functionality.