diff game/js/game.js @ 27:75deda08db90 0.9.1

game debug functions separated into own file; release build option, distribution script
author ark
date 2026-10-20 17:19 +0200
parents 3f2811aebb3d
children 85d23328a215
line wrap: on
line diff
--- a/game/js/game.js	Tue Oct 20 16:06:50 2026 +0200
+++ b/game/js/game.js	Tue Oct 20 17:19:40 2026 +0200
@@ -7,7 +7,6 @@
     "use strict";
 
     var cfg = MM.config;
-    var dbg = cfg.debug;
 
     // firstWave counts from 1
     function Game(mapIndex, seed, firstWave) {
@@ -15,7 +14,7 @@
         this.map = new MM.GameMap(mapIndex);
         this.seed = seed;
         this.random = MM.util.rng(seed);
-        this.coins = dbg.start_coins >= 0 ? dbg.start_coins : mc.starting_coins;
+        this.coins = mc.starting_coins;
         this.hearts = cfg.hearts.per_map;
         this.monsters = [];
         this.towers = [];
@@ -27,7 +26,7 @@
                                   this.random);
         this.time = 0;
         this.paused = false;
-        this.speeds = cfg.controls.speeds.concat(dbg.extra_speeds);
+        this.speeds = cfg.controls.speeds;
         this.speedIndex = 0;
         this.result = null;     // "won" or "lost"
         this.splash = false;    // splash screen shown over the paused map
@@ -74,11 +73,11 @@
     };
 
     Game.prototype.canAfford = function (cost) {
-        return dbg.unlimited_coins || this.coins >= cost;
+        return this.coins >= cost;
     };
 
     Game.prototype.pay = function (cost) {
-        if (!dbg.unlimited_coins) this.coins -= cost;
+        this.coins -= cost;
     };
 
     // one simulation step of dt seconds
@@ -127,9 +126,7 @@
     Game.prototype.escape = function (m) {
         m.alive = false;
         MM.audio.play(m.boss ? "boss_exit" : "monster_exit");
-        if (!dbg.no_heart_loss) {
-            this.hearts = Math.max(0, this.hearts - (m.boss ? cfg.hearts.boss : cfg.hearts.monster));
-        }
+        this.hearts = Math.max(0, this.hearts - (m.boss ? cfg.hearts.boss : cfg.hearts.monster));
     };
 
     // a freeze splash of radius r at x, y: slows every monster whose hit