new Game(width, height, renderer, parent, state, transparent, antialias)
Game constructor
Instantiate a new <code>Phaser.Game</code> 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:
Members
-
add
-
- Default Value:
- null
- Source:
Properties:
Name Type Description add
Phaser.GameObjectFactory Reference to the GameObject Factory.
-
antialias
-
- Source:
Properties:
Name Type Description antialias
boolean Anti-alias graphics (in WebGL this helps with edges, in Canvas2D it retains pixel-art quality).
-
cache
-
- Default Value:
- null
- Source:
Properties:
Name Type Description cache
Phaser.Cache Reference to the assets cache.
-
camera
-
- Default Value:
- null
- Source:
Properties:
Name Type Description camera
Phaser.Physics.PhysicsManager A handy reference to world.camera.
-
canvas
-
- Default Value:
- null
- Source:
Properties:
Name Type Description canvas
HTMLCanvasElement A handy reference to renderer.view.
-
context
-
- Default Value:
- null
- Source:
Properties:
Name Type Description context
Context A handy reference to renderer.context (only set for CANVAS games)
-
debug
-
- Default Value:
- null
- Source:
Properties:
Name Type Description debug
Phaser.Utils.Debug A set of useful debug utilitie.
-
device
-
- Default Value:
- null
- Source:
Properties:
Name Type Description device
Phaser.Device Contains device information and capabilities.
-
height
-
- Source:
Properties:
Name Type Description height
number The Game height (in pixels).
-
id
-
- Source:
Properties:
Name Type Description id
number Phaser Game ID (for when Pixi supports multiple instances).
-
input
-
- Default Value:
- null
- Source:
Properties:
Name Type Description input
Phaser.Input Reference to the input manager
-
isBooted
-
- Default Value:
- false
- Source:
Properties:
Name Type Description isBooted
boolean Whether the game engine is booted, aka available.
-
isRunning
-
- Default Value:
- false
- Source:
Properties:
Name Type Description id
boolean Is game running or paused?
-
load
-
- Default Value:
- null
- Source:
Properties:
Name Type Description load
Phaser.Loader Reference to the assets loader.
-
math
-
- Default Value:
- null
- Source:
Properties:
Name Type Description math
Phaser.GameMath Reference to the math helper.
-
net
-
- Default Value:
- null
- Source:
Properties:
Name Type Description net
Phaser.Net Reference to the network class.
-
parent
-
- Source:
Properties:
Name Type Description parent
HTMLElement The Games DOM parent.
-
particles
-
- Default Value:
- null
- Source:
Properties:
Name Type Description particles
Phaser.Particles The Particle Manager.
-
paused
-
The paused state of the Game. A paused game doesn't update any of its subsystems. When a game is paused the onPause event is dispatched. When it is resumed the onResume event is dispatched.
- Source:
Properties:
Name Type Description paused
boolean Gets and sets the paused state of the Game.
-
physics
-
- Default Value:
- null
- Source:
Properties:
Name Type Description physics
Phaser.Physics.PhysicsManager Reference to the physics manager.
-
raf
-
- Default Value:
- null
- Source:
Properties:
Name Type Description raf
Phaser.RequestAnimationFrame Automatically handles the core game loop via requestAnimationFrame or setTimeout
-
renderer
-
- Default Value:
- null
- Source:
Properties:
Name Type Description renderer
number The Pixi Renderer
-
renderType
-
- Source:
Properties:
Name Type Description renderType
number The Renderer this Phaser.Game will use. Either Phaser.RENDERER_AUTO, Phaser.RENDERER_CANVAS or Phaser.RENDERER_WEBGL.
-
rnd
-
- Default Value:
- null
- Source:
Properties:
Name Type Description rnd
Phaser.RandomDataGenerator Instance of repeatable random data generator helper.
-
sound
-
- Default Value:
- null
- Source:
Properties:
Name Type Description sound
Phaser.SoundManager Reference to the sound manager.
-
stage
-
- Default Value:
- null
- Source:
Properties:
Name Type Description stage
Phaser.Stage Reference to the stage.
-
state
-
- Source:
Properties:
Name Type Description state
number The StateManager.
-
time
-
- Default Value:
- null
- Source:
Properties:
Name Type Description time
Phaser.TimeManager Reference to game clock.
-
transparent
-
- Source:
Properties:
Name Type Description transparent
boolean Use a transparent canvas background or not.
-
tweens
-
- Default Value:
- null
- Source:
Properties:
Name Type Description tweens
Phaser.TweenManager Reference to the tween manager.
-
width
-
- Source:
Properties:
Name Type Description width
number The Game width (in pixels).
-
world
-
- Default Value:
- null
- Source:
Properties:
Name Type Description world
Phaser.World Reference to the world.
Methods
-
<protected> boot()
-
Initialize engine sub modules and start the game.
- Source:
-
destroy()
-
Nuke the entire game from orbit
- Source:
-
<protected> loadComplete()
-
Called when the load has finished, after preload was run.
- Source:
-
<protected> setUpRenderer()
-
Checks if the device is capable of using the requested renderer and sets it up or an alternative if not.
- Source:
-
<protected> update(time)
-
The core game loop.
Parameters:
Name Type Description time
number The current time as provided by RequestAnimationFrame.
- Source: