Class: Game

Game

This is where the magic happens. The Game object is the heart of your game, providing quick access to common functions and handling the boot process.

"Hell, there are no rules here - we're trying to accomplish something."


Thomas A. Edison

new Game(width, height, renderer, parent, state, transparent, antialias)

Game constructor Instantiate a new Phaser.Game object.
Parameters:
Name Type Description
width number The width of your game in game pixels.
height number The height of your game in game pixels.
renderer number Which renderer to use (canvas or webgl)
parent HTMLElement The Games DOM parent.
state Description Description.
transparent boolean Use a transparent canvas background or not.
antialias boolean Anti-alias graphics.
Source:
  • core/Game.js, line 26

Members

add

Properties:
Name Type Description
add Phaser.GameObjectFactory Reference to the GameObject Factory.
Default Value:
  • null
Source:
  • core/Game.js, line 120

antialias

Properties:
Name Type Description
antialias boolean Anti-alias graphics (in WebGL this helps with edges, in Canvas2D it retains pixel-art quality).
Source:
  • core/Game.js, line 66

cache

Properties:
Name Type Description
cache Phaser.Cache Reference to the assets cache.
Default Value:
  • null
Source:
  • core/Game.js, line 126

camera

Properties:
Name Type Description
camera Phaser.Physics.PhysicsManager A handy reference to world.camera.
Default Value:
  • null
Source:
  • core/Game.js, line 204

canvas

Properties:
Name Type Description
canvas HTMLCanvasElement A handy reference to renderer.view.
Default Value:
  • null
Source:
  • core/Game.js, line 210

context

Properties:
Name Type Description
context Context A handy reference to renderer.context (only set for CANVAS games)
Default Value:
  • null
Source:
  • core/Game.js, line 216

debug

Properties:
Name Type Description
debug Phaser.Utils.Debug A set of useful debug utilitie.
Default Value:
  • null
Source:
  • core/Game.js, line 222

device

Properties:
Name Type Description
device Phaser.Device Contains device information and capabilities.
Default Value:
  • null
Source:
  • core/Game.js, line 198

height

Properties:
Name Type Description
height number The Game height (in pixels).
Source:
  • core/Game.js, line 56

id

Properties:
Name Type Description
id number Phaser Game ID (for when Pixi supports multiple instances).
Source:
  • core/Game.js, line 39

input

Properties:
Name Type Description
input Phaser.Input Reference to the input manager
Default Value:
  • null
Source:
  • core/Game.js, line 132

isBooted

Properties:
Name Type Description
isBooted boolean Whether the game engine is booted, aka available.
Default Value:
  • false
Source:
  • core/Game.js, line 102

isRunning

Properties:
Name Type Description
id boolean Is game running or paused?
Default Value:
  • false
Source:
  • core/Game.js, line 108

load

Properties:
Name Type Description
load Phaser.Loader Reference to the assets loader.
Default Value:
  • null
Source:
  • core/Game.js, line 138

math

Properties:
Name Type Description
math Phaser.GameMath Reference to the math helper.
Default Value:
  • null
Source:
  • core/Game.js, line 144

net

Properties:
Name Type Description
net Phaser.Net Reference to the network class.
Default Value:
  • null
Source:
  • core/Game.js, line 150

parent

Properties:
Name Type Description
parent HTMLElement The Games DOM parent.
Source:
  • core/Game.js, line 44

particles

Properties:
Name Type Description
particles Phaser.Particles The Particle Manager.
Default Value:
  • null
Source:
  • core/Game.js, line 228

physics

Properties:
Name Type Description
physics Phaser.Physics.PhysicsManager Reference to the physics manager.
Default Value:
  • null
Source:
  • core/Game.js, line 186

raf

Properties:
Name Type Description
raf Phaser.RequestAnimationFrame Automatically handles the core game loop via requestAnimationFrame or setTimeout
Default Value:
  • null
Source:
  • core/Game.js, line 114

renderer

Properties:
Name Type Description
renderer number The Pixi Renderer
Default Value:
  • null
Source:
  • core/Game.js, line 72

renderType

Properties:
Name Type Description
renderType number The Renderer this Phaser.Game will use. Either Phaser.RENDERER_AUTO, Phaser.RENDERER_CANVAS or Phaser.RENDERER_WEBGL.
Source:
  • core/Game.js, line 89

rnd

Properties:
Name Type Description
rnd Phaser.RandomDataGenerator Instance of repeatable random data generator helper.
Default Value:
  • null
Source:
  • core/Game.js, line 192

sound

Properties:
Name Type Description
sound Phaser.SoundManager Reference to the sound manager.
Default Value:
  • null
Source:
  • core/Game.js, line 156

stage

Properties:
Name Type Description
stage Phaser.Stage Reference to the stage.
Default Value:
  • null
Source:
  • core/Game.js, line 162

state

Properties:
Name Type Description
state number The StateManager.
Source:
  • core/Game.js, line 77

time

Properties:
Name Type Description
time Phaser.TimeManager Reference to game clock.
Default Value:
  • null
Source:
  • core/Game.js, line 168

transparent

Properties:
Name Type Description
transparent boolean Use a transparent canvas background or not.
Source:
  • core/Game.js, line 61

tweens

Properties:
Name Type Description
tweens Phaser.TweenManager Reference to the tween manager.
Default Value:
  • null
Source:
  • core/Game.js, line 174

width

Properties:
Name Type Description
width number The Game width (in pixels).
Source:
  • core/Game.js, line 51

world

Properties:
Name Type Description
world Phaser.World Reference to the world.
Default Value:
  • null
Source:
  • core/Game.js, line 180