comparison game/js/game.js @ 15:c1c7e4f54bf6

balance work prep
author ark
date 2026-10-19 23:36 +0200
parents 7fda634d15ad
children
comparison
equal deleted inserted replaced
14:7fda634d15ad 15:c1c7e4f54bf6
197 197
198 // build the shop tower at the preview. returns false when there is no 198 // build the shop tower at the preview. returns false when there is no
199 // preview or the tower cannot be afforded. 199 // preview or the tower cannot be afforded.
200 Game.prototype.build = function () { 200 Game.prototype.build = function () {
201 if (!this.shop || !this.preview) return false; 201 if (!this.shop || !this.preview) return false;
202 var cost = cfg.tower[this.shop].cost; 202 var cost = cfg.tower[this.shop].cost[0];
203 if (!this.canAfford(cost)) return false; 203 if (!this.canAfford(cost)) return false;
204 this.pay(cost); 204 this.pay(cost);
205 var pv = this.preview; 205 var pv = this.preview;
206 var t = MM.tower.create(this.shop, pv.x, pv.y, pv.sides); 206 var t = MM.tower.create(this.shop, pv.x, pv.y, pv.sides);
207 t.paid += cost; 207 t.paid += cost;