Phase 1 — Shield Strength

Nicholas Lim
Jun 8, 2021

--

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.

The Alpha value being changed, under the Sprite Renderer’s Color settings

In the Player script, provide a reference to the shield’s Sprite Renderer.

Player script

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.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

--

--

No responses yet

Write a response