Hello World Phaser Example
Kudos Thomas Palef: http://www.lessmilk.com/
http://blog.lessmilk.com/how-to-make-flappy-bird-in-html5-1/
HTML
<script src="https://rawgit.com/photonstorm/phaser-ce/master/build/phaser.min.js"></script>
<div id="game_div"> </div>
CSS
/* #game_div {
width: 400px;
} */
JavaScript
var width = document.documentElement.clientWidth;
var height = document.documentElement.clientHeight;
var game = new Phaser.Game(Math.floor(width/4), Math.floor(height/4), Phaser.CANVAS, null, { preload: preload, create: create
});
WebFontConfig = {
active: function() { game.time.events.add(Phaser.Timer.SECOND, createText, this); },
google: {
families: ['VT323']//other fonts tried: 'Revalia'
}
};
function preload() {
// Load the Google WebFont Loader script
game.load.script('webfont', '//ajax.googleapis.com/ajax/libs/webfont/1.4.7/webfont.js');
Phaser.Canvas.setImageRenderingCrisp(this.game.canvas);
game.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL;
// this.game.renderer.renderSession.roundPixels = true;
}
var text = null;
function create() {
game.stage.setBackgroundColor(0xFFFFFF);
//game.stage.smoothed = false;
}
function createText() {
text = game.add.text(0, 0, "- phaser -\nrocking with\ngoogle web fonts");
text.font = 'VT323';
text.fontSize = 12;
}