Optional
config: ActorArgsProtected
_engineWhether this entity is active, if set to false it will be reclaimed
Observable that keeps track of component add or remove changes on the entity
Listen to or emit events for an entity
The unique identifier for the entity
Convenience reference to the global logger
The scene that the entity is in, if any
Static
defaultsSet defaults for all Actors
Gets the acceleration vector of the actor in pixels/second/second. An acceleration pointing down such as (0, 100) may be useful to simulate a gravitational effect.
Sets the acceleration vector of teh actor in pixels/second/second
Useful for quickly scripting actor behavior, like moving to a place, patrolling back and forth, blinking, etc.
Access to the Actor's built in [[ActionsComponent]] which forwards to the [[ActionContext|Action context]] of the actor.
Gets the rotational velocity of the actor in radians/second
Sets the rotational velocity of the actor in radians/sec
The physics body the is associated with this actor. The body is the container for all physical properties, like position, velocity, acceleration, mass, inertia, etc.
Access to the Actor's built in [[ColliderComponent]]
Access to the Actor's built in [[GraphicsComponent]]
Gets whether the actor is Initialized
Indicates whether the actor is physically in the viewport
Access the Actor's built in [[MotionComponent]]
Gets the acceleration of the actor from the last frame. This does not include the global acc [[Physics.acc]].
Sets the acceleration of the actor from the last frame. This does not include the global acc [[Physics.acc]].
Access to the Actor's built in [[PointerComponent]] config
Gets the rotation of the actor in radians. 1 radian = 180/PI Degrees.
Sets the rotation of the actor in radians. 1 radian = 180/PI Degrees.
Specifically get the tags on the entity from [[TagComponent]]
Access the Actor's built in [[TransformComponent]]
The types of the components on the Entity
Gets the z-index of an actor. The z-index determines the relative order an actor is drawn in. Actors with a higher z-index are drawn on top of actors with a lower z-index
Sets the z-index of an actor and updates it in the drawing list for the scene. The z-index determines the relative order an actor is drawn in. Actors with a higher z-index are drawn on top of actors with a lower z-index
new z-index to assign
Internal
Initializes this actor and all it's child actors, meant to be called by the Scene before first update not by users of Excalibur.
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Internal
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Internal _prekill handler for [[onPostKill]] lifecycle event
Internal
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Internal _preupdate handler for [[onPostUpdate]] lifecycle event
Internal
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Internal _prekill handler for [[onPreKill]] lifecycle event
Internal
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Internal _preupdate handler for [[onPreUpdate]] lifecycle event
Protected
_setTests whether the x/y specified are contained in the actor
X coordinate to test (in world coordinates)
Y coordinate to test (in world coordinates)
checks whether the x/y are contained in any child actors (if they exist).
Emits an event for target
The name of the event to publish
Optionally pass an event data object to the handler
Optional
event: anyGet a component by type with typecheck
(Does not work on tag components, use .hasTag("mytag") instead)
Check if a component type exists
Unsubscribe an event handler(s) from an event. If a specific handler is specified for an event, only that handler will be unsubscribed. Otherwise all handlers will be unsubscribed for that event.
The name of the event to unsubscribe
Optionally the specific handler to unsubscribe
Subscribe an event handler to a particular event name, multiple handlers per event name are allowed.
The name of the event to subscribe to
The handler callback to fire on this event
Event signatures
onInitialize
is called before the first update of the actor. This method is meant to be
overridden. This is where initialization of child actors should take place.
Synonymous with the event handler .on('initialize', (evt) => {...})
Safe to override onPostKill lifecycle event handler. Synonymous with .on('postkill', (evt) => {...})
onPostKill
is called directly after an actor is killed and remove from its current [[Scene]].
Safe to override onPostUpdate lifecycle event handler. Synonymous with .on('postupdate', (evt) =>{...})
onPostUpdate
is called directly after an actor is updated.
Safe to override onPreKill lifecycle event handler. Synonymous with .on('prekill', (evt) =>{...})
onPreKill
is called directly before an actor is killed and removed from its current [[Scene]].
Safe to override onPreUpdate lifecycle event handler. Synonymous with .on('preupdate', (evt) =>{...})
onPreUpdate
is called directly before an actor is updated.
Once listens to an event once then auto unsubscribes from that event
The name of the event to subscribe to once
The handler of the event that will be auto unsubscribed
Removes a component from the entity, by default removals are deferred to the end of entity update to avoid consistency issues
Components can be force removed with the force
flag, the removal is not deferred and happens immediately
Internal
Called by the Engine, updates the state of the actor
The reference to the current game engine
The time elapsed since the last update in milliseconds
Returns true if the two actor.collider's surfaces are less than or equal to the distance specified from each other
Actor to test
Distance in pixels to test
Helper [[Actor]] primitive for drawing UI's, optimized for UI drawing. Does not participate in collisions. Drawn on top of all other actors.