Scene

Module: engine.scene

Game scene. Instance of current scene is at game.scene

Properties

_backgroundColorRgb Object

(No description yet)

_mouseDownTime Number

(No description yet)

_mouseDownX Number

(No description yet)

_mouseDownY Number

(No description yet)

_pausedAnims Array

(No description yet)

_pausedObjects Array

(No description yet)

_pausedTimers Array

(No description yet)

_pausedTweens Array

(No description yet)

_updateOrder Array

(No description yet)

backgroundColor String (Default: null)

Background color of scene.

isMouseDown Boolean (Default: false)

(No description yet)

objects Array

List of objects in scene.

paused Boolean (Default: false)

Is scene paused.

physics Array

List of physics worlds in scene.

stage Container

Main container for scene.

timers Array

List of timers in scene.

tweens Array

List of tweens in scene.

Methods

_exit(sceneName)

(No description yet)

Parameters:

  • sceneName String
_mousedown(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
_mousemove(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
_mouseup(x, y, id, event)

(No description yet)

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
_pause()

(No description yet)

_resume()

(No description yet)

_swipe(dir)

(No description yet)

Parameters:

  • dir String
_update()

(No description yet)

_updateCollision()

(No description yet)

_updateObjects()

(No description yet)

_updatePhysics()

(No description yet)

_updateRenderer()

(No description yet)

_updateScene()

(No description yet)

_updateTimers()

(No description yet)

_updateTweens()

(No description yet)

addObject(object)

Add object to scene, so it's update function get's called every frame.

Parameters:

  • object Object
click(x, y, id, event)

Called, when mouse or touch is released and no swipe is triggered.

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
exit(sceneName) Boolean

Called, before scene is changed.

Parameters:

  • sceneName String

Return true to abort exit.

keydown(key, shift, ctrl, alt) Boolean

Called, when key is pressed.

Parameters:

  • key String
  • shift Boolean
  • ctrl Boolean
  • alt Boolean

return true to prevent default keydown action.

keyup(key)

Called, when key is released.

Parameters:

  • key String
mousedown(x, y, id, event)

Called, when mouse or touch is down.

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
mousemove(x, y, id, event)

Called, when mouse or touch is moved.

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
mouseout(event)

Called, when mouse goes out of canvas.

Parameters:

  • event InputEvent
mouseup(x, y, id, event)

Called, when mouse or touch is released.

Parameters:

  • x Number
  • y Number
  • id Number
  • event InputEvent
onPause()

Called, when scene is paused.

onResize()

Called, when system is resized.

onResume()

Called, when paused scene is resumed.

pause()

Pause scene. All current objects, timers and tweens are saved and restored when pause is resumed. Also physics are not updated when scene is paused.

removeObject(object)

Remove object from scene, so it's update function doesn't get called anymore.

Parameters:

  • object Object
removeTimer(timer, [doCallback])

Remove timer from scene.

Parameters:

  • timer Timer
  • doCallback Boolean (optional)
removeTimers([doCallback])

Remove all timers from scene.

Parameters:

  • doCallback Boolean (optional)
removeTweens()

Remove all tweens from scene.

resume()

Resume paused scene.

swipe(direction)

Callback for swipe.

Parameters:

  • direction String
update()

This is called every frame.

Attributes

backgroundColor String (Default: #000)

Default background color.

swipeDist Number (Default: 100)

Minimum distance to trigger swipe.

swipeTime Number (Default: 500)

Maximum time to trigger swipe (ms).

updateOrder Array (Default: physics,tweens,collision,timers,scene,objects,renderer)

Update order for each frame.