Health - UQcsse3200/2026-studio-1 GitHub Wiki
Health Documentation
Health UI
The player health system is displayed using a heart-based HUD.
- The player starts with 100 HP.
- 10 hearts are displayed at full health.
- Each full heart represents 10 HP.
- A half heart represents 5 HP.
- The exact health value is shown underneath the hearts as
Health = X. - Empty heart outlines remain visible when health is lost.
Heart States
| Health State | Display |
|---|---|
| High Health | Green hearts |
| Medium Health | Yellow hearts |
| Low Health | Red hearts |
| Lost Health | Empty heart outline |
| Health ending in 5 | Half heart |
The health UI uses the existing CombatStatsComponent as the source of the player's health. The display updates whenever the updateHealth event is triggered.
Health Sound Effects
Sound effects are used to give the player feedback when damage is taken.
- Normal damage sound is played when the player takes regular damage, such as from a normal ghost or hazard.
- Crowned ghost damage sound is played when the player takes the crowned ghost's stronger 25 HP attack.
The sound assets are loaded using the existing ResourceService and are triggered when the player's health decreases.
Sound Assets
| Damage Type | Sound |
|---|---|
| Normal damage | player-hit.ogg |
| Crowned ghost damage | player-hit-crown.ogg |
Death State
The player enters a death state when their health reaches 0 HP.
The death state is handled by a dedicated DeathStateComponent, which works with the existing CombatStatsComponent health system. The component listens for health updates and checks whether the player's health has reached zero.
- The death state is triggered when player health reaches 0.
- Death is only triggered once to prevent repeated death events.
- A
"death"event is triggered so other player components can respond. PlayerActionsresponds to the"death"event and disables player actions after death.- The death state works alongside the existing YOU DIED screen and game-over behaviour.
Death State Flow
| Step | Behaviour |
|---|---|
| 1 | Player takes damage |
| 2 | CombatStatsComponent updates the player's health |
| 3 | The updateHealth event is triggered |
| 4 | DeathStateComponent checks the new health value |
| 5 | If health is 0 or below, the player is marked as dead |
| 6 | A "death" event is triggered |
| 7 | PlayerActions disables player actions after death |
| 8 | The existing death screen displays YOU DIED |
Death Event
The "death" event separates death detection from other player behaviour.
DeathStateComponent detects when the player's health reaches 0 and triggers the "death" event. PlayerActions listens for this event and disables player actions after death.