From f49da766679cedbfb3385d7710b55ec3d3229d54 Mon Sep 17 00:00:00 2001 From: Renan LE CARO Date: Sun, 23 Mar 2025 21:34:56 +0100 Subject: [PATCH] Fixed : combo display on small pucks --- Readme.md | 2 -- dist/index.html | 10 +++++++++- src/render.ts | 8 ++++---- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Readme.md b/Readme.md index ce8f706..0506baf 100644 --- a/Readme.md +++ b/Readme.md @@ -25,9 +25,7 @@ There's also an easy mode for kids (slower ball). # bugs -- perk : travel map * [colin] parfois je dois appuyer plusieurs fois sur "Start a new run" pour vraiment commencer une nouvelle partie. dans ce cas, lhécran de jeu derrière se "désassombrit" comme si le jeu avait démarré plusieurs parties en même temps. -* [colin] lorsque le puck est trop petit, l'affichage du combo disparaît. mais c'est peut-être volontaire pour qu'il ne dépasse pas du puck ? afficher simplement le chiffre serait suffisant et tiendrait dans le puck * [colin] le niveau bug parfois et ne peux pas démarrer. dans ce cas, la balle apparait comme démarrant sans être attachée au puck, comme si la partie avait déjà commencée. il faut redémarrer B71 pour que ça fonctionne # UX diff --git a/dist/index.html b/dist/index.html index d2d06ea..9f766f8 100644 --- a/dist/index.html +++ b/dist/index.html @@ -3515,7 +3515,15 @@ function render(gameState) { if (totalWidth < gameState.puckWidth) { drawCoin(ctx, "gold", gameState.coinSize, left + gameState.coinSize / 2, gameState.gameZoneHeight - gameState.puckHeight / 2, gameState.puckColor, 0); drawText(ctx, comboText, "#000", gameState.puckHeight, left + gameState.coinSize * 1.5, gameState.gameZoneHeight - gameState.puckHeight / 2, true); - } else drawText(ctx, comboText, "#FFF", gameState.puckHeight, gameState.puckPosition, gameState.gameZoneHeight - gameState.puckHeight / 2, false); + } else { + console.log({ + comboTextWidth, + pw: gameState.puckWidth, + combo: gameState.combo, + comboText + }); + 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); diff --git a/src/render.ts b/src/render.ts index 27a0c8d..c2e09f1 100644 --- a/src/render.ts +++ b/src/render.ts @@ -281,7 +281,6 @@ export function render(gameState: GameState) { const comboTextWidth = (comboText.length * gameState.puckHeight) / 1.8; const totalWidth = comboTextWidth + gameState.coinSize * 2; const left = gameState.puckPosition - totalWidth / 2; - if (totalWidth < gameState.puckWidth) { drawCoin( ctx, @@ -302,11 +301,12 @@ export function render(gameState: GameState) { true, ); } else { + console.log({comboTextWidth,pw:gameState.puckWidth,combo:gameState.combo, comboText}) drawText( ctx, - comboText, - "#FFF", - gameState.puckHeight, + comboTextWidth > gameState.puckWidth ? gameState.combo.toString() : comboText, + "#000", + comboTextWidth > gameState.puckWidth ? 12:20, gameState.puckPosition, gameState.gameZoneHeight - gameState.puckHeight / 2, false,