new States(canvas, ticker)
Preloads, updates, and cleans up the various game states
Accepts an object of the following schema:
{
// optional property of paths to assets to preload
preload: [
'path/to/assets',
...
],
init: function () {
// initialize entities etc.
},
render: function (factor, ticks) {
// do stuff on every tick
},
destroy: function () {
// remove event listeners
}
}
Parameters:
Name | Type | Description |
---|---|---|
canvas |
Canvas | A Canvas instance |
ticker |
Ticker | A ticker instance |