Updated code to work properly with Phaser 1.1.