wobblyhead hg > minor_monsters
comparison game/js/ui.js @ 13:8df95050fc8b
no more build during pause; tower popup closes on any click outside it
| author | ark |
|---|---|
| date | 2026-10-19 21:59 +0200 |
| parents | a77857594150 |
| children | c1c7e4f54bf6 |
comparison
equal
deleted
inserted
replaced
| 12:dc314bfbb1cf | 13:8df95050fc8b |
|---|---|
| 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) ? 1 : 0.35; | 276 ctx.globalAlpha = game.canAfford(def.cost) && !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, 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); |
| 293 ctx.shadowColor = "rgba(220, 30, 20, 0.9)"; | 293 ctx.shadowColor = "rgba(220, 30, 20, 0.9)"; |
| 294 ctx.shadowBlur = 14; | 294 ctx.shadowBlur = 14; |
| 295 } | 295 } |
| 296 fit(ctx, "sell_button", b.cx, b.bubble.y + b.bubble.h * 0.4, 46 * k, 44 * k); | 296 fit(ctx, "sell_button", b.cx, b.bubble.y + b.bubble.h * 0.4, 46 * k, 44 * k); |
| 297 ctx.restore(); | 297 ctx.restore(); |
| 298 price(ctx, MM.tower.refund(game.selected, game.pauseNumber()), b.cx, | 298 price(ctx, MM.tower.refund(game.selected), b.cx, |
| 299 b.bubble.y + b.bubble.h * 0.7); | 299 b.bubble.y + b.bubble.h * 0.7); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 function draw(ctx, game, L, view) { | 303 function draw(ctx, game, L, view) { |
