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="http://cdnjs.cloudflare.com/ajax/libs/phaser/2.2.1/phaser.min.js"></script>
<div id="game_div"> </div>

CSS

#game_div {
      width: 500px;
      height:500px;
      margin: auto;
      margin-top: 50px;
    }

JavaScript

var game = new Phaser.Game(500, 500, Phaser.CANVAS, 'game_div');
var gameStates ={};
var hello;

gameStates.booter = function(){};
gameStates.booter.prototype = {
    preload: function(){
        game.world.setBounds(0,0,500,500)
        game.load.image('hello', 'https://s3.amazonaws.com/uploads-1969f46zwpmbh5cm3kr2/hello.png'); 
    },
    create: function(){        
        
        game.state.start('preloader'); 
    }
}

gameStates.preloader = function(){};
gameStates.preloader.prototype ={
    preload: function(){
        hello = game.add.sprite(150, 150, 'hello');
        game.load.setPreloadSprite(hello);
          alert(game.load.is);
    },
    create: function(){
    }
}

// Add and start the 'main' state to start the game
game.state.add('booter', gameStates.booter);  
game.state.add('preloader',gameStates.preloader);  
game.state.start('booter');