mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-26 15:06:16 -04:00
wip
This commit is contained in:
parent
181e156f60
commit
0ec9cdf798
17 changed files with 2089 additions and 2227 deletions
|
@ -14,10 +14,13 @@ Break colourful bricks, catch bouncing coins and select powerful upgrades !
|
|||
# Changelog
|
||||
## To do
|
||||
|
||||
- rename hypnosis
|
||||
- more icons
|
||||
- save global stats locally (sum of broken bricks, paddle hits, misses,)
|
||||
|
||||
## Done
|
||||
|
||||
-
|
||||
- new level : Blinky by Big Goober
|
||||
- color coded perks (green = noob friendly, red = combo with reset condition)
|
||||
- removed : instant_upgrade
|
||||
- nerfed : helium : now need to be level 3 to have the same effect of keeping coins up
|
||||
|
|
|
@ -29,8 +29,8 @@ android {
|
|||
applicationId = "me.lecaro.breakout"
|
||||
minSdk = 21
|
||||
targetSdk = 34
|
||||
versionCode = 29088680
|
||||
versionName = "29088680"
|
||||
versionCode = 29088937
|
||||
versionName = "29088937"
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
useSupportLibrary = true
|
||||
|
|
File diff suppressed because one or more lines are too long
711
dist/index.html
vendored
711
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 = "29088680";
|
||||
const VERSION = "29088937";
|
||||
|
||||
// The name of the cache
|
||||
const CACHE_NAME = `breakout-71-${VERSION}`;
|
||||
|
|
|
@ -100,9 +100,9 @@ export async function openCreativeModePerksPicker() {
|
|||
"/" +
|
||||
(u.max + (creativeModePerks.limitless || 0)),
|
||||
value: u,
|
||||
className: ' upgrade '+(creativeModePerks[u.id]
|
||||
? " highlight"
|
||||
: " not-highlighed"),
|
||||
className:
|
||||
" upgrade " +
|
||||
(creativeModePerks[u.id] ? " highlight" : " not-highlighed"),
|
||||
tooltip: u.help(creativeModePerks[u.id] || 1),
|
||||
})),
|
||||
t("lab.select_level"),
|
||||
|
|
|
@ -436,7 +436,7 @@
|
|||
{
|
||||
"name": "icon:smaller_puck",
|
||||
"size": 8,
|
||||
"bricks": "_________tttttt__tttttt_____________W_____________________WW____"
|
||||
"bricks": "_________yyyyyy__yyyyyy_____________W_____________________WW____"
|
||||
},
|
||||
{
|
||||
"name": "icon:pierce",
|
||||
|
@ -446,7 +446,7 @@
|
|||
{
|
||||
"name": "icon:picky_eater",
|
||||
"size": 8,
|
||||
"bricks": "_rrr_______ry_____ryy_____r_y______yyy______________y_____WWWW__"
|
||||
"bricks": "_rrr_______rt_____rtt_____r_t______ttt_______W____________WWWW__"
|
||||
},
|
||||
{
|
||||
"name": "icon:metamorphosis",
|
||||
|
@ -456,12 +456,12 @@
|
|||
{
|
||||
"name": "icon:compound_interest",
|
||||
"size": 8,
|
||||
"bricks": "_________tttttt__ttt__t______y_____________W__y_________rrWWWrrr"
|
||||
"bricks": "_________tttttt__ttt__t_____W________________r___________WWW__r_"
|
||||
},
|
||||
{
|
||||
"name": "icon:hot_start",
|
||||
"size": 7,
|
||||
"bricks": "_______rry_rrryyr_ryryry_ryryyr_ryrrry_rrr_______"
|
||||
"bricks": "tt__ttt__t_trt_t__tttt_____ttttWttt________WWW___"
|
||||
},
|
||||
{
|
||||
"name": "icon:sapper",
|
||||
|
@ -472,7 +472,7 @@
|
|||
{
|
||||
"name": "icon:bigger_explosions",
|
||||
"size": 8,
|
||||
"bricks": "__O_______Oy_OO___OyOy__OyyyWBOO_OOWyyy__ByOyOO__yOOyBOO_OO_____"
|
||||
"bricks": "__O__Oy___Oyy_____OyOy__OyyyByOO_OOBBBy___yyByO__yOOy_OO_OO_____"
|
||||
},
|
||||
{
|
||||
"name": "icon:extra_levels",
|
||||
|
@ -537,12 +537,12 @@
|
|||
{
|
||||
"name": "icon:sturdy_bricks",
|
||||
"size": 7,
|
||||
"bricks": "ttbttttbtttbtt____W_____W_W___W___W_______WWW____"
|
||||
"bricks": "yyyyyyyyyyyyyy____W_____W_W___W___W_______WWW____"
|
||||
},
|
||||
{
|
||||
"name": "icon:respawn",
|
||||
"size": 9,
|
||||
"bricks": "tttt___ttttt__t__ttta_ttt_______________________________W_________________WWW"
|
||||
"bricks": "tttt___ttttt__t__tttt_ttt_t_____________________________W_________________WWW____"
|
||||
},
|
||||
{
|
||||
"name": "Elephant",
|
||||
|
@ -723,13 +723,13 @@
|
|||
{
|
||||
"name": "icon:helium",
|
||||
"size": 8,
|
||||
"bricks": "_y____y_yP____PyPP___yPPP____P_P_____P____y_y______y______WWW___",
|
||||
"bricks": "_y____y_yP____PyPP___yPPP____P_P_____P____________________WWW___",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"name": "icon:asceticism",
|
||||
"size": 8,
|
||||
"bricks": "_yyyyyy__yy__yy_____W_______r_________r____r_________r__WWW___r_",
|
||||
"bricks": "_tttttt__tt__tt_____W_______r______________r_________r_____WWW__",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -741,7 +741,7 @@
|
|||
{
|
||||
"name": "icon:shunt",
|
||||
"size": 8,
|
||||
"bricks": "_______y______yy______yy__yyyyyy__y__yyy_yy__yyy_yy__yyyyyy__yyy",
|
||||
"bricks": "_______y______yy______yy__yttyyy__y__yyy_yy__yyy_yy__yyyyyy__yyy",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -752,14 +752,14 @@
|
|||
},
|
||||
{
|
||||
"name": "icon:nbricks",
|
||||
"size": 6,
|
||||
"bricks": "yy__rryyy_yyyyyyyyyyyyyyyy_yyyrr__yy",
|
||||
"size": 7,
|
||||
"bricks": "________tttrt__ttr_r____________W__________WWW___",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"name": "icon:etherealcoins",
|
||||
"size": 11,
|
||||
"bricks": "_____y_________yyy________WWW________WWW_______yWWWy_____yyWWWyy____yyWWWyy____yyWWWyy____y_WyW_y_______W________________",
|
||||
"bricks": "_____y_________yyy________ttt________ttt_______yttty_____yytttyy____yytttyy____yytttyy____y__y__y________________________",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -771,25 +771,25 @@
|
|||
{
|
||||
"name": "icon:zen",
|
||||
"size": 12,
|
||||
"bricks": "________________bbbb_______bbbbbb_______bbbb________BrrB_______tttttt_____tttttttt_____tttttt______BrrrrB_____bbbbbbbb___bbbbbbbbbb___bbbbbbbb__",
|
||||
"bricks": "________________WWWW_______WWWWWW_______WWWW________BrrB_______tttttt_____tttttttt_____tttttt______BrrrrB_____WWWWWWWW___WWWWWWWWWW___WWWWWWWW__",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"name": "icon:sacrifice",
|
||||
"size": 9,
|
||||
"bricks": "__t___t___ttt_ttt_ttWWWWWttttWbWbWttttWWbWWtt_ttWWWtt___tWtWt_____ttt_______t____",
|
||||
"bricks": "__t___t___ttt_ttt_ttWWWWWttttWtWtWttttWWtWWtt_ttWWWtt___tWtWt_____ttt_______t____",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"name": "icon:trampoline",
|
||||
"size": 8,
|
||||
"bricks": "rrrrrrrrrttttttrrttttttrr______rr___W__rr______rr______r__yyy___",
|
||||
"bricks": "_r_r_r_rrtttttt__ttttttrr___________W__rr______________r__WWW___",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"name": "icon:ghost_coins",
|
||||
"size": 7,
|
||||
"bricks": "__yyy___yyyyy_yyOyOyyyyyyyyyyyOOOyyyyyyyyyyy_y_yy",
|
||||
"bricks": "__yyy___yyyyy_yy_y_yyyyyyyyyyy___yyyyyyyyyyy_y_yy",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -812,8 +812,8 @@
|
|||
},
|
||||
{
|
||||
"name": "icon:passive_income",
|
||||
"size": 7,
|
||||
"bricks": "_ttttt__ttt_t______W____y____________y_____rgggr_",
|
||||
"size": 8,
|
||||
"bricks": "_ttttt___ttt_t______yW_____________y______________ggg_______y___",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -849,7 +849,7 @@
|
|||
{
|
||||
"name": "icon:addiction",
|
||||
"size": 9,
|
||||
"bricks": "__________________________l__WWWWW_lWWWrrllllr_WWWWW_lr_______l__________________",
|
||||
"bricks": "__________________________t__WWWWW_tWWWrrttttr_WWWWW_tr_______t__________________",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -931,7 +931,7 @@
|
|||
{
|
||||
"name": "icon:fountain_toss",
|
||||
"size": 12,
|
||||
"bricks": "WWWWW_______WWWWW____y_________y______________y______y__y_____WWWWWWWW___WttttttttW_WtytttytyttWWtttyttttttWlWtyttttytWl_lWWWWWWWWl___llllllll__",
|
||||
"bricks": "_____________________y_________y______________y______y__y_____WWWWWWWW___WttttttttW_WtytttytyttWWtttyttttttWlWtyttttytWl_lWWWWWWWWl___llllllll__",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -1097,19 +1097,19 @@
|
|||
{
|
||||
"name": "icon:minefield",
|
||||
"size": 7,
|
||||
"bricks": "W__B__WWWBBBWWB__W__BBBWWWBBW__B__WWWBBBWW_______",
|
||||
"bricks": "yB___Byyy___yy__ByB____yyy__yB___Byyy___yy_______",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"name": "icon:side_flip",
|
||||
"size": 7,
|
||||
"bricks": "________ttttt__rttty__rttty__rttty__ttttt________",
|
||||
"bricks": "________rtttt__rtttt____________W__________WWW___",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"name": "icon:side_kick",
|
||||
"size": 7,
|
||||
"bricks": "________ttttt__ytttr__ytttr__ytttr__ttttt________",
|
||||
"bricks": "________ttttr__ttttr__________W______________WWW_",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -1145,13 +1145,13 @@
|
|||
{
|
||||
"name": "icon:trickledown",
|
||||
"size": 8,
|
||||
"bricks": "_ytttttt_________y_y_y__tttttt____________y_y_y___tttttt_y______",
|
||||
"bricks": "_ytttttt_________y___y__tttttt____________y___y___tttttt_y______",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"name": "icon:transparency",
|
||||
"size": 9,
|
||||
"bricks": "__W_W_W___________W_W_W_W_W_________W_W_W_W_W_________W_W_W_W_W___________W_W_W__",
|
||||
"bricks": "__W_W_W___________W_y_y_y_W_________W_y_y_y_W_________W_y_y_y_W___________W_W_W__",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -1163,7 +1163,7 @@
|
|||
{
|
||||
"name": "icon:bricks_attract_coins",
|
||||
"size": 7,
|
||||
"bricks": "_y__y___tttttyyttttt__ttttt_yttttty_ttttt___y__y_",
|
||||
"bricks": "_y__y___ttttt__ttttt__ttttt__ttttty_ttttt______y_",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -1175,13 +1175,13 @@
|
|||
{
|
||||
"name": "icon:hypnosis",
|
||||
"size": 8,
|
||||
"bricks": "___WW______WW_______ay_____c__a______c______y_______a_c____c_y_a",
|
||||
"bricks": "__________WW______WWy______y_y______y_y______y________y_________",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"name": "icon:bricks_attract_ball",
|
||||
"size": 8,
|
||||
"bricks": "llW_____ll_P________P________Pll____P_ll___P____llP_____ll_P____",
|
||||
"bricks": "ttW_____tt_P________P________Ptt____P_tt___P____ttP_____tt_P____",
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
|
@ -1331,7 +1331,7 @@
|
|||
{
|
||||
"name": "icon:buoy",
|
||||
"size": 7,
|
||||
"bricks": "___b______b_____bbb__abbbbbaaatttaaaaataaaaaaaaaa",
|
||||
"bricks": "___y______y_____yyy__tyyyyytttOOOtttttOtttttttttt",
|
||||
"svg": null,
|
||||
"color": ""
|
||||
},
|
||||
|
@ -1344,8 +1344,8 @@
|
|||
},
|
||||
{
|
||||
"name": "icon:three_cushion",
|
||||
"size": 8,
|
||||
"bricks": "BkkkkkkBk___W__kk__W_W_kk_W___WkkW___y_kk_W____kk__W___kBkkkkkkB",
|
||||
"size": 7,
|
||||
"bricks": "tttttttttttttt____r______r______r______r__B__WWW_",
|
||||
"svg": null,
|
||||
"color": ""
|
||||
},
|
||||
|
@ -1359,7 +1359,7 @@
|
|||
{
|
||||
"name": "icon:double_or_nothing",
|
||||
"size": 7,
|
||||
"bricks": "__yyy___yrrry_yOOOrOyyOOrOOyyOOOOOy_yOrOy___yyy__",
|
||||
"bricks": "__yyy___yyyyy_yyyyggyyyygggyyyggggy_ygggy___yyy__",
|
||||
"svg": null,
|
||||
"color": ""
|
||||
},
|
||||
|
@ -1394,8 +1394,15 @@
|
|||
{
|
||||
"name": "icon:happy_family",
|
||||
"size": 9,
|
||||
"bricks": "___________tt_tt____tt_tt____tt_tt__W_tt_tt_W__________W_____W____W_W____________",
|
||||
"bricks": "__tt_tt____tt_tt____tt_tt____________________W_______W__W_W_W___________rrrWWWrrr",
|
||||
"svg": null,
|
||||
"color": ""
|
||||
},
|
||||
{
|
||||
"color": "#115988",
|
||||
"size": 20,
|
||||
"bricks": "____________________________gggg______________ggrrrrgg___________grrrrrrrrg_________grrrrrrrrrrg_______grrrWWrrrrWWrg______grrWWWWrrWWWWg______grrWWbbrrWWbbg_____grrrWWbbrrWWbbrg____grrrrWWrrrrWWrrg____grrrrrrrrrrrrrrg____grrrrrrrrrrrrrrg____grrrrrrrrrrrrrrg____grrrrrrrrrrrrrrg____grrgrrrggrrrgrrg____grg_grg__grg_grg_____g___g____g___g_______________________________________________________________",
|
||||
"name": "Blinky",
|
||||
"credit": "Suggested by Big Goober. The red ghost, Blinky, from the arcade game \"Pac Man\""
|
||||
}
|
||||
]
|
|
@ -1 +1 @@
|
|||
"29088680"
|
||||
"29088937"
|
||||
|
|
|
@ -297,11 +297,8 @@ export async function openUpgradesPicker(gameState: GameState) {
|
|||
icon: string;
|
||||
value: PerkId | "reroll";
|
||||
help: string;
|
||||
className:string;
|
||||
}> = pickRandomUpgrades(
|
||||
gameState,
|
||||
3 + gameState.perks.one_more_choice ,
|
||||
);
|
||||
className: string;
|
||||
}> = pickRandomUpgrades(gameState, 3 + gameState.perks.one_more_choice);
|
||||
if (!actions.length) break;
|
||||
|
||||
if (gameState.rerolls)
|
||||
|
|
|
@ -607,8 +607,7 @@ export function pickRandomUpgrades(gameState: GameState, count: number) {
|
|||
icon: icons["icon:" + u.id],
|
||||
value: u.id as PerkId,
|
||||
help: u.help(gameState.perks[u.id] + 1),
|
||||
className: 'upgrade '
|
||||
|
||||
className: "upgrade ",
|
||||
}));
|
||||
}
|
||||
|
||||
|
@ -1183,7 +1182,10 @@ export function gameStateTick(
|
|||
Math.abs(coin.x - gameState.puckPosition) * 2 >
|
||||
gameState.puckWidth + coin.size;
|
||||
let dvy =
|
||||
frames * coin.weight * 0.8 * (flip ? 1-gameState.perks.helium*0.6 : 1);
|
||||
frames *
|
||||
coin.weight *
|
||||
0.8 *
|
||||
(flip ? 1 - gameState.perks.helium * 0.6 : 1);
|
||||
|
||||
if (gameState.perks.etherealcoins) {
|
||||
if (gameState.perks.helium) {
|
||||
|
|
|
@ -1,14 +1,19 @@
|
|||
import {icons, transformRawLevel} from "./loadGameData";
|
||||
import {t} from "./i18n/i18n";
|
||||
import {getSettingValue, getTotalScore, setSettingValue} from "./settings";
|
||||
import {asyncAlert} from "./asyncAlert";
|
||||
import {Palette, RawLevel} from "./types";
|
||||
import {levelIconHTML} from "./levelIcon";
|
||||
import { icons, transformRawLevel } from "./loadGameData";
|
||||
import { t } from "./i18n/i18n";
|
||||
import { getSettingValue, getTotalScore, setSettingValue } from "./settings";
|
||||
import { asyncAlert } from "./asyncAlert";
|
||||
import { Palette, RawLevel } from "./types";
|
||||
import { levelIconHTML } from "./levelIcon";
|
||||
|
||||
import _palette from "./data/palette.json";
|
||||
import {restart} from "./game";
|
||||
import {describeLevel} from "./game_utils";
|
||||
import {automaticBackgroundColor, levelCodeToRawLevel, MAX_LEVEL_SIZE, MIN_LEVEL_SIZE} from "./pure_functions";
|
||||
import { restart } from "./game";
|
||||
import { describeLevel } from "./game_utils";
|
||||
import {
|
||||
automaticBackgroundColor,
|
||||
levelCodeToRawLevel,
|
||||
MAX_LEVEL_SIZE,
|
||||
MIN_LEVEL_SIZE,
|
||||
} from "./pure_functions";
|
||||
|
||||
const palette = _palette as Palette;
|
||||
|
||||
|
@ -19,7 +24,7 @@ export function levelEditorMenuEntry() {
|
|||
icon: icons["icon:editor"],
|
||||
text: t("editor.title"),
|
||||
disabled,
|
||||
help: disabled ? t("editor.locked", {min}) : t("editor.help"),
|
||||
help: disabled ? t("editor.locked", { min }) : t("editor.help"),
|
||||
async value() {
|
||||
openLevelEditorLevelsList().then();
|
||||
},
|
||||
|
@ -62,7 +67,7 @@ async function openLevelEditorLevelsList() {
|
|||
value() {
|
||||
const code = prompt(t("editor.import_instruction"))?.trim();
|
||||
if (code) {
|
||||
const lvl = levelCodeToRawLevel(code)
|
||||
const lvl = levelCodeToRawLevel(code);
|
||||
if (lvl) {
|
||||
rawList.push(lvl);
|
||||
setSettingValue("custom_levels", rawList);
|
||||
|
@ -110,7 +115,7 @@ export async function editRawLevelList(nth: number, color = "W") {
|
|||
"</div>";
|
||||
|
||||
const clicked = await asyncAlert<string | null>({
|
||||
title: t("editor.editing.title", {name: level.name}),
|
||||
title: t("editor.editing.title", { name: level.name }),
|
||||
content: [
|
||||
t("editor.editing.color"),
|
||||
colorList,
|
||||
|
@ -267,4 +272,3 @@ export async function editRawLevelList(nth: number, color = "W") {
|
|||
setSettingValue("custom_levels", rawList);
|
||||
editRawLevelList(nth, color);
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,10 @@ import { getLevelBackground, hashCode } from "../getLevelBackground";
|
|||
import { createRoot } from "react-dom/client";
|
||||
import { useCallback, useEffect, useState } from "react";
|
||||
import { moveLevel, resizeLevel, setBrick } from "./levels_editor_util";
|
||||
import {levelCodeToRawLevel} from "../pure_functions";
|
||||
import {
|
||||
automaticBackgroundColor,
|
||||
levelCodeToRawLevel,
|
||||
} from "../pure_functions";
|
||||
|
||||
const backgrounds = _backgrounds as string[];
|
||||
|
||||
|
@ -91,12 +94,13 @@ function App() {
|
|||
height: 40,
|
||||
position: "absolute",
|
||||
}}
|
||||
>{ (color=="black" && '💣')||' '}</button>,
|
||||
>
|
||||
{(palette[bricks[index]] == "black" && "💣") || " "}
|
||||
</button>,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (
|
||||
<div key={li}>
|
||||
<input
|
||||
|
@ -141,7 +145,8 @@ function App() {
|
|||
className="level-bricks-preview"
|
||||
style={{
|
||||
width: size * 40,
|
||||
height: size * 40
|
||||
height: size * 40,
|
||||
background: automaticBackgroundColor(bricks.split("")),
|
||||
}}
|
||||
>
|
||||
{brickButtons}
|
||||
|
@ -163,7 +168,9 @@ function App() {
|
|||
border: "1px solid black",
|
||||
}}
|
||||
onClick={() => setSelected(code)}
|
||||
>{(color=='' && 'x') || (color=="black" && '💣')||' '}</button>
|
||||
>
|
||||
{(color == "" && "x") || (color == "black" && "💣") || " "}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
<button
|
||||
|
@ -191,13 +198,10 @@ function App() {
|
|||
id="import-level"
|
||||
onClick={() => {
|
||||
const code = prompt("Level Code ? ");
|
||||
if(!code) return;
|
||||
const l=levelCodeToRawLevel(code)
|
||||
if(!l)return;
|
||||
setLevels((list) => [
|
||||
...list,
|
||||
l
|
||||
]);
|
||||
if (!code) return;
|
||||
const l = levelCodeToRawLevel(code);
|
||||
if (!l) return;
|
||||
setLevels((list) => [...list, l]);
|
||||
}}
|
||||
>
|
||||
import
|
||||
|
|
|
@ -6,7 +6,7 @@ import { rawUpgrades } from "./upgrades";
|
|||
import { getLevelBackground } from "./getLevelBackground";
|
||||
import { levelIconHTML } from "./levelIcon";
|
||||
|
||||
import {automaticBackgroundColor} from "./pure_functions";
|
||||
import { automaticBackgroundColor } from "./pure_functions";
|
||||
|
||||
const palette = _palette as Palette;
|
||||
|
||||
|
@ -17,8 +17,7 @@ export const appVersion = _appVersion as string;
|
|||
export const icons = {} as { [k: string]: string };
|
||||
|
||||
export function transformRawLevel(level: RawLevel) {
|
||||
const splitBricks=level.bricks
|
||||
.split("")
|
||||
const splitBricks = level.bricks.split("");
|
||||
const bricks = splitBricks
|
||||
.map((c) => palette[c])
|
||||
.slice(0, level.size * level.size);
|
||||
|
@ -30,7 +29,7 @@ export function transformRawLevel(level: RawLevel) {
|
|||
bricks,
|
||||
bricksCount,
|
||||
icon,
|
||||
color: automaticBackgroundColor(splitBricks) ,
|
||||
color: automaticBackgroundColor(splitBricks),
|
||||
svg: getLevelBackground(level),
|
||||
sortKey: ((Math.random() + 3) / 3.5) * bricksCount,
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {Ball, GameState} from "./types";
|
||||
import { Ball, GameState } from "./types";
|
||||
|
||||
export function clamp(value: number, min: number, max: number) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
|
@ -114,26 +114,24 @@ export function automaticBackgroundColor(bricks: string[]) {
|
|||
}
|
||||
|
||||
export function levelCodeToRawLevel(code: string) {
|
||||
let [name, credit] = code.match(/\[([^\]]+)]/gi) || ["", ""];
|
||||
|
||||
let [name, credit] = code.match(/\[([^\]]+)]/gi);
|
||||
|
||||
let bricks = code
|
||||
.split(name)[1]
|
||||
.split(credit)[0]
|
||||
.replace(/\s/gi, "");
|
||||
let bricks = code.split(name)[1].split(credit)[0].replace(/\s/gi, "");
|
||||
name = name.slice(1, -1);
|
||||
credit = credit.slice(1, -1);
|
||||
name ||= "Imported on " + new Date().toISOString().slice(0, 10);
|
||||
credit ||= "";
|
||||
const size = Math.sqrt(bricks.length);
|
||||
if (Math.floor(size) === size &&
|
||||
if (
|
||||
Math.floor(size) === size &&
|
||||
size >= MIN_LEVEL_SIZE &&
|
||||
size <= MAX_LEVEL_SIZE)
|
||||
size <= MAX_LEVEL_SIZE
|
||||
)
|
||||
return {
|
||||
color: automaticBackgroundColor(bricks.split("")),
|
||||
size,
|
||||
bricks,
|
||||
name,
|
||||
credit,
|
||||
}
|
||||
};
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
import {baseCombo, forEachLiveOne, liveCount} from "./gameStateMutators";
|
||||
import { baseCombo, forEachLiveOne, liveCount } from "./gameStateMutators";
|
||||
import {
|
||||
brickCenterX,
|
||||
brickCenterY,
|
||||
|
@ -12,10 +12,10 @@ import {
|
|||
telekinesisEffectRate,
|
||||
yoyoEffectRate,
|
||||
} from "./game_utils";
|
||||
import {colorString, GameState} from "./types";
|
||||
import {t} from "./i18n/i18n";
|
||||
import {gameState, lastMeasuredFPS, startWork} from "./game";
|
||||
import {isOptionOn} from "./options";
|
||||
import { colorString, GameState } from "./types";
|
||||
import { t } from "./i18n/i18n";
|
||||
import { gameState, lastMeasuredFPS, startWork } from "./game";
|
||||
import { isOptionOn } from "./options";
|
||||
import {
|
||||
ballTransparency,
|
||||
catchRateBest,
|
||||
|
@ -63,7 +63,7 @@ export function render(gameState: GameState) {
|
|||
const level = currentLevelInfo(gameState);
|
||||
|
||||
const hasCombo = gameState.combo > baseCombo(gameState);
|
||||
const {width, height} = gameCanvas;
|
||||
const { width, height } = gameCanvas;
|
||||
if (!width || !height) return;
|
||||
|
||||
if (gameState.currentLevel || gameState.levelTime) {
|
||||
|
@ -180,7 +180,7 @@ export function render(gameState: GameState) {
|
|||
haloCanvasCtx.globalCompositeOperation = "screen";
|
||||
forEachLiveOne(gameState.particles, (flash, index) => {
|
||||
if (shouldSkip(index)) return;
|
||||
const {x, y, time, color, size, duration} = flash;
|
||||
const { x, y, time, color, size, duration } = flash;
|
||||
const elapsed = gameState.levelTime - time;
|
||||
haloCanvasCtx.globalAlpha =
|
||||
0.1 * Math.min(1, 2 - (elapsed / duration) * 2);
|
||||
|
@ -260,7 +260,7 @@ export function render(gameState: GameState) {
|
|||
ctx.fillStyle = level.color || "#000";
|
||||
ctx.fillRect(0, 0, width, height);
|
||||
forEachLiveOne(gameState.particles, (flash) => {
|
||||
const {x, y, time, color, size, duration} = flash;
|
||||
const { x, y, time, color, size, duration } = flash;
|
||||
const elapsed = gameState.levelTime - time;
|
||||
ctx.globalAlpha = Math.min(1, 2 - (elapsed / duration) * 2);
|
||||
drawBall(ctx, color, size, x, y);
|
||||
|
@ -272,7 +272,9 @@ export function render(gameState: GameState) {
|
|||
ctx.globalCompositeOperation = "source-over";
|
||||
const lastExplosionDelay = gameState.levelTime - gameState.lastExplosion + 5;
|
||||
|
||||
const shaked = lastExplosionDelay < 200 && !isOptionOn("basic") &&
|
||||
const shaked =
|
||||
lastExplosionDelay < 200 &&
|
||||
!isOptionOn("basic") &&
|
||||
// Otherwise, if you pause after an explosion, moving the mouses shakes the picture
|
||||
gameState.running;
|
||||
if (shaked) {
|
||||
|
@ -329,7 +331,7 @@ export function render(gameState: GameState) {
|
|||
startWork("render:lights");
|
||||
ctx.globalCompositeOperation = "screen";
|
||||
forEachLiveOne(gameState.lights, (flash) => {
|
||||
const {x, y, time, color, size, duration} = flash;
|
||||
const { x, y, time, color, size, duration } = flash;
|
||||
const elapsed = gameState.levelTime - time;
|
||||
ctx.globalAlpha = Math.min(1, 2 - (elapsed / duration) * 2) * 0.5;
|
||||
drawBrick(
|
||||
|
@ -346,7 +348,7 @@ export function render(gameState: GameState) {
|
|||
startWork("render:texts");
|
||||
ctx.globalCompositeOperation = "screen";
|
||||
forEachLiveOne(gameState.texts, (flash) => {
|
||||
const {x, y, time, color, size, duration} = flash;
|
||||
const { x, y, time, color, size, duration } = flash;
|
||||
const elapsed = gameState.levelTime - time;
|
||||
ctx.globalAlpha = Math.max(0, Math.min(1, 2 - (elapsed / duration) * 2));
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
|
@ -355,7 +357,7 @@ export function render(gameState: GameState) {
|
|||
|
||||
startWork("render:particles");
|
||||
forEachLiveOne(gameState.particles, (particle) => {
|
||||
const {x, y, time, color, size, duration} = particle;
|
||||
const { x, y, time, color, size, duration } = particle;
|
||||
const elapsed = gameState.levelTime - time;
|
||||
ctx.globalAlpha = Math.max(0, Math.min(1, 2 - (elapsed / duration) * 2));
|
||||
ctx.globalCompositeOperation = "screen";
|
||||
|
@ -567,7 +569,7 @@ export function render(gameState: GameState) {
|
|||
startWork("render:bottom_line");
|
||||
ctx.globalAlpha = 1;
|
||||
const corner = getCornerOffset(gameState);
|
||||
const bottomLineIsRed = hasCombo && gameState.perks.compound_interest
|
||||
const bottomLineIsRed = hasCombo && gameState.perks.compound_interest;
|
||||
drawStraightLine(
|
||||
ctx,
|
||||
gameState,
|
||||
|
@ -653,7 +655,6 @@ function drawStraightLine(
|
|||
y2,
|
||||
alpha = 1,
|
||||
) {
|
||||
|
||||
ctx.globalAlpha = alpha;
|
||||
if (!mode) return;
|
||||
|
||||
|
@ -663,7 +664,7 @@ function drawStraightLine(
|
|||
y2 = Math.round(y2);
|
||||
|
||||
if (mode == "#FF0000") {
|
||||
ctx.strokeStyle='red'
|
||||
ctx.strokeStyle = "red";
|
||||
ctx.lineDashOffset = getDashOffset(gameState);
|
||||
ctx.lineWidth = 2;
|
||||
ctx.setLineDash(redBorderDash);
|
||||
|
@ -675,7 +676,12 @@ function drawStraightLine(
|
|||
ctx.lineWidth = 1;
|
||||
} else {
|
||||
ctx.fillStyle = mode;
|
||||
ctx.fillRect(Math.min(x1,x2), Math.min(y1,y2), Math.max(1, Math.abs(x1-x2)), Math.max(1, Math.abs(y1-y2)), )
|
||||
ctx.fillRect(
|
||||
Math.min(x1, x2),
|
||||
Math.min(y1, y2),
|
||||
Math.max(1, Math.abs(x1 - x2)),
|
||||
Math.max(1, Math.abs(y1 - y2)),
|
||||
);
|
||||
}
|
||||
|
||||
if (mode == "#FF0000") {
|
||||
|
@ -695,7 +701,7 @@ export function renderAllBricks() {
|
|||
hasCombo && gameState.perks.picky_eater && isPickyEatingPossible(gameState);
|
||||
|
||||
const redRowReach = reachRedRowIndex(gameState);
|
||||
const {clairvoyant} = gameState.perks;
|
||||
const { clairvoyant } = gameState.perks;
|
||||
let offset = getDashOffset(gameState);
|
||||
if (
|
||||
!(
|
||||
|
|
|
@ -18,10 +18,7 @@ export function startingPerkMenuButton() {
|
|||
}
|
||||
|
||||
export function isBlackListedForStart(u: Upgrade) {
|
||||
return !!(
|
||||
u.requires ||
|
||||
u.threshold > getTotalScore()
|
||||
);
|
||||
return !!(u.requires || u.threshold > getTotalScore());
|
||||
}
|
||||
export function isStartingPerk(u: Upgrade): boolean {
|
||||
return (
|
||||
|
@ -38,7 +35,7 @@ export async function openStartingPerksEditor() {
|
|||
text: u.name,
|
||||
tooltip: u.help(1),
|
||||
value: [u],
|
||||
checked
|
||||
checked,
|
||||
};
|
||||
});
|
||||
const checkedList = buttons.filter((b) => b.checked);
|
||||
|
|
872
src/upgrades.ts
872
src/upgrades.ts
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue