mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-26 06:56:14 -04:00
Ascetism : render coins with red border if there's a combo
This commit is contained in:
parent
fe5c33f999
commit
3a72ae005b
2 changed files with 25 additions and 9 deletions
15
dist/index.html
vendored
15
dist/index.html
vendored
|
@ -3417,6 +3417,7 @@ const background = document.createElement("img");
|
|||
const backgroundCanvas = document.createElement("canvas");
|
||||
function render(gameState) {
|
||||
const level = (0, _gameUtils.currentLevelInfo)(gameState);
|
||||
const hasCombo = gameState.combo > (0, _gameStateMutators.baseCombo)(gameState);
|
||||
const { width, height } = gameCanvas;
|
||||
if (!width || !height) return;
|
||||
if (gameState.currentLevel || gameState.levelTime) menuLabel.innerText = (0, _i18N.t)("play.current_lvl", {
|
||||
|
@ -3514,7 +3515,7 @@ function render(gameState) {
|
|||
ctx.globalAlpha = 1;
|
||||
(0, _gameStateMutators.forEachLiveOne)(gameState.coins, (coin)=>{
|
||||
ctx.globalCompositeOperation = coin.color === "gold" || level.color ? "source-over" : "screen";
|
||||
drawCoin(ctx, coin.color, coin.size, coin.x, coin.y, level.color || "black", coin.a);
|
||||
drawCoin(ctx, coin.color, coin.size, coin.x, coin.y, hasCombo && gameState.perks.asceticism && 'red' || level.color || "black", coin.a);
|
||||
});
|
||||
// Black shadow around balls
|
||||
if (!(0, _options.isOptionOn)("basic")) {
|
||||
|
@ -3572,7 +3573,7 @@ function render(gameState) {
|
|||
// The puck
|
||||
ctx.globalAlpha = 1;
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
drawPuck(ctx, gameState.puckColor, gameState.puckWidth, gameState.puckHeight, 0, !!gameState.perks.concave_puck, gameState.perks.streak_shots && gameState.combo > (0, _gameStateMutators.baseCombo)(gameState) ? getDashOffset(gameState) : -1);
|
||||
drawPuck(ctx, gameState.puckColor, gameState.puckWidth, gameState.puckHeight, 0, !!gameState.perks.concave_puck, gameState.perks.streak_shots && hasCombo ? getDashOffset(gameState) : -1);
|
||||
if (gameState.combo > 1) {
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
const comboText = "x " + gameState.combo;
|
||||
|
@ -3585,7 +3586,6 @@ function render(gameState) {
|
|||
} else drawText(ctx, comboTextWidth > gameState.puckWidth ? gameState.combo.toString() : comboText, "#000", comboTextWidth > gameState.puckWidth ? 12 : 20, gameState.puckPosition, gameState.gameZoneHeight - gameState.puckHeight / 2, false);
|
||||
}
|
||||
// Borders
|
||||
const hasCombo = gameState.combo > (0, _gameStateMutators.baseCombo)(gameState);
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
ctx.globalAlpha = gameState.perks.unbounded ? 0.1 : 1;
|
||||
if (gameState.offsetXRoundedDown) {
|
||||
|
@ -3730,9 +3730,16 @@ function drawCoin(ctx, color, size, x, y, borderColor, rawAngle) {
|
|||
canctx.arc(size / 2, size / 2, size / 2, 0, 2 * Math.PI);
|
||||
canctx.fillStyle = color;
|
||||
canctx.fill();
|
||||
if (color === "gold") {
|
||||
if (color === 'gold' || borderColor === 'red') {
|
||||
canctx.strokeStyle = borderColor;
|
||||
if (borderColor == 'red') {
|
||||
canctx.lineWidth = 2;
|
||||
canctx.setLineDash(redBorderDash);
|
||||
}
|
||||
canctx.stroke();
|
||||
}
|
||||
if (color === "gold") {
|
||||
// Fill in
|
||||
canctx.beginPath();
|
||||
canctx.arc(size / 2, size / 2, size / 2 * 0.6, 0, 2 * Math.PI);
|
||||
canctx.fillStyle = "rgba(255,255,255,0.5)";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue