mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-20 12:15:06 -04:00
Avoid caching angles of coins that look the same, more coin angles
This commit is contained in:
parent
ced49f3afd
commit
dc73290fb2
1 changed files with 3 additions and 3 deletions
|
@ -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),);
|
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) {
|
function drawCoin(ctx, color, size, x, y, bg, rawAngle) {
|
||||||
|
const angle = (Math.round(rawAngle / Math.PI * 2 * angles) % angles + angles) % angles
|
||||||
const angle = (Math.round(rawAngle / Math.PI * 2 * 16) % 16 + 16) % 16
|
const key = "coin with halo" + "_" + color + "_" + size + '_' + bg + '_' + (color === 'gold' ? angle:'whatever');
|
||||||
const key = "coin with halo" + "_" + color + "_" + size + '_' + bg + '_' + angle;
|
|
||||||
|
|
||||||
if (!cachedGraphics[key]) {
|
if (!cachedGraphics[key]) {
|
||||||
const can = document.createElement("canvas");
|
const can = document.createElement("canvas");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue