I'm quite new to Phaser and JavaScript really confused about state management.
Phaser has lots of documentation and info on the net, but everyone seems to be doing it a different way.
An example:
var game = new Phaser.Game(800,600, Phaser.AUTO, 'phaser-demo',
{preload: preload, create: create, update: update, render: render});
function preload(){ ... }
function create() { ... }
function update() { ... }
function render() { ... }
Another:
window.game = new Phaser.Game(800, 600, Phaser.AUTO);
// all other states are in different files
module.exports = {
preload: function(){ ... },
create: function(){ ... },
update: function(){ ... }
};
I would be grateful for a simple overview of properly handling states.
State
class you can use to build your own states. The whole initialization of phaser then boils down to adding states and starting with one. Maybe this tutorial helps. \$\endgroup\$