Interface

HealthComp

:

The health component.

group Component Types

hurt

(n?: number): void

Decrease HP by n (defaults to 1).

heal

(n?: number): void

Increase HP by n (defaults to 1).

hp

(): number

Current health points.

setHP

(hp: number): void

Set current health points.

maxHP

(): number | null

Max amount of HP.

setMaxHP

(hp: number): void

Set max amount of HP.

onHurt

(action: (amount?: number) => void): KEventController

Register an event that runs when hurt() is called upon the object.

since v2000.1

onHeal

(action: (amount?: number) => void): KEventController

Register an event that runs when heal() is called upon the object.

since v2000.1

onDeath

(action: () => void): KEventController

Register an event that runs when object's HP is equal or below 0.

since v2000.1

kaplay logo

Layer

Miscalenous