Phaser current version test environment
Basic Phaser setup for testing
by shohan4556
HTML
<script src="//cdnjs.cloudflare.com/ajax/libs/phaser/2.1.0/phaser.min.js"></script>
<div id="test"></div>
JavaScript
// Phaser current version test environment
// Bezier interpolation
var game = new Phaser.Game(600, 400, Phaser.AUTO, 'test');
var BasicGame = function(game) {};
BasicGame.Boot = function (game) {};
BasicGame.Boot.prototype =
{
preload: function() {
game.time.advancedTiming = true;
},
create: function() {
var square = this.game.add.graphics();
square.beginFill(0xffffff);
square.drawCircle(0, 0, 20);
square.position.set(0, 380);
var tween = this.game.add.tween(square).to({
x: [300, 580],
y: [20, 380]
}, 2000);
tween.interpolation(function(v, k){
return Phaser.Math.bezierInterpolation(v, k);
});
tween.repeat(Infinity);
tween.start();
},
update: function() {
},
render: function() {
game.debug.text(game.time.fps || '--', 2, 14, "#00ff00");
}
};
game.state.add('Boot', BasicGame.Boot);
game.state.start('Boot');