Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Scene

A scene contains all the game objects in a specific "screen" of your game.
For example, you may have a "MainScreen" scene that will contain everything that is in the main screen of your game.
You could then have a "Level1" scene that will contain the level 1 of you game. etc.

Hierarchy

Implements

Index

Constructors

constructor

Methods

_runRender

  • _runRender(context: CanvasRenderingContext2D): void
  • Used internally by the renderer to render the scene.

    Parameters

    • context: CanvasRenderingContext2D

      The renderer's context, automatically passed in.

    Returns void

_runUpdate

  • _runUpdate(): void

create

  • create(): void
  • Called when the scene is created.
    You can set your game objects (UI, characters, music, etc) from here.

    Returns void

get

  • Get an value from the map.

    Parameters

    • key: string

      The name of the value to get.

    Returns GameObject | null

    The value, or null if the value does not exist in the map.

getAll

remove

  • remove(key: string): boolean
  • Remove an value from the map.

    Parameters

    • key: string

      The value's name to be removed from the map.

    Returns boolean

    True if the value was removed, false if the value was not found.

removeAll

  • removeAll(): void
  • Clear the map by removing all the keys and values that it stores.

    Returns void

set

  • Add or update an value.

    Parameters

    • key: string

      The name of the value to set.

    • value: GameObject

      The value to set for this value.

    Returns void

update

  • update(): void
  • Run every frame to update the scene.
    This is useful when you want an update to run as long as your scene is being rendered, independently from the game objects it contains.

    Returns void

Generated using TypeDoc