JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://rawgit.com/photonstorm/phaser/v2.0.7/build/phaser.js"></script>
<div id='phaser-example'></div>
JavaScript
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example');
var LoadState = function() {};
var PlayState = function() {};
LoadState.prototype = {
preload: function() {
this.load.image('sky', 'assets/sky.png');
},
create: function() {
this.game.state.start('Play')
}
};
PlayState.prototype = {
create: function() {
this.cursors = game.input.keyboard.createCursorKeys();
this.add.image(0, 0, 'sky');
this.add.text(16, 16, 'test');
this.scale.pageAlignHorizontally = true; //centers canvas
this.scale.pageAlignVertically = true;
this.scale.refresh();
},
update: function() {
}
};
game.state.add('Load', LoadState, true );
game.state.add('Play', PlayState);