Class: ScenePlugin

core~ScenePlugin()

Interface class for scene plugins.

Constructor

new ScenePlugin()

Source:

Extends

Members

engine :module:core~Engine

A reference to the main engine.
Type:
Source:

listeners :object

A dictionary of the event callbacks attached to this object.
Type:
  • object
Inherited From:
Source:

name :string

The name you gave this instance of the ScenePlugin in the game config. If you gave the plugin the name `whiskymixer`, it will become available in the scene as property like in `this.whiskymixer`.
Type:
  • string
Source:

scene :module:core~Scene

A reference to the scene where this plugin is active.
Type:
Source:

Methods

emit(type, eopt)

Emits the event of a certain type and executes all callbacks.
Parameters:
Name Type Attributes Description
type string The name of the event it emits.
e object <optional>
An optional object that will be passed to the callbacks first argument.
Inherited From:
Source:

(abstract) init()

Called when the scene starts. No need to call `super.init()`
Source:

off(typeopt, callbackopt)

Removes listeners from this object.
Parameters:
Name Type Attributes Description
type string <optional>
The name of the event to remove callback(s) for. If left empty, it will remove every single callback from this object.
callback function <optional>
The callback to remove. If left empty, it will remove all callbacks for the given type or when the type is empty every single callback on this object.
Inherited From:
Source:

on(type, callback)

Continually listen on this object for an event.
Parameters:
Name Type Description
type string The name of the event.
callback function The function to execute each time the event is emitted.
Inherited From:
Source:

once(type, callback)

Listen on this object for an event, but execute the callback only once.
Parameters:
Name Type Description
type string The name of the event.
callback function The function to execute once.
Inherited From:
Source:

(abstract) postRender(context, time, delta)

Called on each frame if the scene is active. After all children are rendered. No need to call `super.postRender(context, time, delta)`
Parameters:
Name Type Description
context CanvasRenderingContext2D The canvas render context.
time number The total time (in milliesconds) since the start of the game.
delta number The time elapsed (in milliseconds) since the last frame.
Source:

(abstract) shutdown()

Called when the scene is shutdown. Needs to call `super.shutdown()` as well.
Source:

(abstract) update(time, delta)

Called on each frame if the scene is active. Before all children are rendered. No need to call `super.update(time, delta)`
Parameters:
Name Type Description
time number The total time (in milliesconds) since the start of the game.
delta number The time elapsed (in milliseconds) since the last frame.
Source: