Build 29079805

This commit is contained in:
Renan LE CARO 2025-04-16 09:26:10 +02:00
parent 8e4e67e33b
commit 871a7f9c31
13 changed files with 68 additions and 39 deletions

View file

@ -29,6 +29,13 @@ languages, I may add features again.
## Done ## Done
- combo text on paddle will be grey if we're at the base combo
- transparency now rounds up
- import level up to 21 x 21
- corrected icon of "padding"
## 29079087
- measured and improve the performance (test here https://breakout.lecaro.me/?stresstest) - measured and improve the performance (test here https://breakout.lecaro.me/?stresstest)
- added a few levels - added a few levels
- autoplay mode (with wake lock and computer play https://breakout.lecaro.me/?autoplay ) - autoplay mode (with wake lock and computer play https://breakout.lecaro.me/?autoplay )

View file

@ -29,8 +29,8 @@ android {
applicationId = "me.lecaro.breakout" applicationId = "me.lecaro.breakout"
minSdk = 21 minSdk = 21
targetSdk = 34 targetSdk = 34
versionCode = 29079087 versionCode = 29079805
versionName = "29079087" versionName = "29079805"
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

34
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 = "29079087"; const VERSION = "29079805";
// The name of the cache // The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`; const CACHE_NAME = `breakout-71-${VERSION}`;

View file

@ -740,7 +740,7 @@
{ {
"name": "icon:unbounded", "name": "icon:unbounded",
"size": 9, "size": 9,
"bricks": "WWWWWWWWWW_r_r_r_WWrtttttrWW_ttttt_WWr_____rWW_______WWr___W_rWW_______WWrWWW__rW", "bricks": "WWWWWWWWWW_ttttt_WWrtttttrWW_ttttt_WWr_____rWW_______WWr___W_rWW_______WWrWWW__rW",
"color": "" "color": ""
}, },
{ {

View file

@ -1 +1 @@
"29079087" "29079805"

View file

@ -34,6 +34,7 @@ import {
import "./PWA/sw_loader"; import "./PWA/sw_loader";
import { getCurrentLang, languages, t } from "./i18n/i18n"; import { getCurrentLang, languages, t } from "./i18n/i18n";
import { import {
commitSettingsChangesToLocalStorage,
cycleMaxCoins, cycleMaxCoins,
getCurrentMaxCoins, getCurrentMaxCoins,
getSettingValue, getSettingValue,
@ -658,6 +659,7 @@ async function openSettingsMenu() {
(await confirmRestart(gameState)) (await confirmRestart(gameState))
) { ) {
setSettingValue("lang", pick); setSettingValue("lang", pick);
commitSettingsChangesToLocalStorage();
window.location.reload(); window.location.reload();
} }
}, },

View file

@ -449,7 +449,7 @@ export function explodeBrick(
); );
} }
if (gameState.perks.transparency) { if (gameState.perks.transparency) {
coinsToSpawn = Math.round( coinsToSpawn = Math.ceil(
coinsToSpawn * coinsToSpawn *
(1 + (1 +
(ballTransparency(ball, gameState) * gameState.perks.transparency) / (ballTransparency(ball, gameState) * gameState.perks.transparency) /

View file

@ -416,7 +416,7 @@
"upgrades.trickledown.name": "Escorrentía", "upgrades.trickledown.name": "Escorrentía",
"upgrades.trickledown.tooltip": "Las monedas aparecen en la parte superior de la pantalla.", "upgrades.trickledown.tooltip": "Las monedas aparecen en la parte superior de la pantalla.",
"upgrades.trickledown.verbose_description": "Podría ayudarte a ahorrar algunas monedas. ", "upgrades.trickledown.verbose_description": "Podría ayudarte a ahorrar algunas monedas. ",
"upgrades.unbounded.name": "Liberado, entregado", "upgrades.unbounded.name": "Espacio libre",
"upgrades.unbounded.tooltip": "+{{lvl}} combo por ladrillo, más lados para mantener la pelota en juego, peligro", "upgrades.unbounded.tooltip": "+{{lvl}} combo por ladrillo, más lados para mantener la pelota en juego, peligro",
"upgrades.unbounded.verbose_description": "Espero que hayas encontrado la forma de mantener tu bola en la pantalla. En el nivel 2+, el techo también desaparecerá. Se trata de una ventaja avanzada.", "upgrades.unbounded.verbose_description": "Espero que hayas encontrado la forma de mantener tu bola en la pantalla. En el nivel 2+, el techo también desaparecerá. Se trata de una ventaja avanzada.",
"upgrades.viscosity.name": "Fluido viscoso", "upgrades.viscosity.name": "Fluido viscoso",

View file

@ -10,6 +10,8 @@ import { restart } from "./game";
import { describeLevel } from "./game_utils"; import { describeLevel } from "./game_utils";
const palette = _palette as Palette; const palette = _palette as Palette;
const MAX_LEVEL_SIZE = 21;
const MIN_LEVEL_SIZE = 2;
export function levelEditorMenuEntry() { export function levelEditorMenuEntry() {
const min = 10000; const min = 10000;
@ -72,7 +74,11 @@ async function openLevelEditorLevelsList() {
name ||= "Imported on " + new Date().toISOString().slice(0, 10); name ||= "Imported on " + new Date().toISOString().slice(0, 10);
credit ||= ""; credit ||= "";
const size = Math.sqrt(bricks.length); const size = Math.sqrt(bricks.length);
if (Math.floor(size) === size && size >= 2 && size <= 20) { if (
Math.floor(size) === size &&
size >= MIN_LEVEL_SIZE &&
size <= MAX_LEVEL_SIZE
) {
rawList.push({ rawList.push({
color: automaticBackgroundColor(bricks.split("")), color: automaticBackgroundColor(bricks.split("")),
size, size,
@ -163,12 +169,12 @@ export async function editRawLevelList(nth: number, color = "W") {
{ {
text: t("editor.editing.bigger"), text: t("editor.editing.bigger"),
value: "size:+1", value: "size:+1",
disabled: level.size > 20, disabled: level.size >= MAX_LEVEL_SIZE,
}, },
{ {
text: t("editor.editing.smaller"), text: t("editor.editing.smaller"),
value: "size:-1", value: "size:-1",
disabled: level.size < 3, disabled: level.size <= MIN_LEVEL_SIZE,
}, },
{ {
text: t("editor.editing.left"), text: t("editor.editing.left"),

View file

@ -425,20 +425,15 @@ export function render(gameState: GameState) {
startWork("render:combotext"); startWork("render:combotext");
if (gameState.combo > 1) { if (gameState.combo > 1) {
ctx.globalCompositeOperation = "source-over"; ctx.globalCompositeOperation = "source-over";
ctx.globalAlpha = 1;
const comboText = "x " + gameState.combo; const comboText = "x " + gameState.combo;
const comboTextWidth = (comboText.length * gameState.puckHeight) / 1.8; const comboTextWidth = (comboText.length * gameState.puckHeight) / 1.8;
const totalWidth = comboTextWidth + gameState.coinSize * 2; const totalWidth = comboTextWidth + gameState.coinSize * 2;
const left = gameState.puckPosition - totalWidth / 2; const left = gameState.puckPosition - totalWidth / 2;
ctx.globalAlpha = gameState.combo > baseCombo(gameState) ? 1 : 0.3;
if (totalWidth < gameState.puckWidth) { if (totalWidth < gameState.puckWidth) {
drawCoin(
ctx,
"#ffd300",
gameState.coinSize,
left + gameState.coinSize / 2,
gameState.gameZoneHeight - gameState.puckHeight / 2,
"#ffd300",
0,
);
drawText( drawText(
ctx, ctx,
comboText, comboText,
@ -448,6 +443,17 @@ export function render(gameState: GameState) {
gameState.gameZoneHeight - gameState.puckHeight / 2, gameState.gameZoneHeight - gameState.puckHeight / 2,
true, true,
); );
ctx.globalAlpha = 1;
drawCoin(
ctx,
"#ffd300",
gameState.coinSize,
left + gameState.coinSize / 2,
gameState.gameZoneHeight - gameState.puckHeight / 2,
"#ffd300",
0,
);
} else { } else {
drawText( drawText(
ctx, ctx,
@ -462,7 +468,7 @@ export function render(gameState: GameState) {
); );
} }
} }
startWork("render:Borders"); startWork("render:borders");
// Borders // Borders
ctx.globalCompositeOperation = "source-over"; ctx.globalCompositeOperation = "source-over";
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
@ -532,6 +538,7 @@ export function render(gameState: GameState) {
1, 1,
); );
startWork("render:bottom_line");
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
drawStraightLine( drawStraightLine(
ctx, ctx,
@ -567,10 +574,9 @@ export function render(gameState: GameState) {
ctx.imageSmoothingEnabled = false; ctx.imageSmoothingEnabled = false;
} }
startWork("render:breakout.lecaro.me?autoplay"); startWork("render:text_under_puck");
ctx.globalCompositeOperation = "source-over"; ctx.globalCompositeOperation = "source-over";
ctx.globalAlpha = 1; ctx.globalAlpha = 1;
if (isOptionOn("mobile-mode") && gameState.computer_controlled) { if (isOptionOn("mobile-mode") && gameState.computer_controlled) {
drawText( drawText(
ctx, ctx,
@ -582,7 +588,6 @@ export function render(gameState: GameState) {
(gameState.canvasHeight - gameState.gameZoneHeight) / 2, (gameState.canvasHeight - gameState.gameZoneHeight) / 2,
); );
} }
startWork("render:mobile_press_to_play");
if (isOptionOn("mobile-mode") && !gameState.running) { if (isOptionOn("mobile-mode") && !gameState.running) {
drawText( drawText(
ctx, ctx,

View file

@ -26,7 +26,7 @@ export function setSettingValue<T>(key: string, value: T) {
cachedSettings[key] = value; cachedSettings[key] = value;
} }
} }
setInterval(() => { export function commitSettingsChangesToLocalStorage() {
try { try {
for (let key of needsSaving) { for (let key of needsSaving) {
localStorage.setItem(key, JSON.stringify(cachedSettings[key])); localStorage.setItem(key, JSON.stringify(cachedSettings[key]));
@ -35,7 +35,8 @@ setInterval(() => {
} catch (e) { } catch (e) {
console.warn(e); console.warn(e);
} }
}, 500); }
setInterval(commitSettingsChangesToLocalStorage, 500);
export function getTotalScore() { export function getTotalScore() {
return getSettingValue("breakout_71_total_score", 0); return getSettingValue("breakout_71_total_score", 0);