diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 8061809..5aadb47 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -11,8 +11,8 @@ android { applicationId = "me.lecaro.breakout" minSdk = 21 targetSdk = 34 - versionCode = 29045721 - versionName = "29045721" + versionCode = 29046079 + versionName = "29046079" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { useSupportLibrary = true diff --git a/app/src/main/assets/index.html b/app/src/main/assets/index.html index cfd07d6..20b8717 100644 --- a/app/src/main/assets/index.html +++ b/app/src/main/assets/index.html @@ -1 +1 @@ -
${(0, _i18N.t)('score_panel.upcoming_levels')}
${list}
`; + return `${(0, _i18N.t)("score_panel.upcoming_levels")}
${list}
`; } function currentLevelInfo(gameState) { return gameState.runLevels[gameState.currentLevel % gameState.runLevels.length]; @@ -2711,7 +2711,7 @@ function explodeBrick(gameState, index, ball, isExplosion) { if (!color) return; if (color === "black") { const x = (0, _gameUtils.brickCenterX)(gameState, index), y = (0, _gameUtils.brickCenterY)(gameState, index); - setBrick(gameState, index, ''); + setBrick(gameState, index, ""); explosionAt(gameState, index, x, y, ball); } else if (color) { // Even if it bounces we don't want to count that as a miss @@ -2855,8 +2855,8 @@ async function setLevel(gameState, l) { (0, _render.background).src = "data:image/svg+xml;UTF8," + lvl.svg; } function setBrick(gameState, index, color) { - gameState.bricks[index] = color || ''; - gameState.brickHP[index] = color === 'black' && 1 || color && 1 + gameState.perks.sturdy_bricks || 0; + gameState.bricks[index] = color || ""; + gameState.brickHP[index] = color === "black" && 1 || color && 1 + gameState.perks.sturdy_bricks || 0; } function rainbowColor() { return `hsl(${Math.round((0, _game.gameState).levelTime / 4) * 2 % 360},100%,70%)`; diff --git a/src/PWA/sw-b71.js b/src/PWA/sw-b71.js index 06e10b3..3593bf3 100644 --- a/src/PWA/sw-b71.js +++ b/src/PWA/sw-b71.js @@ -1,5 +1,5 @@ // The version of the cache. -const VERSION = "29045721"; +const VERSION = "29046079"; // The name of the cache const CACHE_NAME = `breakout-71-${VERSION}`; diff --git a/src/data/levels.json b/src/data/levels.json index 94bc269..64cde11 100644 --- a/src/data/levels.json +++ b/src/data/levels.json @@ -1018,4 +1018,4 @@ "svg": null, "color": "" } -] \ No newline at end of file +] diff --git a/src/data/version.json b/src/data/version.json index 12a55c6..aad782d 100644 --- a/src/data/version.json +++ b/src/data/version.json @@ -1 +1 @@ -"29045721" +"29046079" diff --git a/src/game.ts b/src/game.ts index 4031dcf..c8fbf7a 100644 --- a/src/game.ts +++ b/src/game.ts @@ -14,7 +14,8 @@ import { import { getAudioContext, playPendingSounds } from "./sounds"; import { currentLevelInfo, - getRowColIndex, levelsListHTMl, + getRowColIndex, + levelsListHTMl, max_levels, pickedUpgradesHTMl, } from "./game_utils"; @@ -992,7 +993,7 @@ restart( telekinesis: 2, yoyo: 2, metamorphosis: 1, - implosions:1 + implosions: 1, }, } : {}, diff --git a/src/gameStateMutators.ts b/src/gameStateMutators.ts index c77dcb6..8fc51d6 100644 --- a/src/gameStateMutators.ts +++ b/src/gameStateMutators.ts @@ -49,7 +49,7 @@ import { } from "./game"; import { stopRecording } from "./recording"; import { isOptionOn } from "./options"; -import {use} from "react"; +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 @@ -98,7 +98,7 @@ export function resetBalls(gameState: GameState) { sx: 0, sy: 0, - piercePoints: gameState.perks.pierce*3, + piercePoints: gameState.perks.pierce * 3, hitSinceBounce: 0, brokenSinceBounce: 0, hitItem: [], @@ -149,15 +149,21 @@ export function normalizeGameState(gameState: GameState) { (gameState.gameZoneWidth / 12) * (3 - gameState.perks.smaller_puck + gameState.perks.bigger_puck); - let minX = gameState.perks.corner_shot && gameState.levelTime? gameState.offsetXRoundedDown - gameState.puckWidth / 2 : gameState.offsetXRoundedDown + gameState.puckWidth / 2 + let minX = + gameState.perks.corner_shot && gameState.levelTime + ? gameState.offsetXRoundedDown - gameState.puckWidth / 2 + : gameState.offsetXRoundedDown + gameState.puckWidth / 2; - let maxX = gameState.perks.corner_shot && gameState.levelTime? gameState.offsetXRoundedDown + - gameState.gameZoneWidthRoundedUp + - gameState.puckWidth / 2 : gameState.offsetXRoundedDown + - gameState.gameZoneWidthRoundedUp - - gameState.puckWidth / 2 + let maxX = + gameState.perks.corner_shot && gameState.levelTime + ? gameState.offsetXRoundedDown + + gameState.gameZoneWidthRoundedUp + + gameState.puckWidth / 2 + : gameState.offsetXRoundedDown + + gameState.gameZoneWidthRoundedUp - + gameState.puckWidth / 2; - gameState.puckPosition = clamp(gameState.puckPosition,minX,maxX) + gameState.puckPosition = clamp(gameState.puckPosition, minX, maxX); if (gameState.ballStickToPuck) { putBallsAtPuck(gameState); @@ -254,17 +260,9 @@ export function spawnImplosion( count = 1; } for (let i = 0; i < count; i++) { - const dx=((Math.random() - 0.5) * gameState.brickWidth) / 2 - const dy=((Math.random() - 0.5) * gameState.brickWidth) / 2 - makeParticle( - gameState, - x -dx*10 , - y -dy*10, - dx, - dy, - color, - false, - ); + const dx = ((Math.random() - 0.5) * gameState.brickWidth) / 2; + const dy = ((Math.random() - 0.5) * gameState.brickWidth) / 2; + makeParticle(gameState, x - dx * 10, y - dy * 10, dx, dy, color, false); } } @@ -286,8 +284,8 @@ export function explosionAt( const i = getRowColIndex(gameState, row + dy, col + dx); if (gameState.bricks[i] && i !== -1) { // Study bricks resist explosions too - gameState.brickHP[i]-- - if (gameState.brickHP<=0) { + gameState.brickHP[i]--; + if (gameState.brickHP <= 0) { explodeBrick(gameState, i, ball, true); } } @@ -295,34 +293,34 @@ export function explosionAt( } } - const factor = gameState.perks.implosions ? -1:1 + const factor = gameState.perks.implosions ? -1 : 1; // Blow nearby coins forEachLiveOne(gameState.coins, (c) => { const dx = c.x - x; const dy = c.y - y; const d2 = Math.max(gameState.brickWidth, Math.abs(dx) + Math.abs(dy)); - c.vx += ((dx / d2) * 10 * size) / c.weight * factor; - c.vy += ((dy / d2) * 10 * size) / c.weight* factor; + c.vx += (((dx / d2) * 10 * size) / c.weight) * factor; + c.vy += (((dy / d2) * 10 * size) / c.weight) * factor; }); gameState.lastExplosion = Date.now(); makeLight(gameState, x, y, "white", gameState.brickWidth * 2, 150); - if(gameState.perks.implosions){ + if (gameState.perks.implosions) { spawnImplosion( - gameState, - 7 * (1 + gameState.perks.bigger_explosions), - x, - y, - "white") - }else{ - - spawnExplosion( - gameState, - 7 * (1 + gameState.perks.bigger_explosions), - x, - y, - "white", - ); + gameState, + 7 * (1 + gameState.perks.bigger_explosions), + x, + y, + "white", + ); + } else { + spawnExplosion( + gameState, + 7 * (1 + gameState.perks.bigger_explosions), + x, + y, + "white", + ); } gameState.runStatistics.bricks_broken++; @@ -336,7 +334,7 @@ export function explodeBrick( gameState: GameState, index: number, ball: Ball, - isExplosion: boolean + isExplosion: boolean, ) { const color = gameState.bricks[index]; if (!color) return; @@ -344,7 +342,7 @@ export function explodeBrick( if (color === "black") { const x = brickCenterX(gameState, index), y = brickCenterY(gameState, index); - setBrick(gameState, index, '') + setBrick(gameState, index, ""); explosionAt(gameState, index, x, y, ball); } else if (color) { // Even if it bounces we don't want to count that as a miss @@ -353,7 +351,7 @@ export function explodeBrick( const x = brickCenterX(gameState, index), y = brickCenterY(gameState, index); - setBrick( gameState,index,""); + setBrick(gameState, index, ""); let coinsToSpawn = gameState.combo; if (gameState.perks.sturdy_bricks) { @@ -413,11 +411,11 @@ export function explodeBrick( gameState.perks.nbricks + gameState.perks.unbounded; - if(gameState.perks.side_kick) { - if(Math.abs(ball.vx) > Math.abs(ball.vy)){ - gameState.combo += gameState.perks.side_kick - }else { - decreaseCombo(gameState, gameState.perks.side_kick, ball.x,ball.y) + if (gameState.perks.side_kick) { + if (Math.abs(ball.vx) > Math.abs(ball.vy)) { + gameState.combo += gameState.perks.side_kick; + } else { + decreaseCombo(gameState, gameState.perks.side_kick, ball.x, ball.y); } } @@ -593,9 +591,9 @@ export async function setLevel(gameState: GameState, l: number) { empty(gameState.particles); empty(gameState.lights); empty(gameState.texts); - gameState.bricks = [] - for(let i=0;i${t('score_panel.upcoming_levels')}
${list}
`; + return `${t("score_panel.upcoming_levels")}
${list}
`; } export function currentLevelInfo(gameState: GameState) { diff --git a/src/render.ts b/src/render.ts index cd2d076..cc67cef 100644 --- a/src/render.ts +++ b/src/render.ts @@ -303,9 +303,11 @@ export function render(gameState: GameState) { } else { drawText( ctx, - comboTextWidth > gameState.puckWidth ? gameState.combo.toString() : comboText, + comboTextWidth > gameState.puckWidth + ? gameState.combo.toString() + : comboText, "#000", - comboTextWidth > gameState.puckWidth ? 12:20, + comboTextWidth > gameState.puckWidth ? 12 : 20, gameState.puckPosition, gameState.gameZoneHeight - gameState.puckHeight / 2, false, @@ -387,7 +389,8 @@ export function renderAllBricks() { gameState.perks.picky_eater && !isOptionOn("basic"); - const clairVoyance= gameState.perks.clairvoyant && gameState.brickHP.reduce((a,b)=>a+b,0) + const clairVoyance = + gameState.perks.clairvoyant && gameState.brickHP.reduce((a, b) => a + b, 0); const newKey = gameState.gameZoneWidth + @@ -400,7 +403,8 @@ export function renderAllBricks() { gameState.ballsColor + "_" + gameState.perks.pierce_color + - "_"+ clairVoyance; + "_" + + clairVoyance; if (newKey !== cachedBricksRenderKey) { cachedBricksRenderKey = newKey; @@ -429,11 +433,18 @@ export function renderAllBricks() { redBorderOnBricksWithWrongColor) || redBecauseOfReach; - canctx.globalCompositeOperation = "source-over"; + canctx.globalCompositeOperation = "source-over"; drawBrick(canctx, color, (redBorder && "red") || color, x, y); - if(gameState.brickHP[index]>1 && gameState.perks.clairvoyant){ - canctx.globalCompositeOperation="destination-out" - drawText(canctx, gameState.brickHP[index].toString(), "white", gameState.puckHeight, x,y ) + if (gameState.brickHP[index] > 1 && gameState.perks.clairvoyant) { + canctx.globalCompositeOperation = "destination-out"; + drawText( + canctx, + gameState.brickHP[index].toString(), + "white", + gameState.puckHeight, + x, + y, + ); } if (color === "black") { diff --git a/src/upgrades.ts b/src/upgrades.ts index 0487c9d..2ea641e 100644 --- a/src/upgrades.ts +++ b/src/upgrades.ts @@ -277,7 +277,7 @@ export const rawUpgrades = [ id: "pierce_color", max: 4, name: t("upgrades.pierce_color.name"), - help: (lvl: number) => t("upgrades.pierce_color.help",{lvl}), + help: (lvl: number) => t("upgrades.pierce_color.help", { lvl }), fullHelp: t("upgrades.pierce_color.fullHelp"), }, { @@ -594,7 +594,7 @@ export const rawUpgrades = [ id: "side_kick", max: 3, name: t("upgrades.side_kick.name"), - help: (lvl: number) => t("upgrades.side_kick.help",{lvl}), + help: (lvl: number) => t("upgrades.side_kick.help", { lvl }), fullHelp: t("upgrades.side_kick.fullHelp"), }, {