Gets or sets the current camera for the scene
Access to the Excalibur engine
Direct access to the game object event dispatcher.
The Excalibur physics world for the scene. Used to interact with colliders included in the scene.
Can be used to perform scene ray casts, track colliders, broadphase, and narrowphase.
The ECS world for the scene
Gets whether or not the Scene has been initialized
Internal
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Activates the scene with the base behavior, then calls the overridable onActivate
implementation.
Internal
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Deactivates the scene with the base behavior, then calls the overridable onDeactivate
implementation.
Internal
It is not recommended that internal excalibur methods be overridden, do so at your own risk.
Internal _postdraw handler for onPostDraw 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 _predraw handler for onPreDraw 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
Adds a Trigger to the Scene, once this is done the Trigger will listen for interactions with other actors.
Adds an actor to the scene, once this is done the Actor will be drawn and updated.
The actor to add to the current scene
Adds a ScreenElement to the scene.
The ScreenElement to add to the current scene
Draws all the actors' debug information in the Scene. Called by the Engine.
The current rendering context
Draws all the actors in the Scene. Called by the Engine.
The current rendering context
The number of milliseconds since the last draw
Alias for removeEventListener
. If only the eventName is specified
it will remove all handlers registered for that specific event. If the eventName
and the handler instance are specified only that handler will be removed.
Name of the event to listen for
Optional
handler: ((event: Events.InitializeEvent<Scene<unknown>>) => void)Event handler for the thrown event
Optional
handler: ((event: Events.ActivateEvent<undefined>) => void)Optional
handler: ((event: Events.DeactivateEvent) => void)Optional
handler: ((event: Events.PreUpdateEvent<Scene<unknown>>) => void)Optional
handler: ((event: Events.PostUpdateEvent<Scene<unknown>>) => void)Optional
handler: ((event: Events.PreDrawEvent) => void)Optional
handler: ((event: Events.PostDrawEvent) => void)Optional
handler: ((event: Events.PreDebugDrawEvent) => void)Optional
handler: ((event: Events.PostDebugDrawEvent) => void)Event signatures
Event signatures
This is called when the scene is made active and started. It is meant to be overridden, this is where you should setup any DOM UI or event handlers needed for the scene.
This is called when the scene is made transitioned away from and stopped. It is meant to be overridden, this is where you should cleanup any DOM UI or event handlers needed for the scene.
Safe to override onPostDraw lifecycle event handler. Synonymous with .on('preupdate', (evt) =>{...})
onPostDraw
is called directly after a scene is drawn.
Safe to override onPreDraw lifecycle event handler. Synonymous with .on('preupdate', (evt) =>{...})
onPreDraw
is called directly before a scene is drawn.
Once listens to an event one time, then 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 Timer from the current scene, it will no longer be updated.
The timer to remove to the current scene.
Removes a TileMap from the scene, it will no longer be drawn or updated.
{TileMap}
Removes an actor from the scene, it will no longer be drawn or updated.
The actor to remove from the current scene.
Removes a ScreenElement to the scene, it will no longer be drawn or updated
The ScreenElement to remove from the current scene
Actors are composed together into groupings called Scenes in Excalibur. The metaphor models the same idea behind real world actors in a scene. Only actors in scenes will be updated and drawn.
Typical usages of a scene include: levels, menus, loading screens, etc.