class

HealthComponent

Module
Game
Header
#include "Gameplay/HealthComponent.h"
Namespace
Mowo

Properties

TypeNameDescription
std::function<void(float damage, MObject* instigator)>onDamaged
std::function<void(MObject* instigator)>onDeath
std::function<void(float amount)>onHealed

Public functions

ReturnsNameDescription
voidSetMaxHealthSet max health; fill also tops current health to the new max.
voidSetHealthclamps to [0, max]; clears/sets dead
floatGetHealth
floatGetMaxHealth
floatGetHealthPercent
boolIsDead
boolIsFullHealth
voidSetInvulnerable
boolIsInvulnerable
floatApplyDamageApply damage; returns the amount actually dealt (0 if dead / invulnerable / non-positive).
floatHealHeal up to max; returns the amount actually restored (0 if dead).
voidReviveback from dead at health (clamped > 0)
voidKill

Function details

SetMaxHealth

C++
void SetMaxHealth(float v, bool fill = true)

Set max health; fill also tops current health to the new max.

SetHealth

C++
void SetHealth(float v)

clamps to [0, max]; clears/sets dead

GetHealth

C++
float GetHealth() const

GetMaxHealth

C++
float GetMaxHealth() const

GetHealthPercent

C++
float GetHealthPercent() const

IsDead

C++
bool IsDead() const

IsFullHealth

C++
bool IsFullHealth() const

SetInvulnerable

C++
void SetInvulnerable(bool v)

IsInvulnerable

C++
bool IsInvulnerable() const

ApplyDamage

C++
float ApplyDamage(float amount, MObject* instigator = nullptr)

Apply damage; returns the amount actually dealt (0 if dead / invulnerable / non-positive). Fires onDamaged, and onDeath once if health reaches 0.

Heal

C++
float Heal(float amount)

Heal up to max; returns the amount actually restored (0 if dead).

Revive

C++
void Revive(float health)

back from dead at health (clamped > 0)

Kill

C++
void Kill(MObject* instigator = nullptr)
Generated from Gameplay/HealthComponent.h via game.json · Nov 5, 2026Version 1.0.0