new Game(width, height, renderer, parent, state, transparent, antialias, physicsConfig)
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
Parameters
Name | Type | Argument | Default | Description |
---|---|---|---|---|
width | number | string | <optional> | 800 | The width of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage width of the parent container, or the browser window if no parent is given. |
height | number | string | <optional> | 600 | The height of your game in game pixels. If given as a string the value must be between 0 and 100 and will be used as the percentage height of the parent container, or the browser window if no parent is given. |
renderer | number | <optional> | Phaser.AUTO | Which renderer to use: Phaser.AUTO will auto-detect, Phaser.WEBGL, Phaser.CANVAS or Phaser.HEADLESS (no rendering at all). |
parent | string | HTMLElement | <optional> | '' | The DOM element into which this games canvas will be injected. Either a DOM ID (string) or the element itself. |
state | object | <optional> | null | The default state object. A object consisting of Phaser.State functions (preload, create, update, render) or null. |
transparent | boolean | <optional> | false | Use a transparent canvas background or not. |
antialias | boolean | <optional> | true | Draw all image textures anti-aliased or not. The default is for smooth textures, but disable if your game features pixel art. |
physicsConfig | object | <optional> | null | A physics configuration object to pass to the Physics world on creation. |
- Source code: core/Game.js (Line 25)
Please login to continue.