This page is work-in-progress. You can reach me on twitter or mail to rezoner1337@gmail.com

States

Use Q W E to switch states

States are easy way to split application in smaller logical divisions like:

Intro, Menu, Game, Options, Credits, Loading screen.

Create a namespace to hold states

var ENGINE = {};

Create a state

ENGINE.Game = {

  create: function() {

    /* this is called when the state is entered for the very first time */

  },

  step: function(delta) {

  },

  render: function(delta) {

    this.app.layer.clear("#008");

  }

};

Select application state

app = playground({

  ready: function() {

    this.setState(ENGINE.Game);

  }

});

Ask question:

Fork me on GitHub