Remove the first monster
[ld40.git] / ld40.js
diff --git a/ld40.js b/ld40.js
index 5c84a995a30a5ca2e5a4df6f865ac57b969e6bd9..892e1b1d62239d0ec497f90ce9ad7b69bee19f2f 100644 (file)
--- a/ld40.js
+++ b/ld40.js
@@ -21,7 +21,7 @@
         const MONSTER_HEALTH           =     20;
         const MODE_DETERMINATION       =      0;
         const MODE_JUSTICE             =      1;
-        const SPEED_PLAYER             =    150;
+        const SPEED_PLAYER             =     50;
         const SPEED_PROJECTILE         =    500;
 
         window.addEventListener("keydown", function(e) {
@@ -43,7 +43,7 @@
                 this.lasttime_shoot = 0;
                 this.lasttime_mode = 0;
                 this.lasttime_damage = 0;
-                this.speed = 150;
+                this.speed = SPEED_PLAYER;
                 this.switchmode(MODE_DETERMINATION);
                 this.projectiles = game.add.group();
                 this.healthBar = new HealthBar(60, game.world.height - (WALL_BORDERBOTTOM / 2));
             nexttime_determination = Math.random() * WAIT_DETERMINATION;
 
             monsters = game.add.group();
-            monsters.add(new Monster(400, 500));
-            monsters.children.forEach(function(monster) { monster.enablePhysics(); });
-            nexttime_monsterspawn = WAIT_MONSTERSPAWN;
+            nexttime_monsterspawn = WAIT_MONSTERSPAWN / 4;
 
             player = new Player(game.world.width / 2, game.world.height / 2);
             player.enablePhysics();
                 var monster = new Monster(Math.random() * game.world.width, Math.random() * game.world.height);
                 monster.enablePhysics();
                 monsters.add(monster);
-                nexttime_monsterspawn = game.time.now + (WAIT_MONSTERSPAWN / player.love) + (Math.random() * WAIT_MONSTERSPAWN);
+                var waittime = WAIT_MONSTERSPAWN - ((Math.random() * 2000) * player.love);
+                nexttime_monsterspawn = game.time.now + waittime;
+                console.log('Next monster in ' + waittime);
             }
 
             if ((game.time.now - player.lastmovetime) > WAIT_KEY) player.body.velocity.x = player.body.velocity.y = 0;