From dc73290fb29332c13eca72a1ff949fd8205f5806 Mon Sep 17 00:00:00 2001 From: Renan LE CARO Date: Wed, 5 Mar 2025 15:46:33 +0100 Subject: [PATCH] Avoid caching angles of coins that look the same, more coin angles --- app/src/main/assets/game.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/assets/game.js b/app/src/main/assets/game.js index baa8274..68b742c 100644 --- a/app/src/main/assets/game.js +++ b/app/src/main/assets/game.js @@ -2154,10 +2154,10 @@ function drawBall(ctx, color, width, x, y, borderColor = '') { ctx.drawImage(cachedGraphics[key], Math.round(x - size / 2), Math.round(y - size / 2),); } +const angles=32 function drawCoin(ctx, color, size, x, y, bg, rawAngle) { - - const angle = (Math.round(rawAngle / Math.PI * 2 * 16) % 16 + 16) % 16 - const key = "coin with halo" + "_" + color + "_" + size + '_' + bg + '_' + angle; + const angle = (Math.round(rawAngle / Math.PI * 2 * angles) % angles + angles) % angles + const key = "coin with halo" + "_" + color + "_" + size + '_' + bg + '_' + (color === 'gold' ? angle:'whatever'); if (!cachedGraphics[key]) { const can = document.createElement("canvas");