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

@ -11,8 +11,8 @@ android {
applicationId = "me.lecaro.breakout" applicationId = "me.lecaro.breakout"
minSdk = 21 minSdk = 21
targetSdk = 34 targetSdk = 34
versionCode = 29041704 versionCode = 29041790
versionName = "29041704" versionName = "29041790"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables { vectorDrawables {
useSupportLibrary = true useSupportLibrary = true

File diff suppressed because one or more lines are too long

27
dist/index.html vendored

File diff suppressed because one or more lines are too long

View file

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

View file

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

View file

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

View file

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

View file

@ -2,7 +2,7 @@ import { allLevels, appVersion, upgrades } from "./loadGameData";
import { t } from "./i18n/i18n"; import { t } from "./i18n/i18n";
import { RunHistoryItem } from "./types"; import { RunHistoryItem } from "./types";
import { gameState, pause, restart } from "./game"; import { gameState, pause, restart } from "./game";
import { currentLevelInfo, findLast } from "./game_utils"; import { currentLevelInfo, findLast, pickedUpgradesHTMl } from "./game_utils";
import { getTotalScore } from "./settings"; import { getTotalScore } from "./settings";
import { stopRecording } from "./recording"; import { stopRecording } from "./recording";
import { asyncAlert } from "./asyncAlert"; import { asyncAlert } from "./asyncAlert";
@ -129,6 +129,8 @@ export function gameOver(title: string, intro: string) {
}, },
], ],
textAfterButtons: `<div id="level-recording-container"></div> textAfterButtons: `<div id="level-recording-container"></div>
<p>${t("gameOver.upgrades_picked")}</p>
<p>${pickedUpgradesHTMl(gameState)}</p>
${getHistograms()} ${getHistograms()}
`, `,
}).then(() => restart({ levelToAvoid: currentLevelInfo(gameState).name })); }).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) { export async function setLevel(gameState: GameState, l: number) {
stopRecording(); // Here to alleviade double upgrades issues
pause(false); pause(false);
stopRecording();
if (l > 0) { if (l > 0) {
await openUpgradesPicker(gameState); await openUpgradesPicker(gameState);
} }
@ -794,7 +796,7 @@ export function gameStateTick(
}); });
gameState.autoCleanUses++; gameState.autoCleanUses++;
} }
if (!remainingBricks && gameState.noBricksSince == 0) { if (gameState.running && !remainingBricks && gameState.noBricksSince == 0) {
gameState.noBricksSince ||= gameState.levelTime; gameState.noBricksSince ||= gameState.levelTime;
} }
if ( if (
@ -803,7 +805,9 @@ export function gameStateTick(
gameState.levelTime > gameState.noBricksSince + 5000) gameState.levelTime > gameState.noBricksSince + 5000)
) { ) {
if (gameState.currentLevel + 1 < max_levels(gameState)) { if (gameState.currentLevel + 1 < max_levels(gameState)) {
setLevel(gameState, gameState.currentLevel + 1); if (gameState.running) {
setLevel(gameState, gameState.currentLevel + 1);
}
} else { } else {
gameOver( gameOver(
t("gameOver.win.title"), t("gameOver.win.title"),
@ -895,7 +899,8 @@ export function gameStateTick(
} }
} else if ( } else if (
gameState.perks.unbounded && 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 // Out of bound on sides
destroy(gameState.coins, coinIndex); destroy(gameState.coins, coinIndex);
@ -1391,8 +1396,8 @@ export function ballTick(gameState: GameState, ball: Ball, delta: number) {
} }
const lostOnSides = const lostOnSides =
(gameState.perks.unbounded && ball.x < 50) || (gameState.perks.unbounded && ball.x < -gameState.gameZoneWidth / 2) ||
ball.x > gameState.canvasWidth + 50; ball.x > gameState.canvasWidth + gameState.gameZoneWidth / 2;
if ( if (
gameState.running && gameState.running &&
(ball.y > gameState.gameZoneHeight + gameState.ballSize / 2 || lostOnSides) (ball.y > gameState.gameZoneHeight + gameState.ballSize / 2 || lostOnSides)

View file

@ -382,6 +382,21 @@
</translation> </translation>
</translations> </translations>
</concept_node> </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> <folder_node>
<name>win</name> <name>win</name>
<children> <children>

View file

@ -22,6 +22,7 @@
"gameOver.stats.upgrades_applied": "Upgrades applied", "gameOver.stats.upgrades_applied": "Upgrades applied",
"gameOver.test_run": "This test run and its score are not being recorded", "gameOver.test_run": "This test run and its score are not being recorded",
"gameOver.unlocked_count": "You unlocked {{count}} item(s) :", "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.summary": "You cleared all levels for this run, catching {{score}} coins in total.",
"gameOver.win.title": "Run finished", "gameOver.win.title": "Run finished",
"level_up.after_buttons": "You just finished level {{level}}/{{max}} and picked those upgrades so far :", "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.stats.upgrades_applied": "Mises à jour appliquées",
"gameOver.test_run": "Cette partie de test et son score ne sont pas enregistrés.", "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.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.summary": "Vous avez nettoyé tous les niveaux pour cette partie, en attrapant {{score}} pièces au total.",
"gameOver.win.title": "Partie terminée", "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 :", "level_up.after_buttons": "Vous venez de terminer le niveau {{level}}/{{max}} et vous avez choisi ces améliorations jusqu'à présent :",