mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-21 20:46:14 -04:00
Build 29073274
This commit is contained in:
parent
a8e9fc6cb6
commit
613b7cce58
13 changed files with 2680 additions and 2648 deletions
|
@ -29,8 +29,8 @@ android {
|
||||||
applicationId = "me.lecaro.breakout"
|
applicationId = "me.lecaro.breakout"
|
||||||
minSdk = 21
|
minSdk = 21
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 29072514
|
versionCode = 29073274
|
||||||
versionName = "29072514"
|
versionName = "29073274"
|
||||||
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
7
dist/index.html
vendored
7
dist/index.html
vendored
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
||||||
// The version of the cache.
|
// The version of the cache.
|
||||||
const VERSION = "29072514";
|
const VERSION = "29073274";
|
||||||
|
|
||||||
// The name of the cache
|
// The name of the cache
|
||||||
const CACHE_NAME = `breakout-71-${VERSION}`;
|
const CACHE_NAME = `breakout-71-${VERSION}`;
|
||||||
|
|
|
@ -16,7 +16,7 @@ import {
|
||||||
sumOfValues,
|
sumOfValues,
|
||||||
} from "./game_utils";
|
} from "./game_utils";
|
||||||
import { getHistory } from "./gameOver";
|
import { getHistory } from "./gameOver";
|
||||||
import {noCreative} from "./upgrades";
|
import { noCreative } from "./upgrades";
|
||||||
|
|
||||||
export function creativeMode(gameState: GameState) {
|
export function creativeMode(gameState: GameState) {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
"29072514"
|
"29073274"
|
||||||
|
|
71
src/game.ts
71
src/game.ts
|
@ -134,15 +134,15 @@ export function pause(playerAskedForPause: boolean) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fitSize = (gameState:GameState) => {
|
export const fitSize = (gameState: GameState) => {
|
||||||
if(!gameState) throw new Error("Missign game state")
|
if (!gameState) throw new Error("Missign game state");
|
||||||
const past_off = gameState.offsetXRoundedDown,
|
const past_off = gameState.offsetXRoundedDown,
|
||||||
past_width = gameState.gameZoneWidthRoundedUp,
|
past_width = gameState.gameZoneWidthRoundedUp,
|
||||||
past_heigh = gameState.gameZoneHeight;
|
past_heigh = gameState.gameZoneHeight;
|
||||||
|
|
||||||
const width= window.innerWidth, height=window.innerHeight
|
const width = window.innerWidth,
|
||||||
|
height = window.innerHeight;
|
||||||
|
|
||||||
console.log('fitSize',width, height)
|
|
||||||
gameState.canvasWidth = width;
|
gameState.canvasWidth = width;
|
||||||
gameState.canvasHeight = height;
|
gameState.canvasHeight = height;
|
||||||
gameCanvas.width = width;
|
gameCanvas.width = width;
|
||||||
|
@ -153,21 +153,36 @@ export const fitSize = (gameState:GameState) => {
|
||||||
haloCanvas.height = height / haloScale;
|
haloCanvas.height = height / haloScale;
|
||||||
|
|
||||||
gameState.gameZoneHeight = isOptionOn("mobile-mode")
|
gameState.gameZoneHeight = isOptionOn("mobile-mode")
|
||||||
? Math.floor(height * .80) : height;
|
? Math.floor(height * 0.8)
|
||||||
|
: height;
|
||||||
|
|
||||||
const baseWidth = Math.round(
|
const baseWidth = Math.round(
|
||||||
Math.min(gameState.canvasWidth , gameState.gameZoneHeight * (0.73 )* (gameState.gridSize+gameState.perks.unbounded*2 ) / gameState.gridSize),
|
Math.min(
|
||||||
|
gameState.canvasWidth,
|
||||||
|
(gameState.gameZoneHeight *
|
||||||
|
0.73 *
|
||||||
|
(gameState.gridSize + gameState.perks.unbounded * 2)) /
|
||||||
|
gameState.gridSize,
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
gameState.brickWidth = Math.floor(baseWidth / (gameState.gridSize+gameState.perks.unbounded*2) / 2) * 2;
|
gameState.brickWidth =
|
||||||
|
Math.floor(
|
||||||
|
baseWidth / (gameState.gridSize + gameState.perks.unbounded * 2) / 2,
|
||||||
|
) * 2;
|
||||||
|
|
||||||
gameState.gameZoneWidth = gameState.brickWidth * gameState.gridSize;
|
gameState.gameZoneWidth = gameState.brickWidth * gameState.gridSize;
|
||||||
gameState.offsetX = Math.floor(
|
gameState.offsetX = Math.floor(
|
||||||
(gameState.canvasWidth - gameState.gameZoneWidth) / 2,
|
(gameState.canvasWidth - gameState.gameZoneWidth) / 2,
|
||||||
);
|
);
|
||||||
// Space between left side and border
|
// Space between left side and border
|
||||||
gameState.offsetXRoundedDown = gameState.offsetX - gameState.perks.unbounded*gameState.brickWidth;
|
gameState.offsetXRoundedDown =
|
||||||
if (gameState.offsetX < gameState.ballSize+gameState.perks.unbounded*2*gameState.brickWidth) gameState.offsetXRoundedDown = 0;
|
gameState.offsetX - gameState.perks.unbounded * gameState.brickWidth;
|
||||||
|
if (
|
||||||
|
gameState.offsetX <
|
||||||
|
gameState.ballSize + gameState.perks.unbounded * 2 * gameState.brickWidth
|
||||||
|
)
|
||||||
|
gameState.offsetXRoundedDown = 0;
|
||||||
gameState.gameZoneWidthRoundedUp = width - 2 * gameState.offsetXRoundedDown;
|
gameState.gameZoneWidthRoundedUp = width - 2 * gameState.offsetXRoundedDown;
|
||||||
backgroundCanvas.title = "resized";
|
backgroundCanvas.title = "resized";
|
||||||
// Ensure puck stays within bounds
|
// Ensure puck stays within bounds
|
||||||
|
@ -201,8 +216,8 @@ export const fitSize = (gameState:GameState) => {
|
||||||
`${window.innerHeight * 0.01}px`,
|
`${window.innerHeight * 0.01}px`,
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
window.addEventListener("resize", ()=>fitSize(gameState));
|
window.addEventListener("resize", () => fitSize(gameState));
|
||||||
window.addEventListener("fullscreenchange", ()=>fitSize(gameState));
|
window.addEventListener("fullscreenchange", () => fitSize(gameState));
|
||||||
|
|
||||||
setInterval(() => {
|
setInterval(() => {
|
||||||
// Sometimes, the page changes size without triggering the event (when switching to fullscreen, closing debug panel...)
|
// Sometimes, the page changes size without triggering the event (when switching to fullscreen, closing debug panel...)
|
||||||
|
@ -417,8 +432,8 @@ export function tick() {
|
||||||
normalizeGameState(gameState);
|
normalizeGameState(gameState);
|
||||||
|
|
||||||
if (gameState.running) {
|
if (gameState.running) {
|
||||||
gameState.levelTime += timeDeltaMs*frames;
|
gameState.levelTime += timeDeltaMs * frames;
|
||||||
gameState.runStatistics.runTime += timeDeltaMs*frames;
|
gameState.runStatistics.runTime += timeDeltaMs * frames;
|
||||||
gameStateTick(gameState, frames);
|
gameStateTick(gameState, frames);
|
||||||
}
|
}
|
||||||
if (gameState.running || gameState.needsRender) {
|
if (gameState.running || gameState.needsRender) {
|
||||||
|
@ -717,10 +732,7 @@ async function openSettingsMenu() {
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
await asyncAlert({
|
await asyncAlert({
|
||||||
title: t("settings.save_file_error"),
|
title: t("settings.save_file_error"),
|
||||||
content: [
|
content: [e.message, { text: t("settings.save_file_loaded_ok") }],
|
||||||
e.message,
|
|
||||||
{ text: t("settings.save_file_loaded_ok") },
|
|
||||||
],
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
input.value = "";
|
input.value = "";
|
||||||
|
@ -986,17 +998,20 @@ export function restart(params: RunParams) {
|
||||||
setLevel(gameState, 0);
|
setLevel(gameState, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
restart(window.location.search.includes('stress')?{
|
restart(
|
||||||
|
window.location.search.includes("stress")
|
||||||
perks:{
|
? {
|
||||||
bricks_attract_ball:2,
|
perks: {
|
||||||
superhot:1,
|
bricks_attract_ball: 2,
|
||||||
bricks_attract_coins:3,
|
superhot: 1,
|
||||||
hot_start:3,
|
bricks_attract_coins: 3,
|
||||||
pierce:3,
|
hot_start: 3,
|
||||||
rainbow:3
|
pierce: 3,
|
||||||
}
|
rainbow: 3,
|
||||||
}:{});
|
},
|
||||||
|
}
|
||||||
|
: {},
|
||||||
|
);
|
||||||
|
|
||||||
tick();
|
tick();
|
||||||
setupTooltips();
|
setupTooltips();
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -69,7 +69,7 @@ export function getNearestUnlockHTML(gameState: GameState) {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!firstUnlockable) return "";
|
if (!firstUnlockable) return "";
|
||||||
let missingPoints = Math.max(0,firstUnlockable.minScore - gameState.score);
|
let missingPoints = Math.max(0, firstUnlockable.minScore - gameState.score);
|
||||||
let missingUpgrades = firstUnlockable.missing.map((u) => u.name).join(", ");
|
let missingUpgrades = firstUnlockable.missing.map((u) => u.name).join(", ");
|
||||||
|
|
||||||
const title =
|
const title =
|
||||||
|
|
|
@ -329,9 +329,9 @@ export function render(gameState: GameState) {
|
||||||
ctx.fillStyle = gameState.puckColor;
|
ctx.fillStyle = gameState.puckColor;
|
||||||
for (let i = 0; i < gameState.perks.extra_life; i++) {
|
for (let i = 0; i < gameState.perks.extra_life; i++) {
|
||||||
ctx.fillRect(
|
ctx.fillRect(
|
||||||
gameState.offsetXRoundedDown,
|
gameState.offsetXRoundedDown,
|
||||||
gameState.gameZoneHeight - gameState.puckHeight / 2 + 2 * i,
|
gameState.gameZoneHeight - gameState.puckHeight / 2 + 2 * i,
|
||||||
gameState.gameZoneWidthRoundedUp,
|
gameState.gameZoneWidthRoundedUp,
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -444,18 +444,14 @@ export function render(gameState: GameState) {
|
||||||
// Borders
|
// Borders
|
||||||
|
|
||||||
ctx.globalCompositeOperation = "source-over";
|
ctx.globalCompositeOperation = "source-over";
|
||||||
ctx.globalAlpha = 1;
|
ctx.globalAlpha = 1;
|
||||||
|
|
||||||
let redLeftSide =
|
let redLeftSide =
|
||||||
hasCombo &&
|
hasCombo && (gameState.perks.left_is_lava || gameState.perks.trampoline);
|
||||||
(gameState.perks.left_is_lava || gameState.perks.trampoline);
|
|
||||||
let redRightSide =
|
let redRightSide =
|
||||||
hasCombo &&
|
hasCombo && (gameState.perks.right_is_lava || gameState.perks.trampoline);
|
||||||
(gameState.perks.right_is_lava || gameState.perks.trampoline);
|
|
||||||
let redTop =
|
let redTop =
|
||||||
hasCombo &&
|
hasCombo && (gameState.perks.top_is_lava || gameState.perks.trampoline);
|
||||||
(gameState.perks.top_is_lava || gameState.perks.trampoline);
|
|
||||||
|
|
||||||
|
|
||||||
if (gameState.offsetXRoundedDown) {
|
if (gameState.offsetXRoundedDown) {
|
||||||
// draw outside of gaming area to avoid capturing borders in recordings
|
// draw outside of gaming area to avoid capturing borders in recordings
|
||||||
|
@ -466,7 +462,8 @@ export function render(gameState: GameState) {
|
||||||
gameState.offsetXRoundedDown - 1,
|
gameState.offsetXRoundedDown - 1,
|
||||||
0,
|
0,
|
||||||
gameState.offsetXRoundedDown - 1,
|
gameState.offsetXRoundedDown - 1,
|
||||||
height, 1,
|
height,
|
||||||
|
1,
|
||||||
);
|
);
|
||||||
|
|
||||||
drawStraightLine(
|
drawStraightLine(
|
||||||
|
@ -477,7 +474,7 @@ export function render(gameState: GameState) {
|
||||||
0,
|
0,
|
||||||
width - gameState.offsetXRoundedDown + 1,
|
width - gameState.offsetXRoundedDown + 1,
|
||||||
height,
|
height,
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
drawStraightLine(
|
drawStraightLine(
|
||||||
|
@ -507,9 +504,9 @@ export function render(gameState: GameState) {
|
||||||
ctx,
|
ctx,
|
||||||
gameState,
|
gameState,
|
||||||
"#FF0000",
|
"#FF0000",
|
||||||
gameState.offsetXRoundedDown,
|
gameState.offsetXRoundedDown,
|
||||||
1,
|
1,
|
||||||
width - gameState.offsetXRoundedDown,
|
width - gameState.offsetXRoundedDown,
|
||||||
1,
|
1,
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { t } from "./i18n/i18n";
|
||||||
import { icons, upgrades } from "./loadGameData";
|
import { icons, upgrades } from "./loadGameData";
|
||||||
import { getSettingValue, getTotalScore, setSettingValue } from "./settings";
|
import { getSettingValue, getTotalScore, setSettingValue } from "./settings";
|
||||||
import { isOptionOn } from "./options";
|
import { isOptionOn } from "./options";
|
||||||
import {notStartingPerk} from "./upgrades";
|
import { notStartingPerk } from "./upgrades";
|
||||||
|
|
||||||
export function startingPerkMenuButton() {
|
export function startingPerkMenuButton() {
|
||||||
return {
|
return {
|
||||||
|
@ -20,15 +20,14 @@ export function startingPerkMenuButton() {
|
||||||
|
|
||||||
export function isBlackListedForStart(u: Upgrade) {
|
export function isBlackListedForStart(u: Upgrade) {
|
||||||
return !!(
|
return !!(
|
||||||
notStartingPerk.includes(u.id) ||
|
notStartingPerk.includes(u.id) ||
|
||||||
u.requires ||
|
u.requires ||
|
||||||
u.threshold > getTotalScore()
|
u.threshold > getTotalScore()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
export function isStartingPerk(u: Upgrade): boolean {
|
export function isStartingPerk(u: Upgrade): boolean {
|
||||||
return (
|
return (
|
||||||
!isBlackListedForStart(u) &&
|
!isBlackListedForStart(u) && getSettingValue("start_with_" + u.id, u.gift)
|
||||||
getSettingValue("start_with_" + u.id, u.gift)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
1638
src/upgrades.ts
1638
src/upgrades.ts
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue