Options
All
  • Public
  • Public/Protected
  • All
Menu

Scene is the main construct for the UI

Hierarchy

  • State
    • Scene

Index

Properties

add

add: GameObjectFactory

A reference to the GameObjectFactory which can be used to add new objects to the World.

cache

cache: Cache

A reference to the game cache which contains any loaded or generated assets, such as images, sound and more.

camera

camera: Camera

A handy reference to World.camera.

game

game: Game

This is a reference to the currently running Game.

input

input: Input

A reference to the Input Manager.

key

key: string

The string based identifier given to the State when added into the State Manager.

load

load: Loader

A reference to the Loader, which you mostly use in the preload method of your state to load external assets.

make

make: GameObjectCreator

A reference to the GameObjectCreator which can be used to make new objects.

particles

particles: Particles

The Particle Manager. It is called during the core gameloop and updates any Particle Emitters it has created.

physics

physics: Physics

A reference to the physics manager which looks after the different physics systems available within Phaser.

rnd

rnd: RandomDataGenerator

A reference to the seeded and repeatable random data generator.

scale

scale: ScaleManager

A reference to the Scale Manager which controls the way the game scales on different displays.

sound

sound: SoundManager

A reference to the Sound Manager which can create, play and stop sounds, as well as adjust global volume.

stage

stage: Stage

A reference to the Stage.

time

time: Time

A reference to the game clock and timed events system.

tweens

tweens: TweenManager

A reference to the tween manager.

world

world: World

A reference to the game world. All objects live in the Game World and its size is not bound by the display resolution.

Accessors

audio

  • Helper function that returns the AudioManager instance

    Returns AudioManager

debugUtilities

  • Helper function that returns the DebugUtilities instance

    Returns DebugUtilities

isActivityFinished

  • get isActivityFinished(): boolean
  • set isActivityFinished(isFinished: boolean): void
  • Helper function for the activity finished state. It should be set to true when the activity is completely done (all question answered correctly, all lives lost, etc.)

    Returns boolean

  • Helper function for the activity finished state. It should be set to true when the activity is completely done (all question answered correctly, all lives lost, etc.)

    Parameters

    • isFinished: boolean

    Returns void

keyboard

  • Helper function that returns the Keyboard instance

    Returns Keyboard

overlayButtons

  • Force the activity to restart

    Returns OverlayButtons

profileRewards

  • Helper function that returns the ProfileRewards instance

    Returns ProfileRewards

progress

  • Helper function that returns the ProgressTracker instance

    Returns ProgressTracker

renderOverride

  • set renderOverride(_callback: Function): void
  • Parameters

    • _callback: Function

    Returns void

reporter

  • Helper function that returns the Reporter instance

    Returns Reporter

settings

  • Helper function that returns the Settings instance

    Returns Settings

Methods

create

  • create(): void
  • Handler called by Phaser. No need to call directly.

    Returns void

exitActivity

  • exitActivity(): void
  • Exit the activity

    Returns void

exitSelected

  • exitSelected(): void
  • Called internally. No need to call directly. Call exitActivity() if you want to exit the activity

    Returns void

getDisplayObjectsByName

  • getDisplayObjectsByName(name: string, group?: DisplayObjectContainer): Array<DisplayObject>
  • Find all display objects whose name property matches the value of the 'name' parameter.

    Parameters

    • name: string

      The value to match the display objects name property

    • Optional group: DisplayObjectContainer

      The group to search (optional). If not set, the game's world will be searched

    Returns Array<DisplayObject>

gotoScene

  • gotoScene(name: string, params?: any): void
  • Goto another scene by destroying this one and creating+displaying the other

    Parameters

    • name: string

      Key/name of scene to go to

    • Optional params: any

      Any additional parameters to be sent to scene 'name' (will be sent to the init function)

    Returns void

helpSelected

  • helpSelected(): void
  • Called internally. No need to call directly

    Returns void

init

  • init(...args: any[]): void
  • init is the very first function called when your State starts up. It's called before preload, create or anything else. If you need to route the game away to another State you could do so here, or if you need to prepare a set of variables or objects before the preloading starts.

    Parameters

    • Rest ...args: any[]

    Returns void

loadRender

  • loadRender(): void
  • loadRender is called during the Loader process. This only happens if you've set one or more assets to load in the preload method. The difference between loadRender and render is that any objects you render in this method you must be sure their assets exist.

    Returns void

loadUpdate

  • loadUpdate(): void
  • loadUpdate is called during the Loader process. This only happens if you've set one or more assets to load in the preload method.

    Returns void

onCloseOverlay

  • onCloseOverlay(): void
  • Called internally. No need to call directly

    Returns void

onCreate

  • onCreate(): void
  • Override to add custom code when scene is being created. Call super first.

    Returns void

onDestroy

  • onDestroy(): void
  • Override to add custom code when scene is being destroyed. Call super first.

    Returns void

onHelp

  • onHelp(): void
  • Override to add custom code when help is selected. Base will play help audio

    Returns void

onOverlayButtonPressed

  • onOverlayButtonPressed(button: string): void
  • Override to add custom code when an overlay button is pressed

    Parameters

    • button: string

      The button pressed ("backward"|"forward"|"home")

    Returns void

onPauseGame

  • onPauseGame(): void
  • Called internally. No need to call directly

    Returns void

onRestartGame

  • onRestartGame(): void
  • Called internally. No need to call directly

    Returns void

onResumeGame

  • onResumeGame(): void
  • Called internally. No need to call directly

    Returns void

onSceneTouched

  • onSceneTouched(): void
  • Override to add custom code when scene is touched. Call super first.

    Returns void

onToggleBackgroundMusic

  • onToggleBackgroundMusic(on: boolean): void
  • Override to add custom code when background music is toggled.

    Parameters

    • on: boolean

    Returns void

pauseUpdate

  • pauseUpdate(): void
  • pauseUpdate is called while the game is paused instead of preUpdate, update and postUpdate.

    Returns void

paused

  • paused(): void
  • This method will be called if the core game loop is paused.

    Returns void

playHelpAudio

  • Play help audio. If no audio is passed in, the default audio will be passed

    Parameters

    • Optional audioInfo: IAudioPlayInfo | Array<IAudioPlayInfo>

      description of audio to play, either IAudioPlayInfo or an array of IAudioPlayInfo

    Returns AudioClipSequence

    AudiClipSequence to play

preRender

  • preRender(): void
  • The preRender method is called after all Game Objects have been updated, but before any rendering takes place.

    Returns void

preload

  • preload(): void
  • preload is called first. Normally you'd use this to load your game assets (or those needed for the current State) You shouldn't create any objects in this method that require assets that you're also loading in this method, as they won't yet be available.

    Returns void

render

  • render(): void
  • Returns void

resize

  • resize(): void
  • If your game is set to Scalemode RESIZE then each time the browser resizes it will call this function, passing in the new width and height.

    Returns void

resumed

  • resumed(): void
  • This method will be called when the core game loop resumes from a paused state.

    Returns void

setDefaultHelpAudio

  • Set default help audio.

    Parameters

    Returns void

shutdown

  • shutdown(): void
  • Handler called by Phaser. No need to call directly.

    Returns void

toggleMusicSelected

  • toggleMusicSelected(): void
  • Called internally. No need to call directly

    Returns void

update

  • update(): void
  • The update method is left empty for your own use. It is called during the core game loop AFTER debug, physics, plugins and the Stage have had their preUpdate methods called. It is called BEFORE Stage, Tweens, Sounds, Input, Physics, Particles and Plugins have had their postUpdate methods called.

    Returns void