new Game(width, height, renderer, parent, state, transparent, antialias)
Game constructor
Instantiate a new <code>Phaser.Game</code> object.
Parameters:
| Name | Type | Argument | Default | Description |
|---|---|---|---|---|
width |
number |
<optional> |
800 | The width of your game in game pixels. |
height |
number |
<optional> |
600 | The height of your game in game pixels. |
renderer |
number |
<optional> |
Phaser.AUTO | Which renderer to use (canvas or webgl) |
parent |
HTMLElement |
<optional> |
'' | The Games DOM parent. |
state |
any |
<optional> |
null | Description. |
transparent |
boolean |
<optional> |
false | Use a transparent canvas background or not. |
antialias |
boolean |
<optional> |
true | Anti-alias graphics. |
- Source:
Members
-
add
-
- Default Value:
- null
- Source:
Properties:
Name Type Description addPhaser.GameObjectFactory Reference to the GameObject Factory.
-
antialias
-
- Source:
Properties:
Name Type Description antialiasboolean 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 cachePhaser.Cache Reference to the assets cache.
-
camera
-
- Default Value:
- null
- Source:
Properties:
Name Type Description cameraPhaser.Physics.PhysicsManager A handy reference to world.camera.
-
canvas
-
- Default Value:
- null
- Source:
Properties:
Name Type Description canvasHTMLCanvasElement A handy reference to renderer.view.
-
context
-
- Default Value:
- null
- Source:
Properties:
Name Type Description contextContext A handy reference to renderer.context (only set for CANVAS games)
-
debug
-
- Default Value:
- null
- Source:
Properties:
Name Type Description debugPhaser.Utils.Debug A set of useful debug utilitie.
-
device
-
- Default Value:
- null
- Source:
Properties:
Name Type Description devicePhaser.Device Contains device information and capabilities.
-
height
-
- Source:
Properties:
Name Type Description heightnumber The Game height (in pixels).
-
id
-
- Source:
Properties:
Name Type Description idnumber Phaser Game ID (for when Pixi supports multiple instances).
-
input
-
- Default Value:
- null
- Source:
Properties:
Name Type Description inputPhaser.Input Reference to the input manager
-
isBooted
-
- Default Value:
- false
- Source:
Properties:
Name Type Description isBootedboolean Whether the game engine is booted, aka available.
-
isRunning
-
- Default Value:
- false
- Source:
Properties:
Name Type Description idboolean Is game running or paused?
-
load
-
- Default Value:
- null
- Source:
Properties:
Name Type Description loadPhaser.Loader Reference to the assets loader.
-
math
-
- Default Value:
- null
- Source:
Properties:
Name Type Description mathPhaser.GameMath Reference to the math helper.
-
net
-
- Default Value:
- null
- Source:
Properties:
Name Type Description netPhaser.Net Reference to the network class.
-
parent
-
- Source:
Properties:
Name Type Description parentHTMLElement The Games DOM parent.
-
particles
-
- Default Value:
- null
- Source:
Properties:
Name Type Description particlesPhaser.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 pausedboolean Gets and sets the paused state of the Game.
-
physics
-
- Default Value:
- null
- Source:
Properties:
Name Type Description physicsPhaser.Physics.PhysicsManager Reference to the physics manager.
-
raf
-
- Default Value:
- null
- Source:
Properties:
Name Type Description rafPhaser.RequestAnimationFrame Automatically handles the core game loop via requestAnimationFrame or setTimeout
-
renderer
-
- Default Value:
- null
- Source:
Properties:
Name Type Description renderernumber The Pixi Renderer
-
renderType
-
- Source:
Properties:
Name Type Description renderTypenumber 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 rndPhaser.RandomDataGenerator Instance of repeatable random data generator helper.
-
sound
-
- Default Value:
- null
- Source:
Properties:
Name Type Description soundPhaser.SoundManager Reference to the sound manager.
-
stage
-
- Default Value:
- null
- Source:
Properties:
Name Type Description stagePhaser.Stage Reference to the stage.
-
state
-
- Source:
Properties:
Name Type Description statenumber The StateManager.
-
time
-
- Default Value:
- null
- Source:
Properties:
Name Type Description timePhaser.TimeManager Reference to game clock.
-
transparent
-
- Source:
Properties:
Name Type Description transparentboolean Use a transparent canvas background or not.
-
tweens
-
- Default Value:
- null
- Source:
Properties:
Name Type Description tweensPhaser.TweenManager Reference to the tween manager.
-
width
-
- Source:
Properties:
Name Type Description widthnumber The Game width (in pixels).
-
world
-
- Default Value:
- null
- Source:
Properties:
Name Type Description worldPhaser.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> showDebugHeader()
-
Displays a Phaser version debug header in the console.
- Source:
-
<protected> update(time)
-
The core game loop.
Parameters:
Name Type Description timenumber The current time as provided by RequestAnimationFrame.
- Source: