Phaser current version test environment

Basic Phaser setup for testing

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/phaser/2.2.2/phaser.min.js"></script>
<div id="test"></div>

JavaScript

var game = new Phaser.Game(600, 400, Phaser.AUTO, 'test', null, false, false);
var BasicGame = function (game) {};
BasicGame.Boot = function (game) {};

BasicGame.Boot.prototype = {
    preload: function () {
        this.load.image('sprite', '../../img/logo.png');
    },
    
    create: function () {
        this.lastTime = this.game.time.now;
        this.sprite = game.add.sprite(200, 50, 'sprite');
        this.sprite.anchor.setTo(0.5, 0.5);
        
        this.left = true;
    },
    
    update: function() {
        var dt = this.game.time.now - this.lastTime;
        this.lastTime = this.game.time.now;
        
        var scale = this.sprite.scale.x;
        if (this.left && scale != 1) {
            this.sprite.scale.x = Math.min(1, scale + dt*0.001);
        } else if (!this.left && scale != -1) {
            this.sprite.scale.x = Math.max(-1, scale - dt*0.001);
        } else {
            this.left = !this.left;
        }
    }
};

game.state.add('Boot', BasicGame.Boot);
game.state.start('Boot');