This commit is contained in:
Renan LE CARO 2025-03-20 22:50:50 +01:00
parent 322e927589
commit 0c7d729ece
12 changed files with 58 additions and 25 deletions

View file

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

View file

@ -50,8 +50,12 @@ export async function asyncAlert<t>({
function closeWithResult(value: t | undefined) {
if (closed) return;
closed = true;
Array.prototype.forEach.call(
popup.querySelectorAll("button:not([disabled])"),
(b) => (b.disabled = true),
);
document.body.style.minHeight = document.body.scrollHeight + "px";
setTimeout(() => (document.body.style.minHeight = ""), 100);
setTimeout(() => (document.body.style.minHeight = ""), 0);
popup.remove();
resolve(value);
}

View file

@ -1 +1 @@
"29041704"
"29041790"

View file

@ -181,7 +181,7 @@ body:not(.has-alert-open) #popup {
border: none;
cursor: pointer;
overflow: hidden;
z-index: 11;
z-index: 12;
&:before {
content: "+";

View file

@ -2,7 +2,7 @@ import { allLevels, appVersion, upgrades } from "./loadGameData";
import { t } from "./i18n/i18n";
import { RunHistoryItem } from "./types";
import { gameState, pause, restart } from "./game";
import { currentLevelInfo, findLast } from "./game_utils";
import { currentLevelInfo, findLast, pickedUpgradesHTMl } from "./game_utils";
import { getTotalScore } from "./settings";
import { stopRecording } from "./recording";
import { asyncAlert } from "./asyncAlert";
@ -129,6 +129,8 @@ export function gameOver(title: string, intro: string) {
},
],
textAfterButtons: `<div id="level-recording-container"></div>
<p>${t("gameOver.upgrades_picked")}</p>
<p>${pickedUpgradesHTMl(gameState)}</p>
${getHistograms()}
`,
}).then(() => restart({ levelToAvoid: currentLevelInfo(gameState).name }));

View file

@ -497,8 +497,10 @@ export function addToScore(gameState: GameState, coin: Coin) {
}
export async function setLevel(gameState: GameState, l: number) {
stopRecording();
// Here to alleviade double upgrades issues
pause(false);
stopRecording();
if (l > 0) {
await openUpgradesPicker(gameState);
}
@ -794,7 +796,7 @@ export function gameStateTick(
});
gameState.autoCleanUses++;
}
if (!remainingBricks && gameState.noBricksSince == 0) {
if (gameState.running && !remainingBricks && gameState.noBricksSince == 0) {
gameState.noBricksSince ||= gameState.levelTime;
}
if (
@ -803,7 +805,9 @@ export function gameStateTick(
gameState.levelTime > gameState.noBricksSince + 5000)
) {
if (gameState.currentLevel + 1 < max_levels(gameState)) {
setLevel(gameState, gameState.currentLevel + 1);
if (gameState.running) {
setLevel(gameState, gameState.currentLevel + 1);
}
} else {
gameOver(
t("gameOver.win.title"),
@ -895,7 +899,8 @@ export function gameStateTick(
}
} else if (
gameState.perks.unbounded &&
(coin.x < -50 || coin.x > gameState.canvasWidth + 50)
(coin.x < -gameState.gameZoneWidth / 2 ||
coin.x > gameState.canvasWidth + gameState.gameZoneWidth / 2)
) {
// Out of bound on sides
destroy(gameState.coins, coinIndex);
@ -1391,8 +1396,8 @@ export function ballTick(gameState: GameState, ball: Ball, delta: number) {
}
const lostOnSides =
(gameState.perks.unbounded && ball.x < 50) ||
ball.x > gameState.canvasWidth + 50;
(gameState.perks.unbounded && ball.x < -gameState.gameZoneWidth / 2) ||
ball.x > gameState.canvasWidth + gameState.gameZoneWidth / 2;
if (
gameState.running &&
(ball.y > gameState.gameZoneHeight + gameState.ballSize / 2 || lostOnSides)

View file

@ -382,6 +382,21 @@
</translation>
</translations>
</concept_node>
<concept_node>
<name>upgrades_picked</name>
<description/>
<comment/>
<translations>
<translation>
<language>en-US</language>
<approved>false</approved>
</translation>
<translation>
<language>fr-FR</language>
<approved>false</approved>
</translation>
</translations>
</concept_node>
<folder_node>
<name>win</name>
<children>

View file

@ -22,6 +22,7 @@
"gameOver.stats.upgrades_applied": "Upgrades applied",
"gameOver.test_run": "This test run and its score are not being recorded",
"gameOver.unlocked_count": "You unlocked {{count}} item(s) :",
"gameOver.upgrades_picked": "Upgrades active at the end of the run",
"gameOver.win.summary": "You cleared all levels for this run, catching {{score}} coins in total.",
"gameOver.win.title": "Run finished",
"level_up.after_buttons": "You just finished level {{level}}/{{max}} and picked those upgrades so far :",

View file

@ -22,6 +22,7 @@
"gameOver.stats.upgrades_applied": "Mises à jour appliquées",
"gameOver.test_run": "Cette partie de test et son score ne sont pas enregistrés.",
"gameOver.unlocked_count": "Vous avez débloqué {{count}} objet(s) :",
"gameOver.upgrades_picked": "Amélioration actives en fin de partie",
"gameOver.win.summary": "Vous avez nettoyé tous les niveaux pour cette partie, en attrapant {{score}} pièces au total.",
"gameOver.win.title": "Partie terminée",
"level_up.after_buttons": "Vous venez de terminer le niveau {{level}}/{{max}} et vous avez choisi ces améliorations jusqu'à présent :",