parent |
string
|
<optional>
|
body
|
A css selector for the element where the game canvas will be appended. |
width |
number
|
<optional>
|
230
|
The width in pixels of the game canvas. If resizable is true, this is the minimum width. |
height |
number
|
<optional>
|
180
|
The height in pixels of the game canvas. If resizable is true, this is the minimum height. |
resizable |
boolean
|
<optional>
|
true
|
Wether or not the game canvas resizes with the browser window. |
zoom |
string
|
number
|
<optional>
|
auto
|
How many times the canvas will be enlarged or downsized by css. Defaults to 'auto', which does the calculation automatically considering the available space in the browser window. |
pixelArt |
boolean
|
<optional>
|
true
|
Wether or not to set `image-rendering: pixelated` on the game canvas. For crisp pixel art. |
overlay |
boolean
|
<optional>
|
false
|
Renders the game canvas at the highest z-index with a fixed css position. |
background |
string
|
<optional>
|
transparent
|
A color with which the canvas is cleared every frame. You can use hex (#FF0000) or html color names (tomato) Defaults to transparent, meaning you see the body background or anything that is behind the game canvas. Available in the scene through `this.engine.background` |
foreground |
string
|
<optional>
|
'#000000'
|
An optional foreground color. Available in the scene through `this.engine.foreground` |
scenes |
Array.<object>
|
<optional>
|
[]
|
An array with scene configuration objects.
Properties
Name |
Type |
Attributes |
Description |
name |
string
|
|
A unique name you can use to reference the instance of the scene in your code. To start the scene for example. |
class |
class
|
|
The class (extending Scene) that will be used to instantiate the scene. |
options |
object
|
<optional>
|
Extra options that will be available in the scene instance init method. |
|
assets |
Array.<object>
|
<optional>
|
|
An array with assets to load at the start of the game.
Properties
Name |
Type |
Attributes |
Description |
name |
string
|
|
A unique name you can use to reference this asset in your code. |
type |
string
|
|
'image' or 'audio' |
src |
string
|
|
The path where the file can be loaded over the network. Can also be a data-uri. |
chunks |
Array.<object>
|
<optional>
|
An array for the parts of an audio sprite.
Properties
Name |
Type |
Description |
start |
number
|
Start time of the sound bite in seconds. |
end |
number
|
End time of the sound bite in seconds. |
|
|
plugins |
Array.<object>
|
<optional>
|
[]
|
An array with plugins.
Properties
Name |
Type |
Attributes |
Description |
name |
string
|
|
A unique name you can use to reference the instance of the plugin in your scene. For example 'sfx' becomes 'this.sfx' in all scenes. |
type |
string
|
|
'global' or 'scene'. A global plugin doesn't need to extend a class and is the same (singleton) instance for all scenes. For the scene plugins a unique instance is created for each scene and it must extend ScenePlugin. |
class |
class
|
|
The class to instantiate the plugin. It doesn't have to extend anything for the moment. |
options |
class
|
<optional>
|
An object that will be passed to the constructor of the plugin. |
|