Components are bits of data and logic that can be added to entities.

Constructor

Properties

read only name :String

The component's name, generated based on its class. Components with the same name replace eachother when added to an entity.

read only next :Component

The owner's next component, for iteration.

read only owner :Entity

The entity this component is attached to, or null.

Methods

View source

dispose () :Void

Removes this component from its owning entity.

View source

onAdded () :Void

Called after this component has been added to an entity.

View source

onRemoved () :Void

Called just before this component has been removed from its entity.

View source

onStart () :Void

Called just before this component's first update after being added. This is the best place to put initialization logic that requires accessing other components/entities, since it waits until the rest of the entity hierarchy is accessible.

Note that onStart may be delayed until the next frame after adding a component, depending on where in the update step it was added.

View source

onStop () :Void

Called just before this component will be removed from its entity, if onStart was previously called.

View source

onUpdate (dt :Float) :Void

Called when this component receives a game update.

Parameters:

dt

The time elapsed since the last frame, in seconds.