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

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

View file

@ -740,7 +740,7 @@
{
"name": "icon:unbounded",
"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": ""
},
{

View file

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

View file

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

View file

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

View file

@ -416,7 +416,7 @@
"upgrades.trickledown.name": "Escorrentía",
"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.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.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",

View file

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

View file

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

View file

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