Easily chain your Phaser game code.

Posted on 15th Jun 2016. Follow @phaser_ and get the Phaser World newsletter.


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

Learn to code and lead your intrepid crew on a mission to save The Cloud in TwilioQuest, a PC role-playing game inspired by classics of the 16-bit era. Free forever, and available now for Windows, Mac, and Linux.

The first book on the creation of HTML5 cross platform games using Phaser 3 and other free software.
  • By Emanuele Feronato
  • 155 Pages
  • 28 Source Code Examples
  • Build a complete game from start to finish
  • Cross Platform
  • Scaling for devices
Buy Now