mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-05-04 18:59:13 -04:00
wip
This commit is contained in:
parent
9e12f62b81
commit
892f800107
14 changed files with 2866 additions and 2840 deletions
|
@ -29,8 +29,8 @@ android {
|
|||
applicationId = "me.lecaro.breakout"
|
||||
minSdk = 21
|
||||
targetSdk = 34
|
||||
versionCode = 29104759
|
||||
versionName = "29104759"
|
||||
versionCode = 29104940
|
||||
versionName = "29104940"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
|
|
File diff suppressed because one or more lines are too long
1385
dist/index.html
vendored
1385
dist/index.html
vendored
File diff suppressed because one or more lines are too long
|
@ -1,5 +1,5 @@
|
|||
// The version of the cache.
|
||||
const VERSION = "29104759";
|
||||
const VERSION = "29104940";
|
||||
|
||||
// The name of the cache
|
||||
const CACHE_NAME = `breakout-71-${VERSION}`;
|
||||
|
|
|
@ -1 +1 @@
|
|||
"29104759"
|
||||
"29104940"
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
|
@ -642,7 +641,6 @@ h2.histogram-title strong {
|
|||
opacity: 0.8;
|
||||
transform: none;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.gridEdit > div > span,
|
||||
|
@ -733,23 +731,23 @@ h2.histogram-title strong {
|
|||
}
|
||||
|
||||
@palette_B: black;
|
||||
@palette_W:#FFFFFF;
|
||||
@palette_W: #ffffff;
|
||||
@palette_g: #231f20;
|
||||
@palette_y:#FFD300;
|
||||
@palette_b:#6262EA;
|
||||
@palette_t:#5DA3EA;
|
||||
@palette_s:#E67070;
|
||||
@palette_y: #ffd300;
|
||||
@palette_b: #6262ea;
|
||||
@palette_t: #5da3ea;
|
||||
@palette_s: #e67070;
|
||||
@palette_r: #e32119;
|
||||
@palette_R: #ab0c0c;
|
||||
@palette_c:#59EEA3;
|
||||
@palette_G:#A1F051;
|
||||
@palette_v:#A664E8;
|
||||
@palette_p:#E869E8;
|
||||
@palette_a:#5BECEC;
|
||||
@palette_C:#53EE53;
|
||||
@palette_S:#F44848;
|
||||
@palette_P:#E66BA8;
|
||||
@palette_O:#F29E4A;
|
||||
@palette_c: #59eea3;
|
||||
@palette_G: #a1f051;
|
||||
@palette_v: #a664e8;
|
||||
@palette_p: #e869e8;
|
||||
@palette_a: #5becec;
|
||||
@palette_C: #53ee53;
|
||||
@palette_S: #f44848;
|
||||
@palette_P: #e66ba8;
|
||||
@palette_O: #f29e4a;
|
||||
@palette_k: #618227;
|
||||
@palette_e: #e1c8b4;
|
||||
@palette_l: #9b9fa;
|
34
src/game.ts
34
src/game.ts
|
@ -254,34 +254,34 @@ let timers = [];
|
|||
function startPlayCountDown() {
|
||||
stopPlayCountDown();
|
||||
|
||||
gameState.startCountDown = 3;
|
||||
gameState.needsRender = true;
|
||||
|
||||
gameState.startCountDown = 3
|
||||
gameState.needsRender = true
|
||||
|
||||
timers.push(setTimeout(() => {
|
||||
gameState.startCountDown = 2
|
||||
gameState.needsRender = true
|
||||
}, 1000));
|
||||
timers.push(setTimeout(() => {
|
||||
gameState.startCountDown = 1
|
||||
gameState.needsRender = true
|
||||
}, 2000));
|
||||
timers.push(
|
||||
setTimeout(() => {
|
||||
gameState.startCountDown = 0
|
||||
gameState.startCountDown = 2;
|
||||
gameState.needsRender = true;
|
||||
}, 1000),
|
||||
);
|
||||
timers.push(
|
||||
setTimeout(() => {
|
||||
gameState.startCountDown = 1;
|
||||
gameState.needsRender = true;
|
||||
}, 2000),
|
||||
);
|
||||
timers.push(
|
||||
setTimeout(() => {
|
||||
gameState.startCountDown = 0;
|
||||
play();
|
||||
}, 3000),
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
function stopPlayCountDown() {
|
||||
if(!timers.length) return
|
||||
if (!timers.length) return;
|
||||
|
||||
gameState.startCountDown = 0
|
||||
gameState.startCountDown = 0;
|
||||
timers.forEach((id) => clearTimeout(id));
|
||||
timers.length = 0;
|
||||
|
||||
}
|
||||
gameCanvas.addEventListener("touchstart", (e) => {
|
||||
e.preventDefault();
|
||||
|
|
|
@ -37,10 +37,23 @@ import {t} from "./i18n/i18n";
|
|||
import { getCurrentMaxCoins, getCurrentMaxParticles } from "./settings";
|
||||
import { background } from "./render";
|
||||
import { gameOver } from "./gameOver";
|
||||
import {brickIndex, fitSize, gameState, hasBrick, hitsSomething, pause, startComputerControlledGame,} from "./game";
|
||||
import {
|
||||
brickIndex,
|
||||
fitSize,
|
||||
gameState,
|
||||
hasBrick,
|
||||
hitsSomething,
|
||||
pause,
|
||||
startComputerControlledGame,
|
||||
} from "./game";
|
||||
import { stopRecording } from "./recording";
|
||||
import { isOptionOn } from "./options";
|
||||
import {ballTransparency, clamp, coinsBoostedCombo, comboKeepingRate,} from "./pure_functions";
|
||||
import {
|
||||
ballTransparency,
|
||||
clamp,
|
||||
coinsBoostedCombo,
|
||||
comboKeepingRate,
|
||||
} from "./pure_functions";
|
||||
import { addToTotalScore } from "./addToTotalScore";
|
||||
import { hashCode } from "./getLevelBackground";
|
||||
import { openUpgradesPicker } from "./openUpgradesPicker";
|
||||
|
@ -568,8 +581,7 @@ export function addToScore(gameState: GameState, coin: Coin) {
|
|||
gameState.highScore = gameState.score;
|
||||
try {
|
||||
localStorage.setItem("breakout-3-hs-short", gameState.score.toString());
|
||||
} catch (e) {
|
||||
}
|
||||
} catch (e) {}
|
||||
}
|
||||
if (!isOptionOn("basic")) {
|
||||
makeParticle(
|
||||
|
@ -983,7 +995,7 @@ export function gameStateTick(
|
|||
|
||||
if (
|
||||
// Lost ball while waiting to win, will level up for fairness
|
||||
(gameState.winAt && !gameState.balls.find(b => !b.destroyed)) ||
|
||||
(gameState.winAt && !gameState.balls.find((b) => !b.destroyed)) ||
|
||||
// Delayed win when coins are still flying
|
||||
(gameState.winAt && gameState.levelTime > gameState.winAt) ||
|
||||
// instant win condition
|
||||
|
@ -1387,8 +1399,7 @@ export function gameStateTick(
|
|||
|
||||
if (gameState.perks.wind) {
|
||||
const windD =
|
||||
((gameState.puckPosition -
|
||||
canvasCenterX(gameState)) /
|
||||
((gameState.puckPosition - canvasCenterX(gameState)) /
|
||||
gameState.gameZoneWidth) *
|
||||
2 *
|
||||
gameState.perks.wind;
|
||||
|
@ -1697,9 +1708,18 @@ export function ballTick(gameState: GameState, ball: Ball, frames: number) {
|
|||
const d = Math.sqrt(ball.vy * ball.vy + ball.vx * ball.vx);
|
||||
ball.vy = Math.sin(angle) * d;
|
||||
ball.vx = Math.cos(angle) * d;
|
||||
if (Math.random() < frames && !isOptionOn('basic')) {
|
||||
makeParticle(gameState, ball.x, ball.y, -ball.vx / 10, -ball.vy / 10,
|
||||
'#6262EA', true, 8, 500)
|
||||
if (Math.random() < frames && !isOptionOn("basic")) {
|
||||
makeParticle(
|
||||
gameState,
|
||||
ball.x,
|
||||
ball.y,
|
||||
-ball.vx / 10,
|
||||
-ball.vy / 10,
|
||||
"#6262EA",
|
||||
true,
|
||||
8,
|
||||
500,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1885,8 +1905,11 @@ export function ballTick(gameState: GameState, ball: Ball, frames: number) {
|
|||
}
|
||||
// If you loose a ball while waiting to level up, setLevel is called and pauses the game
|
||||
// In that case it's ok to not have any ball, don't game over
|
||||
if (!gameState.balls.find((b) => !b.destroyed) && gameState.running && !gameState.winAt) {
|
||||
|
||||
if (
|
||||
!gameState.balls.find((b) => !b.destroyed) &&
|
||||
gameState.running &&
|
||||
!gameState.winAt
|
||||
) {
|
||||
if (gameState.startParams.computer_controlled) {
|
||||
startComputerControlledGame(gameState.startParams.stress);
|
||||
} else {
|
||||
|
@ -2022,7 +2045,6 @@ export function ballTick(gameState: GameState, ball: Ball, frames: number) {
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function justLostALife(gameState: GameState, ball: Ball, x: number, y: number) {
|
||||
|
|
|
@ -12,7 +12,6 @@ import { t } from "./i18n/i18n";
|
|||
import { clamp } from "./pure_functions";
|
||||
import { getSettingValue, getTotalScore } from "./settings";
|
||||
import { isOptionOn } from "./options";
|
||||
import {gameCanvas} from "./render";
|
||||
|
||||
export function describeLevel(level: Level) {
|
||||
let bricks = 0,
|
||||
|
@ -348,12 +347,11 @@ export function escapeAttribute(str: String) {
|
|||
}
|
||||
|
||||
export function canvasCenterX(gameState: GameState) {
|
||||
return gameState.canvasWidth/2
|
||||
return gameState.canvasWidth / 2;
|
||||
}
|
||||
export function zoneLeftBorderX(gameState: GameState) {
|
||||
|
||||
return gameState.offsetXRoundedDown - 1
|
||||
return gameState.offsetXRoundedDown - 1;
|
||||
}
|
||||
export function zoneRightBorderX(gameState: GameState) {
|
||||
return gameCanvas.width - gameState.offsetXRoundedDown + 1
|
||||
return gameState.canvasWidth - gameState.offsetXRoundedDown + 1;
|
||||
}
|
|
@ -9,8 +9,6 @@ import {
|
|||
levelTimeGood,
|
||||
missesBest,
|
||||
missesGood,
|
||||
wallBouncedBest,
|
||||
wallBouncedGood,
|
||||
} from "./pure_functions";
|
||||
|
||||
export function helpMenuEntry() {
|
||||
|
|
|
@ -95,9 +95,7 @@ export function firstWhere<Input, Output>(
|
|||
}
|
||||
}
|
||||
|
||||
export const wallBouncedBest = 2,
|
||||
wallBouncedGood = 7,
|
||||
levelTimeBest = 25,
|
||||
export const levelTimeBest = 25,
|
||||
levelTimeGood = 45,
|
||||
catchRateBest = 98,
|
||||
catchRateGood = 90,
|
||||
|
|
|
@ -10,7 +10,9 @@ import {
|
|||
max_levels,
|
||||
reachRedRowIndex,
|
||||
telekinesisEffectRate,
|
||||
yoyoEffectRate, zoneLeftBorderX, zoneRightBorderX,
|
||||
yoyoEffectRate,
|
||||
zoneLeftBorderX,
|
||||
zoneRightBorderX,
|
||||
} from "./game_utils";
|
||||
import { colorString, GameState } from "./types";
|
||||
import { t } from "./i18n/i18n";
|
||||
|
@ -26,8 +28,6 @@ import {
|
|||
levelTimeGood,
|
||||
missesBest,
|
||||
missesGood,
|
||||
wallBouncedBest,
|
||||
wallBouncedGood,
|
||||
} from "./pure_functions";
|
||||
|
||||
export const gameCanvas = document.getElementById("game") as HTMLCanvasElement;
|
||||
|
@ -642,21 +642,36 @@ export function render(gameState: GameState) {
|
|||
);
|
||||
}
|
||||
|
||||
|
||||
startWork("render:timeout");
|
||||
if (gameState.winAt || gameState.startCountDown) {
|
||||
const remaining = gameState.startCountDown || Math.ceil((gameState.winAt-gameState.levelTime)/1000)
|
||||
const remaining =
|
||||
gameState.startCountDown ||
|
||||
Math.ceil((gameState.winAt - gameState.levelTime) / 1000);
|
||||
if (remaining > 0 && remaining < 5) {
|
||||
ctx.globalAlpha=1
|
||||
ctx.globalAlpha = 1;
|
||||
ctx.globalCompositeOperation = "destination-out";
|
||||
drawText(ctx, remaining.toString(), 'white', 65, gameState.canvasWidth/2, gameState.canvasHeight/2)
|
||||
drawText(
|
||||
ctx,
|
||||
remaining.toString(),
|
||||
"white",
|
||||
65,
|
||||
gameState.canvasWidth / 2,
|
||||
gameState.canvasHeight / 2,
|
||||
);
|
||||
|
||||
ctx.globalCompositeOperation = "screen";
|
||||
ctx.globalAlpha=1/remaining
|
||||
drawText(ctx, remaining.toString(), 'white', 60, gameState.canvasWidth/2, gameState.canvasHeight/2)
|
||||
ctx.globalAlpha = 1 / remaining;
|
||||
drawText(
|
||||
ctx,
|
||||
remaining.toString(),
|
||||
"white",
|
||||
60,
|
||||
gameState.canvasWidth / 2,
|
||||
gameState.canvasHeight / 2,
|
||||
);
|
||||
}
|
||||
}
|
||||
ctx.globalAlpha=1
|
||||
ctx.globalAlpha = 1;
|
||||
|
||||
startWork("render:askForWakeLock");
|
||||
askForWakeLock(gameState);
|
||||
|
|
|
@ -3,7 +3,7 @@ div.classList = "hidden toast";
|
|||
document.body.appendChild(div);
|
||||
let timeout: NodeJS.Timeout | undefined;
|
||||
export function toast(html: string, className = "") {
|
||||
clearToasts()
|
||||
clearToasts();
|
||||
div.classList = "toast visible " + className;
|
||||
div.innerHTML = html;
|
||||
timeout = setTimeout(clearToasts, 1500);
|
||||
|
@ -12,7 +12,7 @@ export function toast(html: string, className = "") {
|
|||
export function clearToasts() {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
timeout = undefined
|
||||
timeout = undefined;
|
||||
}
|
||||
div.classList = "hidden toast";
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue