wobblyhead hg > minor_monsters
diff game/js/wave.js @ 23:2f555a54c332
layout fixes and balancing
| author | ark |
|---|---|
| date | 2026-10-20 12:04 +0200 |
| parents | fe680946164b |
| children |
line wrap: on
line diff
--- a/game/js/wave.js Tue Oct 20 03:08:56 2026 +0200 +++ b/game/js/wave.js Tue Oct 20 12:04:42 2026 +0200 @@ -8,8 +8,9 @@ var cfg = MM.config; // phases: "break" counts down to the next wave, "spawning" releases - // the wave's monsters, "clearing" waits until the wave's monsters are - // gone, "done" follows the last wave. random gives numbers in [0, 1). + // the wave's monsters, "done" follows the last wave. a break starts when + // the last monster of a wave has spawned, so monsters may still be on + // the map. random gives numbers in [0, 1). function Waves(mapIndex, firstWave, random) { var mc = cfg.maps[mapIndex]; this.list = mc.waves; @@ -63,9 +64,8 @@ return b; }; - // advance by dt. spawn(kind) creates a monster; alive is the number of - // monsters on the map. - Waves.prototype.update = function (dt, alive, spawn) { + // advance by dt. spawn(kind) creates a monster. + Waves.prototype.update = function (dt, spawn) { if (this.phase === "break") { this.left -= dt; if (this.left <= 0) this.start(); @@ -77,10 +77,7 @@ spawn(this.take()); this.wait += this.interval; } - if (!this.pending.length) this.phase = "clearing"; - return; - } - if (this.phase === "clearing" && alive === 0) { + if (this.pending.length) return; if (this.next >= this.list.length) { this.phase = "done"; } else {
