Easily chain your Phaser game code.

Article by Richard Davey. Posted on 15th Jun 2016.   @phaser_


Webcaetano has created a plugin for Phaser that allows you to make it more chainable.

Here is how you'd normally create a Sprite in Phaser:

var sprite = game.add.sprite(0,0,'phaser-dude');
sprite.x = 100;
sprite.y = 100;
sprite.tint = 0xFF0000;

And the Craft approach:

var sprite = craft.$sprite('phaser-dude')

// phaser vanilla still works
sprite.x = 200;

The plugin is exported in UMD so it works in global variables, ES6, webpack, and browserify.

Read More