more states, objects

This commit is contained in:
Tyrel Souza 2016-04-06 23:52:37 -04:00
parent 2783c8c294
commit 5945139e48

View File

@ -1,23 +1,22 @@
window.onload = function() {
var game = new Phaser.Game(
800,
800,
Phaser.AUTO,
'',
{ preload: preload, create: create });
var game = new Phaser.Game(800, 600, Phaser.AUTO, '');
function preload(){
game.state.add('play', {
preload: function(){
game.load.image('pink', 'assets/pink.png');
game.load.image('green', 'assets/green.png');
game.load.image('grey', 'assets/grey.png');
game.load.image('blue', 'assets/blue.png');
console.log("preload");
}
function create(){
},
create: function(){
var alienSprite = game.add.sprite(450, 290, 'pink');
console.log(alienSprite);
alienSprite.anchor.setTo(0.5, 0.5);
},
render: function(){
game.debug.text('Adventure Awaits!', 250, 40);
}
};
});
game.state.start('play');