Sturdy bricks now have a proper hit counter

This commit is contained in:
Renan LE CARO 2025-03-23 17:52:25 +01:00
parent 6899b5cf36
commit 3745b527f5
6 changed files with 64 additions and 32 deletions

View file

@ -398,7 +398,8 @@ export function renderAllBricks() {
"_" +
gameState.ballsColor +
"_" +
gameState.perks.pierce_color;
gameState.perks.pierce_color +
"_"+ gameState.brickHP.reduce((a,b)=>a+b,0);
if (newKey !== cachedBricksRenderKey) {
cachedBricksRenderKey = newKey;
@ -427,7 +428,12 @@ export function renderAllBricks() {
redBorderOnBricksWithWrongColor) ||
redBecauseOfReach;
canctx.globalCompositeOperation = "source-over";
drawBrick(canctx, color, (redBorder && "red") || color, x, y);
if(gameState.brickHP[index]>1){
canctx.globalCompositeOperation="destination-out"
drawText(canctx, gameState.brickHP[index].toString(), "white", gameState.puckHeight, x,y )
}
if (color === "black") {
canctx.globalCompositeOperation = "source-over";