This commit is contained in:
Renan LE CARO 2025-03-24 10:42:48 +01:00
parent c48b379098
commit 4710eaa152
8 changed files with 31 additions and 25 deletions

View file

@ -1,5 +1,5 @@
// The version of the cache.
const VERSION = "29046079";
const VERSION = "29046822";
// The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`;

View file

@ -1 +1 @@
"29046079"
"29046822"

View file

@ -53,10 +53,8 @@ import { use } from "react";
export function setMousePos(gameState: GameState, x: number) {
// Sets the puck position, and updates the ball position if they are supposed to follow it
if (
Math.abs(x - gameState.puckPosition) > 1
) {
gameState.lastPuckMove=gameState.levelTime
if (Math.abs(x - gameState.puckPosition) > 1) {
gameState.lastPuckMove = gameState.levelTime;
}
gameState.puckPosition = x;
gameState.needsRender = true;
@ -71,7 +69,7 @@ function getBallDefaultVx(gameState: GameState) {
export function resetBalls(gameState: GameState) {
// Always compute speed first
normalizeGameState(gameState)
normalizeGameState(gameState);
const count = 1 + (gameState.perks?.multiball || 0);
const perBall = gameState.puckWidth / (count + 1);
gameState.balls = [];
@ -429,8 +427,13 @@ export function explodeBrick(
}
}
if(gameState.lastPuckMove && gameState.perks.passive_income && gameState.lastPuckMove>gameState.levelTime-500*gameState.perks.passive_income){
resetCombo(gameState, x, y);
if (
gameState.lastPuckMove &&
gameState.perks.passive_income &&
gameState.lastPuckMove >
gameState.levelTime - 500 * gameState.perks.passive_income
) {
resetCombo(gameState, x, y);
}
if (!isExplosion) {
@ -961,7 +964,7 @@ export function gameStateTick(
}
}
const speed =( Math.abs(coin.vx) + Math.abs(coin.vy)) * 10;
const speed = (Math.abs(coin.vx) + Math.abs(coin.vy)) * 10;
const hitBorder = bordersHitCheck(gameState, coin, coin.size / 2, frames);
if (

View file

@ -229,8 +229,14 @@ export function render(gameState: GameState) {
ctx.globalCompositeOperation = "source-over";
gameState.balls.forEach((ball) => {
const drawingColor = (gameState.lastPuckMove&& gameState.perks.passive_income && gameState.combo>baseCombo(gameState) && gameState.lastPuckMove>gameState.levelTime-500*gameState.perks.passive_income && 'red')||gameState.ballsColor
const drawingColor =
(gameState.lastPuckMove &&
gameState.perks.passive_income &&
gameState.combo > baseCombo(gameState) &&
gameState.lastPuckMove >
gameState.levelTime - 500 * gameState.perks.passive_income &&
"red") ||
gameState.ballsColor;
// The white border around is to distinguish colored balls from coins/bg
drawBall(
@ -256,17 +262,13 @@ export function render(gameState: GameState) {
);
ctx.stroke();
}
if(gameState.perks.clairvoyant && gameState.ballStickToPuck){
if (gameState.perks.clairvoyant && gameState.ballStickToPuck) {
ctx.strokeStyle = gameState.ballsColor;
ctx.beginPath();
ctx.moveTo(ball.x,ball.y);
ctx.lineTo(
ball.x+ball.vx*10,
ball.y+ball.vy*10
);
ctx.moveTo(ball.x, ball.y);
ctx.lineTo(ball.x + ball.vx * 10, ball.y + ball.vy * 10);
ctx.stroke();
}
});
// The puck
ctx.globalAlpha = 1;

View file

@ -572,7 +572,8 @@ export const rawUpgrades = [
id: "passive_income",
max: 4,
name: t("upgrades.passive_income.name"),
help: (lvl: number) => t("upgrades.passive_income.help",{time:lvl/2,lvl}),
help: (lvl: number) =>
t("upgrades.passive_income.help", { time: lvl / 2, lvl }),
fullHelp: t("upgrades.passive_income.fullHelp"),
},
{