N hits : reset as soon as you break more bricks that demanded

This commit is contained in:
Renan LE CARO 2025-03-24 12:52:42 +01:00
parent 4710eaa152
commit 8b8e49595d
2 changed files with 12 additions and 2 deletions

View file

@ -436,6 +436,14 @@ export function explodeBrick(
resetCombo(gameState, x, y);
}
if (
gameState.perks.nbricks &&
ball.brokenSinceBounce == gameState.perks.nbricks+1
) {
resetCombo(gameState, ball.x, ball.y);
}
if (!isExplosion) {
// color change
if (
@ -1437,7 +1445,7 @@ export function ballTick(gameState: GameState, ball: Ball, delta: number) {
}
if (
gameState.perks.nbricks &&
gameState.perks.nbricks !== ball.brokenSinceBounce
ball.brokenSinceBounce< gameState.perks.nbricks
) {
resetCombo(gameState, ball.x, ball.y);
}
@ -1553,6 +1561,7 @@ export function ballTick(gameState: GameState, ball: Ball, delta: number) {
const initialBrickColor = gameState.bricks[hitBrick];
ball.brokenSinceBounce++;
explodeBrick(gameState, hitBrick, ball, false);
if (
ball.sapperUses < gameState.perks.sapper &&