X-Git-Url: http://git.megabrutal.com/?p=ld40.git;a=blobdiff_plain;f=ld40.js;h=01a65ce0f788eb5b318ca822f083dbbffcac5b34;hp=dffcd503ababccef2f6f680c10315ebcbc47f79e;hb=ec8eeabbaf8576510fcd67a78f56b7d94575e8f9;hpb=238b09df43c9772cd33c469b837edad3c9ca7955

diff --git a/ld40.js b/ld40.js
index dffcd50..01a65ce 100644
--- a/ld40.js
+++ b/ld40.js
@@ -81,6 +81,7 @@
                 this.health = 0;
                 this.healthBar.update(this.love, this.maxHealth, this.health);
                 super.kill();
+                this.game.state.start('GameOver');
             }
 
             loveUp() {
@@ -252,6 +253,13 @@
 
         class GamePlay extends Phaser.State {
 
+            constructor() {
+
+                super();
+                game.state.add('GameOver', GameOver, false);
+
+            }
+
             preload() {
 
                 game.load.image('wall', 'wall.png');
@@ -320,3 +328,23 @@
 
             }
         }
+
+        class GameOver extends Phaser.State {
+
+            create() {
+
+                this.game.add.text(this.game.world.width / 2, 0, "GAME\nOVER", { align: 'center', fill: 'white', font: 'Ubuntu Mono', fontSize: 160, fontWeight: 'bold' }).anchor.setTo(0.5, 0);
+                this.game.add.text(this.game.world.width / 2, this.game.world.height * 0.75, "Stay determined...", { align: 'center', fill: 'white', font: 'Ubuntu Mono', fontSize: 24, fontWeight: 'bold' }).anchor.setTo(0.5, 0);
+
+            }
+
+            update() {
+
+                if (this.game.input.keyboard.isDown(Phaser.Keyboard.SPACEBAR))
+                {
+                    this.game.state.start('GamePlay');
+                }
+
+            }
+
+        }