Class Stage

a default "Stage" object. every "stage" object (title screen, credits, ingame, etc...) to be managed through the state manager must inherit from this base class.

See

state

Constructors

constructor

  • new Stage(settings?): Stage
  • Parameters

    • Optionalsettings: {
      cameras: undefined | Camera2d [];
      onDestroyEvent: undefined | Function;
      onResetEvent: undefined | Function;
      }

      The stage` parameters

      • cameras: undefined | Camera2d []

        a list of cameras (experimental)

      • onDestroyEvent: undefined | Function

        called by the state manager before switching to another state

      • onResetEvent: undefined | Function

        called by the state manager when reseting the object

    Returns Stage

Properties

ambientLight

ambientLight: Color

an ambient light that will be added to the stage rendering

Name

ambientLight

Memberof

Stage

Default

"#000000"

See

Light2d

cameras

cameras: Map<Camera2d , any>

The list of active cameras in this stage. Cameras will be renderered based on this order defined in this list. Only the "default" camera will be resized when the window or canvas is resized.

Name

cameras

Memberof

Stage

lights

lights: Map<Light2d, any>

The list of active lights in this stage. (Note: Canvas Renderering mode will only properly support one light per stage)

Name

lights

Memberof

Stage

See

  • Light2d
  • Stage.ambientLight

Example

// create a white spot light
letwhiteLight = newme.Light2d(0, 0, 140, "#fff", 0.7);
// and add the light to this current stage
this.lights.set("whiteLight", whiteLight);
// set a dark ambient light
this.ambientLight.parseCSS("#1117");
// make the light follow the mouse
me.input.registerPointerEvent("pointermove", me.game.viewport, (event) => {
whiteLight.centerOn(event.gameX, event.gameY);
});

settings

settings: object

The given constructor options

Name

settings

Memberof

Stage

Methods

onDestroyEvent

  • onDestroyEvent(...args): void
  • onDestroyEvent function
    called by the state manager before switching to another state

    Parameters

    • Rest...args: any

    Returns void

    Name

    onDestroyEvent

    Memberof

    Stage

onResetEvent

  • onResetEvent(...args): void
  • onResetEvent function
    called by the state manager when reseting the object this is typically where you will load a level, add renderables, etc...

    Parameters

    • Rest...args: any

      optional arguments passed when switching state

    Returns void

    Name

    onResetEvent

    Memberof

    Stage

    See

    state#change

Settings

Member Visibility

On This Page

AltStyle によって変換されたページ (->オリジナル) /