Kaplay.Health
Modules
Comp
Values
addHealthComponent
addHealth(context, hp, ~maxHp=?)
handles health related logic and events.
let addHealth: (Kaplay.Context.t, int, ~maxHp: int=?) => Kaplay.Types.comp
Return type
getDead
let getDead: T.t => bool
Parameters
T.t
Return type
bool
getHp
let getHp: T.t => int
Parameters
T.t
Return type
int
getMaxHp
let getMaxHp: T.t => int
Parameters
T.t
Return type
int
onDeath
onDeath(t, unit => unit)
register an event that runs when the hp becomes zero.
let onDeath: (T.t, unit => unit) => unit
Parameters
T.t
unit
unit
Return type
unit
onDeathWithController
onDeath(t, unit => unit)
register an event that runs when the hp becomes zero.
let onDeathWithController: (T.t, unit => unit) => Kaplay.KEventController.t
Parameters
T.t
unit
unit
Return type
onHeal
onHeal(t, deltaHP => unit)
register an event that runs when the hp is increased.
let onHeal: (T.t, int => unit) => unit
Parameters
T.t
int
unit
Return type
unit
onHealWithController
onHeal(t, deltaHP => unit)
register an event that runs when the hp is increased.
let onHealWithController: (T.t, int => unit) => Kaplay.KEventController.t
Parameters
T.t
int
unit
Return type
onHurt
onHurt(t, deltaHP => unit)
register an event that runs when the hp is lowered.
let onHurt: (T.t, int => unit) => unit
Parameters
T.t
int
unit
Return type
unit
onHurtWithController
hurt(t, deltaHP => unit)
register an event that runs when the hp is lowered.
let onHurtWithController: (T.t, int => unit) => Kaplay.KEventController.t
Parameters
T.t
int
unit
Return type
setHp
let setHp: (T.t, int) => unit
Parameters
T.t
int
Return type
unit
setMaxHp
let setMaxHp: (T.t, int) => unit
Parameters
T.t
int
Return type
unit