From cdfe6a497859cea8fc69063412d0ec1206e9716e Mon Sep 17 00:00:00 2001 From: Renan LE CARO Date: Fri, 14 Mar 2025 19:43:19 +0100 Subject: [PATCH] Added manifest --- Readme.md | 4 ++-- dist/index.html | 30 ++++++++++++------------ icon.png => public/icon.png | Bin public/manifest.json | 15 ++++++++++++ src/game.less | 2 +- src/game.ts | 45 +++++++++++++++++------------------- src/index.html | 2 ++ 7 files changed, 56 insertions(+), 42 deletions(-) rename icon.png => public/icon.png (100%) create mode 100644 public/manifest.json diff --git a/Readme.md b/Readme.md index a1daada..954496f 100644 --- a/Readme.md +++ b/Readme.md @@ -13,9 +13,9 @@ Break colourful bricks, catch bouncing coins and select powerful upgrades ! - [Donate](https://github.com/sponsors/renanlecaro) -# Requirements +# System requirements -The app should work offline and perform well even on low-end devices. +Breakout 71 can work offline and perform well even on low-end devices. It's very lean and does not take much storage space (Roughly 0.1MB). If the app stutters, turn on "fast mode" in the settings to render a simplified view that should be faster. There's also an easy mode for kids (slower ball). diff --git a/dist/index.html b/dist/index.html index 338ca17..d126e5f 100644 --- a/dist/index.html +++ b/dist/index.html @@ -633,6 +633,7 @@ parcelHelpers.export(exports, "captureFileName", ()=>captureFileName); parcelHelpers.export(exports, "findLast", ()=>findLast); parcelHelpers.export(exports, "toggleFullScreen", ()=>toggleFullScreen); parcelHelpers.export(exports, "setKeyPressed", ()=>setKeyPressed); +parcelHelpers.export(exports, "newGameState", ()=>newGameState); parcelHelpers.export(exports, "gameState", ()=>gameState); parcelHelpers.export(exports, "restart", ()=>restart); var _loadGameData = require("./loadGameData"); @@ -1367,20 +1368,6 @@ function ballTick(ball, delta) { } } } -const defaultRunStats = ()=>({ - started: Date.now(), - levelsPlayed: 0, - runTime: 0, - coins_spawned: 0, - score: 0, - bricks_broken: 0, - misses: 0, - balls_lost: 0, - puck_bounces: 0, - upgrades_picked: 1, - max_combo: 1, - max_level: 0 - }); function getTotalScore() { try { return JSON.parse(localStorage.getItem("breakout_71_total_score") || "0"); @@ -2635,7 +2622,20 @@ function newGameState(params) { keyboardPuckSpeed: 0, lastTick: performance.now(), lastTickDown: 0, - runStatistics: defaultRunStats(), + runStatistics: { + started: Date.now(), + levelsPlayed: 0, + runTime: 0, + coins_spawned: 0, + score: 0, + bricks_broken: 0, + misses: 0, + balls_lost: 0, + puck_bounces: 0, + upgrades_picked: 1, + max_combo: 1, + max_level: 0 + }, lastOffered: {}, levelTime: 0, autoCleanUses: 0 diff --git a/icon.png b/public/icon.png similarity index 100% rename from icon.png rename to public/icon.png diff --git a/public/manifest.json b/public/manifest.json new file mode 100644 index 0000000..cd5aa71 --- /dev/null +++ b/public/manifest.json @@ -0,0 +1,15 @@ +{ + "short_name": "B71", + "name": "Breakout 71", + "icons": [ + { + "src": "/icon.png", + "sizes": "512x512", + "type": "image/png" + } + ], + "start_url": ".", + "display": "fullscreen", + "theme_color": "#5DA3EA", + "background_color": "#ffffff" +} diff --git a/src/game.less b/src/game.less index aa16c97..0121af9 100644 --- a/src/game.less +++ b/src/game.less @@ -316,7 +316,7 @@ body { } &> span:not(:hover):not(.active) > span > span { opacity: 0; - } + } } h2.histogram-title { diff --git a/src/game.ts b/src/game.ts index bae505c..1c5179d 100644 --- a/src/game.ts +++ b/src/game.ts @@ -665,7 +665,7 @@ export function tick() { ) { gameState.bricks[hitBrick] = coin.color; coin.coloredABrick = true; - sounds.colorChange(coin.x,0.3) + sounds.colorChange(coin.x, 0.3) } } if (typeof hitBrick !== "undefined" || hitBorder) { @@ -1079,22 +1079,6 @@ export function ballTick(ball: Ball, delta: number) { } } -const defaultRunStats = () => - ({ - started: Date.now(), - levelsPlayed: 0, - runTime: 0, - coins_spawned: 0, - score: 0, - bricks_broken: 0, - misses: 0, - balls_lost: 0, - puck_bounces: 0, - upgrades_picked: 1, - max_combo: 1, - max_level: 0, - }) as RunStats; - export function getTotalScore() { try { @@ -1463,12 +1447,12 @@ export function explodeBrick(index: number, ball: Ball, isExplosion: boolean) { if (gameState.perks.picky_eater) { resetCombo(gameState, ball.x, ball.y); } - sounds.colorChange(ball.x,0.8) - gameState.lastExplosion=gameState.levelTime + sounds.colorChange(ball.x, 0.8) + gameState.lastExplosion = gameState.levelTime gameState.ballsColor = color; - if(!isSettingOn('basic')) { - gameState.balls.forEach(ball=>{ - spawnExplosion(7, ball.previousX, ball.previousY, color, 150, 15) + if (!isSettingOn('basic')) { + gameState.balls.forEach(ball => { + spawnExplosion(7, ball.previousX, ball.previousY, color, 150, 15) }) } } else { @@ -2927,7 +2911,7 @@ document.addEventListener("keyup", async (e) => { }); -function newGameState(params: RunParams): GameState { +export function newGameState(params: RunParams): GameState { const totalScoreAtRunStart = getTotalScore() const firstLevel = params?.level ? allLevels.filter((l) => l.name === params?.level) : []; @@ -2988,7 +2972,20 @@ function newGameState(params: RunParams): GameState { keyboardPuckSpeed: 0, lastTick: performance.now(), lastTickDown: 0, - runStatistics: defaultRunStats(), + runStatistics: { + started: Date.now(), + levelsPlayed: 0, + runTime: 0, + coins_spawned: 0, + score: 0, + bricks_broken: 0, + misses: 0, + balls_lost: 0, + puck_bounces: 0, + upgrades_picked: 1, + max_combo: 1, + max_level: 0, + }, lastOffered: {}, levelTime: 0, autoCleanUses: 0, diff --git a/src/index.html b/src/index.html index 20da3a9..430e0a9 100644 --- a/src/index.html +++ b/src/index.html @@ -12,6 +12,8 @@ name="description" content="A breakout game with roguelite mechanics. Break bricks, catch coins, pick upgrades, repeat. Play for free on mobile and desktop." /> + +