mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-05-04 10:49: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,
|
||||
|
@ -732,24 +730,24 @@ h2.histogram-title strong {
|
|||
color: #8a8a8a;
|
||||
}
|
||||
|
||||
@palette_B:black;
|
||||
@palette_W:#FFFFFF;
|
||||
@palette_g:#231f20;
|
||||
@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_k:#618227;
|
||||
@palette_e:#e1c8b4;
|
||||
@palette_l:#9b9fa;
|
||||
@palette_B: black;
|
||||
@palette_W: #ffffff;
|
||||
@palette_g: #231f20;
|
||||
@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_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();
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -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,
|
||||
|
@ -347,13 +346,12 @@ export function escapeAttribute(str: String) {
|
|||
.replace(/'/gi, "'");
|
||||
}
|
||||
|
||||
export function canvasCenterX(gameState:GameState){
|
||||
return gameState.canvasWidth/2
|
||||
export function canvasCenterX(gameState: GameState) {
|
||||
return gameState.canvasWidth / 2;
|
||||
}
|
||||
export function zoneLeftBorderX(gameState:GameState){
|
||||
|
||||
return gameState.offsetXRoundedDown - 1
|
||||
export function zoneLeftBorderX(gameState: GameState) {
|
||||
return gameState.offsetXRoundedDown - 1;
|
||||
}
|
||||
export function zoneRightBorderX(gameState: GameState) {
|
||||
return gameState.canvasWidth - gameState.offsetXRoundedDown + 1;
|
||||
}
|
||||
export function zoneRightBorderX(gameState:GameState){
|
||||
return gameCanvas.width - 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)
|
||||
if(remaining>0 && remaining<5){
|
||||
ctx.globalAlpha=1
|
||||
ctx.globalCompositeOperation="destination-out";
|
||||
drawText(ctx, remaining.toString(), 'white', 65, gameState.canvasWidth/2, gameState.canvasHeight/2)
|
||||
if (gameState.winAt || gameState.startCountDown) {
|
||||
const remaining =
|
||||
gameState.startCountDown ||
|
||||
Math.ceil((gameState.winAt - gameState.levelTime) / 1000);
|
||||
if (remaining > 0 && remaining < 5) {
|
||||
ctx.globalAlpha = 1;
|
||||
ctx.globalCompositeOperation = "destination-out";
|
||||
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.globalCompositeOperation = "screen";
|
||||
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);
|
||||
|
|
10
src/toast.ts
10
src/toast.ts
|
@ -3,16 +3,16 @@ 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);
|
||||
}
|
||||
|
||||
export function clearToasts(){
|
||||
export function clearToasts() {
|
||||
if (timeout) {
|
||||
clearTimeout(timeout);
|
||||
timeout = undefined
|
||||
timeout = undefined;
|
||||
}
|
||||
div.classList = "hidden toast";
|
||||
}
|
||||
div.classList = "hidden toast";
|
||||
}
|
||||
|
|
2
src/types.d.ts
vendored
2
src/types.d.ts
vendored
|
@ -283,7 +283,7 @@ export type GameState = {
|
|||
rerolls: number;
|
||||
creative: boolean;
|
||||
startParams: RunParams;
|
||||
startCountDown:number;
|
||||
startCountDown: number;
|
||||
};
|
||||
|
||||
export type RunParams = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue