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

balance work prep
author ark
date 2026-10-19 23:36 +0200
parents 8df95050fc8b
children
comparison
equal deleted inserted replaced
14:7fda634d15ad 15:c1c7e4f54bf6
271 var def = cfg.tower[b.tower]; 271 var def = cfg.tower[b.tower];
272 // the chosen item's bubble switches between its two drawings 272 // the chosen item's bubble switches between its two drawings
273 var bubble = game.shop !== b.tower ? "shop_bubble" 273 var bubble = game.shop !== b.tower ? "shop_bubble"
274 : Math.floor(view.now / BUBBLE_FLIP) % 2 ? "shop_bubble_dark2" : "shop_bubble_dark"; 274 : Math.floor(view.now / BUBBLE_FLIP) % 2 ? "shop_bubble_dark2" : "shop_bubble_dark";
275 ctx.drawImage(A.img(bubble), b.x, b.y, b.w, b.h); 275 ctx.drawImage(A.img(bubble), b.x, b.y, b.w, b.h);
276 ctx.globalAlpha = game.canAfford(def.cost) && !game.paused ? 1 : 0.35; 276 ctx.globalAlpha = game.canAfford(def.cost[0]) && !game.paused ? 1 : 0.35;
277 fit(ctx, b.tower, cx, b.y + 28, 44, 38); 277 fit(ctx, b.tower, cx, b.y + 28, 44, 38);
278 price(ctx, def.cost, cx, b.y + b.h - 15); 278 price(ctx, def.cost[0], cx, b.y + b.h - 15);
279 ctx.globalAlpha = 1; 279 ctx.globalAlpha = 1;
280 } else if (b.id === "upgrade") { 280 } else if (b.id === "upgrade") {
281 var cost = MM.tower.upgradeCost(game.selected); 281 var cost = MM.tower.upgradeCost(game.selected);
282 ctx.globalAlpha = game.canAfford(cost) ? 1 : 0.35; 282 ctx.globalAlpha = game.canAfford(cost) ? 1 : 0.35;
283 fit(ctx, "upgrade_button", b.cx, b.bubble.y + b.bubble.h * 0.4, 46, 44); 283 fit(ctx, "upgrade_button", b.cx, b.bubble.y + b.bubble.h * 0.4, 46, 44);