Health

How to program a health system so something can take damage!

This page is unfinished, but made accessible because there may be useful content or links in the Notes section.

Health in games is very simple. In Unity, it’s as easy as getting a GameObject’s Health Component, then calling the Function that removes the health.

Outline

We need a variable to hold our health and a function that removes health.

We should send an event whenever we are hit, and also an event when we are dead.

  • Health.cs
    • Variables
      • CurrentHP
      • MaxHP
    • Functions
      • TakeDamage
    • Events
      • Hit
      • Died