mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-06-18 12:15:04 -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"
|
applicationId = "me.lecaro.breakout"
|
||||||
minSdk = 21
|
minSdk = 21
|
||||||
targetSdk = 34
|
targetSdk = 34
|
||||||
versionCode = 29104759
|
versionCode = 29104940
|
||||||
versionName = "29104759"
|
versionName = "29104940"
|
||||||
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
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.
|
// The version of the cache.
|
||||||
const VERSION = "29104759";
|
const VERSION = "29104940";
|
||||||
|
|
||||||
// The name of the cache
|
// The name of the cache
|
||||||
const CACHE_NAME = `breakout-71-${VERSION}`;
|
const CACHE_NAME = `breakout-71-${VERSION}`;
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
"29104759"
|
"29104940"
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
|
@ -642,7 +641,6 @@ h2.histogram-title strong {
|
||||||
opacity: 0.8;
|
opacity: 0.8;
|
||||||
transform: none;
|
transform: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.gridEdit > div > span,
|
.gridEdit > div > span,
|
||||||
|
@ -732,24 +730,24 @@ h2.histogram-title strong {
|
||||||
color: #8a8a8a;
|
color: #8a8a8a;
|
||||||
}
|
}
|
||||||
|
|
||||||
@palette_B:black;
|
@palette_B: black;
|
||||||
@palette_W:#FFFFFF;
|
@palette_W: #ffffff;
|
||||||
@palette_g:#231f20;
|
@palette_g: #231f20;
|
||||||
@palette_y:#FFD300;
|
@palette_y: #ffd300;
|
||||||
@palette_b:#6262EA;
|
@palette_b: #6262ea;
|
||||||
@palette_t:#5DA3EA;
|
@palette_t: #5da3ea;
|
||||||
@palette_s:#E67070;
|
@palette_s: #e67070;
|
||||||
@palette_r:#e32119;
|
@palette_r: #e32119;
|
||||||
@palette_R:#ab0c0c;
|
@palette_R: #ab0c0c;
|
||||||
@palette_c:#59EEA3;
|
@palette_c: #59eea3;
|
||||||
@palette_G:#A1F051;
|
@palette_G: #a1f051;
|
||||||
@palette_v:#A664E8;
|
@palette_v: #a664e8;
|
||||||
@palette_p:#E869E8;
|
@palette_p: #e869e8;
|
||||||
@palette_a:#5BECEC;
|
@palette_a: #5becec;
|
||||||
@palette_C:#53EE53;
|
@palette_C: #53ee53;
|
||||||
@palette_S:#F44848;
|
@palette_S: #f44848;
|
||||||
@palette_P:#E66BA8;
|
@palette_P: #e66ba8;
|
||||||
@palette_O:#F29E4A;
|
@palette_O: #f29e4a;
|
||||||
@palette_k:#618227;
|
@palette_k: #618227;
|
||||||
@palette_e:#e1c8b4;
|
@palette_e: #e1c8b4;
|
||||||
@palette_l:#9b9fa;
|
@palette_l: #9b9fa;
|
||||||
|
|
34
src/game.ts
34
src/game.ts
|
@ -254,34 +254,34 @@ let timers = [];
|
||||||
function startPlayCountDown() {
|
function startPlayCountDown() {
|
||||||
stopPlayCountDown();
|
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(
|
timers.push(
|
||||||
setTimeout(() => {
|
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();
|
play();
|
||||||
}, 3000),
|
}, 3000),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
function stopPlayCountDown() {
|
function stopPlayCountDown() {
|
||||||
if(!timers.length) return
|
if (!timers.length) return;
|
||||||
|
|
||||||
gameState.startCountDown = 0
|
gameState.startCountDown = 0;
|
||||||
timers.forEach((id) => clearTimeout(id));
|
timers.forEach((id) => clearTimeout(id));
|
||||||
timers.length = 0;
|
timers.length = 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
gameCanvas.addEventListener("touchstart", (e) => {
|
gameCanvas.addEventListener("touchstart", (e) => {
|
||||||
e.preventDefault();
|
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 { clamp } from "./pure_functions";
|
||||||
import { getSettingValue, getTotalScore } from "./settings";
|
import { getSettingValue, getTotalScore } from "./settings";
|
||||||
import { isOptionOn } from "./options";
|
import { isOptionOn } from "./options";
|
||||||
import {gameCanvas} from "./render";
|
|
||||||
|
|
||||||
export function describeLevel(level: Level) {
|
export function describeLevel(level: Level) {
|
||||||
let bricks = 0,
|
let bricks = 0,
|
||||||
|
@ -347,13 +346,12 @@ export function escapeAttribute(str: String) {
|
||||||
.replace(/'/gi, "'");
|
.replace(/'/gi, "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
export function canvasCenterX(gameState:GameState){
|
export function canvasCenterX(gameState: GameState) {
|
||||||
return gameState.canvasWidth/2
|
return gameState.canvasWidth / 2;
|
||||||
}
|
}
|
||||||
export function zoneLeftBorderX(gameState:GameState){
|
export function zoneLeftBorderX(gameState: GameState) {
|
||||||
|
return gameState.offsetXRoundedDown - 1;
|
||||||
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,
|
levelTimeGood,
|
||||||
missesBest,
|
missesBest,
|
||||||
missesGood,
|
missesGood,
|
||||||
wallBouncedBest,
|
|
||||||
wallBouncedGood,
|
|
||||||
} from "./pure_functions";
|
} from "./pure_functions";
|
||||||
|
|
||||||
export function helpMenuEntry() {
|
export function helpMenuEntry() {
|
||||||
|
|
|
@ -95,9 +95,7 @@ export function firstWhere<Input, Output>(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const wallBouncedBest = 2,
|
export const levelTimeBest = 25,
|
||||||
wallBouncedGood = 7,
|
|
||||||
levelTimeBest = 25,
|
|
||||||
levelTimeGood = 45,
|
levelTimeGood = 45,
|
||||||
catchRateBest = 98,
|
catchRateBest = 98,
|
||||||
catchRateGood = 90,
|
catchRateGood = 90,
|
||||||
|
|
|
@ -10,7 +10,9 @@ import {
|
||||||
max_levels,
|
max_levels,
|
||||||
reachRedRowIndex,
|
reachRedRowIndex,
|
||||||
telekinesisEffectRate,
|
telekinesisEffectRate,
|
||||||
yoyoEffectRate, zoneLeftBorderX, zoneRightBorderX,
|
yoyoEffectRate,
|
||||||
|
zoneLeftBorderX,
|
||||||
|
zoneRightBorderX,
|
||||||
} from "./game_utils";
|
} from "./game_utils";
|
||||||
import { colorString, GameState } from "./types";
|
import { colorString, GameState } from "./types";
|
||||||
import { t } from "./i18n/i18n";
|
import { t } from "./i18n/i18n";
|
||||||
|
@ -26,8 +28,6 @@ import {
|
||||||
levelTimeGood,
|
levelTimeGood,
|
||||||
missesBest,
|
missesBest,
|
||||||
missesGood,
|
missesGood,
|
||||||
wallBouncedBest,
|
|
||||||
wallBouncedGood,
|
|
||||||
} from "./pure_functions";
|
} from "./pure_functions";
|
||||||
|
|
||||||
export const gameCanvas = document.getElementById("game") as HTMLCanvasElement;
|
export const gameCanvas = document.getElementById("game") as HTMLCanvasElement;
|
||||||
|
@ -642,21 +642,36 @@ export function render(gameState: GameState) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
startWork("render:timeout");
|
startWork("render:timeout");
|
||||||
if(gameState.winAt || gameState.startCountDown){
|
if (gameState.winAt || gameState.startCountDown) {
|
||||||
const remaining = gameState.startCountDown || Math.ceil((gameState.winAt-gameState.levelTime)/1000)
|
const remaining =
|
||||||
if(remaining>0 && remaining<5){
|
gameState.startCountDown ||
|
||||||
ctx.globalAlpha=1
|
Math.ceil((gameState.winAt - gameState.levelTime) / 1000);
|
||||||
ctx.globalCompositeOperation="destination-out";
|
if (remaining > 0 && remaining < 5) {
|
||||||
drawText(ctx, remaining.toString(), 'white', 65, gameState.canvasWidth/2, gameState.canvasHeight/2)
|
ctx.globalAlpha = 1;
|
||||||
|
ctx.globalCompositeOperation = "destination-out";
|
||||||
|
drawText(
|
||||||
|
ctx,
|
||||||
|
remaining.toString(),
|
||||||
|
"white",
|
||||||
|
65,
|
||||||
|
gameState.canvasWidth / 2,
|
||||||
|
gameState.canvasHeight / 2,
|
||||||
|
);
|
||||||
|
|
||||||
ctx.globalCompositeOperation="screen";
|
ctx.globalCompositeOperation = "screen";
|
||||||
ctx.globalAlpha=1/remaining
|
ctx.globalAlpha = 1 / remaining;
|
||||||
drawText(ctx, remaining.toString(), 'white', 60, gameState.canvasWidth/2, gameState.canvasHeight/2)
|
drawText(
|
||||||
|
ctx,
|
||||||
|
remaining.toString(),
|
||||||
|
"white",
|
||||||
|
60,
|
||||||
|
gameState.canvasWidth / 2,
|
||||||
|
gameState.canvasHeight / 2,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.globalAlpha=1
|
ctx.globalAlpha = 1;
|
||||||
|
|
||||||
startWork("render:askForWakeLock");
|
startWork("render:askForWakeLock");
|
||||||
askForWakeLock(gameState);
|
askForWakeLock(gameState);
|
||||||
|
|
10
src/toast.ts
10
src/toast.ts
|
@ -3,16 +3,16 @@ div.classList = "hidden toast";
|
||||||
document.body.appendChild(div);
|
document.body.appendChild(div);
|
||||||
let timeout: NodeJS.Timeout | undefined;
|
let timeout: NodeJS.Timeout | undefined;
|
||||||
export function toast(html: string, className = "") {
|
export function toast(html: string, className = "") {
|
||||||
clearToasts()
|
clearToasts();
|
||||||
div.classList = "toast visible " + className;
|
div.classList = "toast visible " + className;
|
||||||
div.innerHTML = html;
|
div.innerHTML = html;
|
||||||
timeout = setTimeout(clearToasts, 1500);
|
timeout = setTimeout(clearToasts, 1500);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function clearToasts(){
|
export function clearToasts() {
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
clearTimeout(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;
|
rerolls: number;
|
||||||
creative: boolean;
|
creative: boolean;
|
||||||
startParams: RunParams;
|
startParams: RunParams;
|
||||||
startCountDown:number;
|
startCountDown: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RunParams = {
|
export type RunParams = {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue