Creates a new Actor instance.
Configuration options for the actor
ReadonlychildrenChildren of the entity
ReadonlyidId of the entity
ReadonlynameName of the entity
Parent of the entity
Optional ReadonlytemplateThe template id of the actor
Adds an event listener to the event target.
Type of event to listen for
Function to call when the event is triggered
Dispatches an event to the event target.
Events are processed in the engine event queue at the beginning of each frame in the order they were dispatched.
Type of event to dispatch
Payload of the event
Advanced
Dispatches an event to the event target immediately.
Events are processed immediately and not added to the engine event queue.
Type of event to dispatch
Payload of the event
Finds a child entity by a predicate function.
A function that runs on each child entity and should return true if the child entity matches the predicate or false otherwise
Whether to search recursively through the children
Child entity or undefined
Finds a child entity by its id.
Id of the child entity
Whether to search recursively through the children
Child entity or undefined
Finds a child entity by its name.
Name of the child entity
Whether to search recursively through the children
Child entity or undefined
Gets a specific component from this actor.
The component class or component name string
The component instance, or undefined if not found
Advanced
Gets the event listeners for the event target.
Type of event to get the listeners for
Event listeners for the event target
Removes the entity from its parent.
Advanced
Removes all event listeners from the event target.
Removes a component from this actor.
The component class to remove
Removes an event listener from the event target.
Type of event to remove the listener for
Function to remove the listener for
Attaches a component to this actor.
The component to attach
An Actor is the main entity type in the game engine.
Actors are entities that can have components attached to them and represent various game objects such as players, enemies, items, decorations, etc. They support hierarchical relationships and can be organized in parent-child structures.