Health and inflicting damage
At this point in our project, we have implemented much of what we specified in our GDD (Chapter 4, Table 4.1) for our player character and enemies, but an essential system is still missing – health and damage.
In the coming sections, we’ll not only tackle adding health to the player and enemies with a reusable component but also finish the enemy’s attack behavior for inflicting damage on the player. The player can already fire a weapon that shoots a projectile, so we’ll add to the Bullet
object we previously made in Chapter 6, so that it can inflict damage, too.
Health system
We’ll develop a HealthSystem
component to create a reusable component for Player
, enemy, and other objects (e.g., in the environment – think a destructible crate). This health system will track health, take damage and/or heal, and can be added to any object. The remainder of the setup will include creating Interfaces that tie the system...