From 5945139e487e3b826b34dee5468f201d691c97bf Mon Sep 17 00:00:00 2001 From: Tyrel Souza Date: Wed, 6 Apr 2016 23:52:37 -0400 Subject: [PATCH] more states, objects --- src/game.js | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/game.js b/src/game.js index ef02aae..fe5743e 100644 --- a/src/game.js +++ b/src/game.js @@ -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); } -}; \ No newline at end of file +}); + +game.state.start('play'); \ No newline at end of file