Skip to content

GameplayAPI

Defined in: packages/threeplay/src/plugins/gameplay/types.ts:100

API of the gameplay plugin: common game-logic components.

health(hp, maxHp?): HealthComp

Defined in: packages/threeplay/src/plugins/gameplay/types.ts:102

Component: hit points, hurt/heal and "hurt"/"heal"/"death" events.

number

number

HealthComp


lifespan(seconds, opts?): LifespanComp

Defined in: packages/threeplay/src/plugins/gameplay/types.ts:106

Destroys the object after seconds (fading out the last fade seconds if it has opacity).

number

number

LifespanComp


offscreen(opts?): OffscreenComp

Defined in: packages/threeplay/src/plugins/gameplay/types.ts:110

Component: detects when the object is far from the camera (or outside its view).

OffscreenOpts

OffscreenComp


state(initial, allowed?): StateComp

Defined in: packages/threeplay/src/plugins/gameplay/types.ts:104

Component: a state machine starting in initial; allowed (optional) restricts the names.

string

string[]

StateComp


timer(): TimerComp

Defined in: packages/threeplay/src/plugins/gameplay/types.ts:108

Component: timers that tick and die with the object.

TimerComp