diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 65925f0..0b57dde 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -29,8 +29,8 @@ android {
applicationId = "me.lecaro.breakout"
minSdk = 21
targetSdk = 34
- versionCode = 29072514
- versionName = "29072514"
+ versionCode = 29073274
+ versionName = "29073274"
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables {
useSupportLibrary = true
diff --git a/app/src/main/assets/index.html b/app/src/main/assets/index.html
index 9297fce..e91dc60 100644
--- a/app/src/main/assets/index.html
+++ b/app/src/main/assets/index.html
@@ -1 +1 @@
-
Breakout 71
\ No newline at end of file
+Breakout 71
\ No newline at end of file
diff --git a/dist/index.html b/dist/index.html
index 28687ee..5105233 100644
--- a/dist/index.html
+++ b/dist/index.html
@@ -751,7 +751,6 @@ const fitSize = (gameState)=>{
if (!gameState) throw new Error("Missign game state");
const past_off = gameState.offsetXRoundedDown, past_width = gameState.gameZoneWidthRoundedUp, past_heigh = gameState.gameZoneHeight;
const width = window.innerWidth, height = window.innerHeight;
- console.log('fitSize', width, height);
gameState.canvasWidth = width;
gameState.canvasHeight = height;
(0, _render.gameCanvas).width = width;
@@ -760,7 +759,7 @@ const fitSize = (gameState)=>{
(0, _render.backgroundCanvas).height = height;
(0, _render.haloCanvas).width = width / (0, _render.haloScale);
(0, _render.haloCanvas).height = height / (0, _render.haloScale);
- gameState.gameZoneHeight = (0, _options.isOptionOn)("mobile-mode") ? Math.floor(height * .80) : height;
+ gameState.gameZoneHeight = (0, _options.isOptionOn)("mobile-mode") ? Math.floor(height * 0.8) : height;
const baseWidth = Math.round(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.gameZoneWidth = gameState.brickWidth * gameState.gridSize;
@@ -1377,7 +1376,7 @@ function restart(params) {
(0, _recording.pauseRecording)();
(0, _gameStateMutators.setLevel)(gameState, 0);
}
-restart(window.location.search.includes('stress') ? {
+restart(window.location.search.includes("stress") ? {
perks: {
bricks_attract_ball: 2,
superhot: 1,
@@ -1442,7 +1441,7 @@ module.exports = JSON.parse("{\"_\":\"\",\"B\":\"black\",\"W\":\"#FFFFFF\",\"g\"
module.exports = JSON.parse('[{"name":"71 mini","size":5,"bricks":"bbb____bt__btt__b_t___ttt","svg":1,"color":""},{"name":"Butterfly","bricks":"_________bb_t_t_bbbbb_t_bbbbbbbtbbbb_bbbtbbb____btb____bbbtbbb__bb_t_bb__________","size":9,"svg":2,"color":""},{"name":"Castle","size":7,"bricks":"s_s_s_ssssssssssBBBssssBBBssttbbbttttbbbtttbtbtbt","svg":3,"color":""},{"name":"Eyes","size":9,"bricks":"ttttttt__tWWWWWWW_tWrrWttW_tWWWWWWW_ttttttt_____t______ttttt____ttttt_____t_t","svg":4,"color":"","credit":"My favorite character in https://nuclearthrone.com/"},{"name":"Creeper","size":10,"bricks":"___________ccGGccGG__cGccGcGc__GBBccBBc__cBBGcBBc__GccBBGGc__ccBBBBcG__GGBBBBcG__cGBccBGc___________","svg":5,"credit":"https://en.wikipedia.org/wiki/Creeper_(Minecraft)","color":""},{"name":"Stairs","size":8,"bricks":"tt______tt______bbtt____bbtt____vvbbtt__vvbbtt__ppvvbbttppvvbbtt","svg":6,"color":""},{"name":"Dots","size":9,"bricks":"b_t_a_c_c__________b_t_a_c__________P_b_t_a_c__________P_b_t_a__________P_P_b_t_a","svg":7,"color":""},{"name":"Lines","size":9,"bricks":"aaaaaaaa___________tttttttt_________aaaaaaaa___________tttttttt_________aaaaaaaa","svg":8,"color":""},{"name":"Heart","size":15,"bricks":"__________________RRR___RRR_____RSSSR_RSSSR___RSWWSSRSSSSSR__RSWSSSSSSSSSR__RSSSSSSSSSSSR__RSWSSSSSSSSSR___RSSSSSSSSSR_____RSSSSSSSR_______RSSSSSR_________RSSSR___________RSR_____________R____________________________________","svg":17,"color":"","credit":"https://www.youtube.com/watch?v=gdWiTfzXb1g"},{"name":"Swiss","size":7,"bricks":"________RRRRR__RRWRR__RWWWR__RRWRR__RRRRR________","svg":13,"color":""},{"name":"Germany","size":4,"bricks":"____ggggrrrryyyy","svg":8,"color":"#5da3ea"},{"name":"France","size":6,"bricks":"______ttWWrrttWWrrttWWrrttWWrrttWWrr","svg":null,"color":""},{"name":"Smiley","size":8,"bricks":"_________yy__yy__yy__yy__________________yyyyyy___yyyy__________","svg":29,"color":""},{"name":"Labyrinthe","size":11,"bricks":"_______tttS_Stttt_S________t___S__Stt_ttttt____t_____S__ttt_S_S____t___t_tttt_t_S_t____tSt_t_t_Sttt___t_t_____Sttt_tttttS","svg":21},{"name":"Temple","size":11,"bricks":"_______________WWW______WWWWWWW___WWWWWWWWW___b_b_b_b____b_b_b_b____v_v_v_v____P_P_P_P____P_P_P_P____WWWWWWW___WWWWWWWWW_","svg":null,"color":""},{"name":"Pacman","size":12,"bricks":"____yyyy______yyyyyyyy___yyyyByyyyy__yyyyyyyyy__yyyyyyyy____yyyyyy______yyyyyy___S_Syyyyyyyy_____yyyyyyyyy___yyyyyyyyyy___yyyyyyyy______yyyy","svg":7,"color":"","credit":"https://en.wikipedia.org/wiki/Pacman"},{"name":"Ship","size":11,"bricks":"____sWW________sWWW_______sWWW_______s___OOOOOOOOOOOOOO_OBOBOBOBOO__OOOOOOOO_bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb___________","svg":19},{"name":"We come in peace","size":13,"bricks":"________________a_____a_______a___a_______aaaaaaa_____aaBaaaBaa___aaaaaaaaaaa__aaaaaaaaaaa__a_aaaaaaa_a__a_a_____a_a_____aa_aa_____________________________","svg":29,"color":"","credit":"https://en.wikipedia.org/wiki/Space_invaders"},{"name":"Space mushroom","size":10,"bricks":"______________WW_______WWWW_____WWWWWW___WWBWWBWW__WWWWWWWW____W__W_____W_WW_W___W_W__W_W","svg":6,"color":"","credit":"https://en.wikipedia.org/wiki/Space_invaders"},{"name":"Wololo","size":9,"bricks":"____WW_OOW___WW__OWW__W___OWWWbbbW_WWW_WbW_WOW__WWb__OW__bbb__O___W_W__O___W_W__O","svg":null,"color":"","credit":"https://aoe.heavengames.com/theacademy/unitsboatsandbuildings/priest/"},{"name":"Small heart","size":15,"bricks":"________________________________RRRR___RRRR___RrWWrR_RWWrrR__RWWrrrRWWrrrR__RrrrrrrrrrrrR__RrrrrrrrrrrrR___RrrrrrrrrrR_____RrrrrrrrR_______RrrrrrR_________RrrrR___________RrR_____________R______________________","svg":29,"color":""},{"name":"Eye","size":9,"bricks":"____________ggg_____gWWWg___gWbbbWg_gWWbBbWWg_gWbbbWg___gWWWg_____ggg____________","svg":null,"color":"#5da3ea"},{"name":"Enderman","size":10,"bricks":"___________gggggggg__gggggggg__gggggggg__gggggggg__vvvggvvv__gggggggg__gggggggg__gggggggg_____________________","svg":null,"color":"#154b07","credit":"https://minecraft.wiki/w/Enderman"},{"name":"Mushroom","size":16,"bricks":"_____________________rrrrWW________WWrrrrWWWW_____WWrrrrrrWWWW____WrrWWWWrrWWW___rrrWWWWWWrrrrr__rrrWWWWWWrrWWr__WrrWWWWWWrWWWW__WWrrWWWWrrWWWW__WWrrrrrrrrrWWr__WrrWWWWWWWWrrr_____WWBWWBWW_______WWWBWWBWWW______WWWWWWWWWW_______WWWWWWWW____________________","svg":null,"color":"","credit":"https://pixelartmaker.com/art/cce4295a92035ea"},{"name":"Tulip","size":11,"bricks":"______________R_R_R______RRRRR______RRRRR______RRRRR_______RRR_________k________k_k_k______k_k_k_______kkk_________k________________","svg":17,"color":""},{"name":"Chain","size":7,"bricks":"yyy____yBy____yyyyy____yBy____yyyyy____yBy____yyy","svg":31,"color":""},{"name":"Marion","size":9,"bricks":"rr_____rr_rr___rr__rrr_rrr__rrrrrrr__rr_r_rr__rr___rr__rr___rr__rr___rr_rrr___rrr","svg":27,"color":""},{"name":"Renan","size":9,"bricks":"yyyyyyy___yyyyyyy__yy___yy__yy___yy__yyyyyy___yy_yy____yy__yy___yy___yy_yyy___yyy","svg":3,"color":""},{"name":"Violet Pairs","size":8,"bricks":"b_b_b_b_b_b_b_b__________t_t_t_t_t_t_t_t________b_b_b_b_b_b_b_b","svg":5,"color":""},{"name":"Red Cups","size":11,"bricks":"___________rBr_rBr_rBrrrr_rrr_rrr___________r_rBr_rBr_rr_rrr_rrr_r___________rBr_rBr_rBrrrr_rrr_rrr__________","svg":23,"color":""},{"name":"Cactus","size":10,"bricks":"____G______rG_Gk______G_Gk______kkkk_r_____kkk_G______GkGk_____rGkk_______Gk________kk________kk_____","svg":27,"color":""},{"name":"Sunny Face","size":11,"bricks":"____yyy______yyyyyyy___yyyyyyyyy__yyyyyyyyy_yyyWWyWWyyyyyyyyyyyyyyyyyyyyyyyyy_yyWWWWWyy__yyyWWWyyy___yyyyyyy______yyy","svg":null,"color":"#5da3ea"},{"name":"Mountain","size":9,"bricks":"_______________W_______WWW______GGWW__W_GGGGG_kkkGGGGG_kkkkGGGGkkkkkGGGGkkkkkkGGG_________","svg":15,"color":""},{"name":"Dollar","size":17,"bricks":"________________________G_G______________G_G____________GGGGGGG_________GGGGGGGGG_______GG__G_G__GG______GG__G_G__GG______GG__G_G___________GGGGGGGG__________GGGGGGGG___________G_G__GG______GG__G_G__GG______GG__G_G__GG_______GGGGGGGGG_________GGGGGGG____________G_G______________G_G________________________","svg":null,"color":""},{"name":"Waves","size":8,"bricks":"___bbb____bbb____bbttbbbbbttbbbbttttaatttttaattttaaaaaaa","svg":20,"color":""},{"name":"Box","size":8,"bricks":"yyyyyyyyy______yy_bbbb_yy_b__b_yy_b__b_yy_bbbb_yy______yyyyyyyyy","svg":30,"color":"","squared":false},{"name":"Rose","size":9,"bricks":"__SS______SSSS_____SSSS_____SSSS______SS_k______k_kk_____kk_k______kk________k","svg":17,"color":""},{"name":"Time","size":9,"bricks":"__________WWWWWWW___WWWWW_____yyy_______y________y_______WyW_____WyyyW___yyyyyyy__________","svg":9,"color":"","squared":false},{"name":"Watermelon","size":8,"bricks":"_____Sk_____SSBk___SBSSk__SSSSSk_SSBSSk_SBSSSSk_kSSSkk___kkk____","svg":28,"color":""},{"name":"Worms","size":13,"bricks":"___sssss_______sssssss______WWsWWsss_____WBsBWsss_____WBsBWsss_____WWsWWsss_____sssssss_______ssssss_____WWWWWWss_______WssWs__s_____ssss__sss___sssssssssss__sssssssss_ss","svg":null,"color":"","squared":false,"credit":"https://en.wikipedia.org/wiki/Worms_(series)"},{"name":"Ocean Sunrise","size":8,"bricks":"SSSSSSSSSSSyySSSSSyyyySSSyyyyyySbttttttbbbttttbbbbbttbbbbbbbbbbb","svg":12,"color":""},{"name":"Crosses","size":13,"bricks":"b___b___b___b__v___v___v___vvv_vvv_vvv___v___v___v__p___p___p___ppp_ppp_ppp_ppp___p___p___p__P___P___P___PPP_PPP_PPP___P___P___P__p___p___p___ppp_ppp_ppp_ppp___p___p___p","svg":10,"color":""},{"name":"Negative space","size":9,"bricks":"tttttttttt_t_t_t_t_________b_b_b_b_bbbbbbbbbb_b_b_b_b___________t_t_t_t_ttttttttt_________","svg":null},{"name":"UK","size":11,"bricks":"brbbWrWbbrbbbrbWrWbrbbbbbrWrWrbbbWWWWWrWWWWWrrrrrrrrrrrWWWWWrWWWWWbbbrWrWrbbbbbrbWrWbrbbbrbbWrWbbrb__________","svg":null,"color":""},{"name":"Greece","size":11,"bricks":"ttWttttttttttWttWWWWWWWWWWWttttttttWttWWWWWWttWttttttttWWWWWWWWWWWtttttttttttWWWWWWWWWWWttttttttttt__________","svg":null,"color":""},{"name":"Russia","size":8,"bricks":"________WWWWWWWWWWWWWWWWttttttttttttttttrrrrrrrrrrrrrrrr________________","svg":null,"color":""},{"name":"Ukraine","size":8,"bricks":"________ttttttttttttttttttttttttyyyyyyyyyyyyyyyyyyyyyyyy________","svg":null,"color":""},{"name":"Poland","size":7,"bricks":"________WWWWW__WWWWW__rrrrr__rrrrr_______________","svg":null,"color":""},{"name":"Yellow 71","size":9,"bricks":"_________yyyyy__yyyyyyy_yyy___yy__yy__yyy__yy_yyy___yy_yy____yy_yy____yy__________________","svg":26,"color":""},{"name":"71 on white","size":6,"bricks":"WWWWWWrrrWWrWWrWrrWrWWWrWrWWWrWWWWWW______","svg":null},{"name":"Blue 71","size":8,"bricks":"ttttt__bttttt_bb___ttbbb__tt__bb__tt__bb_tt___bb_tt___bb_tt___bb","svg":null,"color":""},{"name":"Seventy one","size":21,"bricks":"rr_yy_rrry_yrrry_yrrrr_ry_yr__y_yr_ry_y_r_rr_yy_rr_yy_r_ry_y_r_r_ry_yr__y_yr_ry_y_r_rr_y_yrrry_yrrryyy_r_yyy__________________y______________r_____yyyrrry_yrrryyyrr_y_y__yrr_y_yrr_y_yr__y_yyyyrrr_y_rrry_yrrryyy____________________yrrryyyrrr_________yy_r_ry_yrr_____________rrry_yrrryyyyyyyyyyyy_____________________________________________________________________________________________________________________________","svg":null},{"name":"B71","size":10,"bricks":"__________bbbtttt_b_b__b__tbb_b__b__t_b_bbb__t__b_b__b_t__b_b__bt___b_bbb_t__bbb__________","svg":null},{"name":"Pig","size":9,"bricks":"__________PP___PP__PPP_PPP__WWPPPWW__WBPPPBW__PPsssPP__PsBsBsP__PPsssPP___________","svg":null},{"name":"Big Pig","size":15,"bricks":"________________sss_______sss__ss__sssss__ss____sssssssss_____sWBsssssBWs___ssBBsssssBBss__ssss_____ssss__sss_sssss_sss__sss_sBsBs_sss__sss_sssss_sss___sss_____sss____sssssssssss__GGGsssssssssGGGGGGsGsssssGsGGGGGGssGGGGGssGGG_______________","svg":2,"color":""},{"name":"Donkey Kong","size":9,"bricks":"OOr__a___OOr__a___ppppppp_O______a________a____pppppppr_a______b_a___O__ppppppp__","svg":null,"color":""},{"name":"Banana","size":12,"bricks":"_________________e__________eee_________eee_________eee_________eeeyy_____yyeeyyyy___yyyyey_yC___yy_yyy___C_____yyyy_________yyyy_________yyyy","svg":null},{"name":"Fox","size":8,"bricks":"e______eee_OO_eeeeOOOOeeeOBOOBOeOOOOOOOO_WWBBWW___WWWW_____WW___","svg":null},{"name":"Wiki","size":10,"bricks":"_______________________GGGG_____GGkkGG___GkggggkG__GgWWWWgG__GkggggkG___GGkkGG_____GGGG_______________________","svg":null,"color":"#1c71d8"},{"name":"Baby Dog","size":8,"bricks":"_______W__eeeeWWWWeeWeWWWeBWeBeeeeWWWWee_eWBBWe__eWWWWe____WW___","svg":null},{"name":"dog 21","size":9,"bricks":"__________O_____O_OOOWWWOOOOOWWWWWOOOOeWWWWOO_eBeWWBW__eBeWWBW___eWBWW_____WRW____________","svg":null,"credit":"https://prohama.com/dog-21-pattern/"},{"name":"icon:extra_life","size":9,"bricks":"___________rr_rr___rrrrrrr_rrrrrrrrrrrrrrrrrr_rrrrrrr___rrrrr_____rrr_______r_____________","svg":null},{"name":"icon:streak_shots","size":8,"bricks":"_W_W_W__W_W_W_W_tttttt_WttttttW________W______W______W_____WWWW_","svg":null},{"name":"icon:base_combo","size":7,"bricks":"________bbbbb__bybyb__bbbbb__bybyb__bbbbb________","svg":null},{"name":"icon:slow_down","size":10,"bricks":"_____________kk_______kkkk_____kkkkkkGG__kkkkkkGBG_kkkkkkGGGGkkkkkkGG__GGGGGG____GG__GG_____________","svg":null},{"name":"icon:bigger_puck","size":8,"bricks":"_________tttttt__tttttt______________________W___________WWWWWW_","svg":null},{"name":"icon:viscosity","size":8,"bricks":"________tt______bbtt__ttbbbbttbbbtbbtbbbbbtbbtbbbbbybbybbbbbbbbb","svg":null},{"name":"icon:left_is_lava","size":8,"bricks":"r_______rtttttt_rtttttt_r_______r_______r____W__r_______r_WWW___","svg":null},{"name":"icon:right_is_lava","size":8,"bricks":"_______r_ttttttr_ttttttr_______r_______r_____W_r_______r__WWW__r","svg":null},{"name":"icon:telekinesis","size":8,"bricks":"_____PW_____s______P______s_______P_______s_______P_____WWWWW","svg":null},{"name":"icon:top_is_lava","size":8,"bricks":"rrrrrrrr_tttttt__tttttt____________________W_______________WWW__","svg":null},{"name":"icon:coin_magnet","size":8,"bricks":"__y__y_yy_________y_y_y_y________y_y______________y______WWW____","svg":null},{"name":"icon:skip_last","size":5,"bricks":"_ttt_t_t_ttt_ttt_t_t_ttt_","svg":null},{"name":"icon:multiball","size":8,"bricks":"_________tttttt__tttttt___________W__W____________________WWW___","svg":null},{"name":"icon:smaller_puck","size":8,"bricks":"_________tttttt__tttttt_____________W_____________________WW____","svg":null},{"name":"icon:pierce","size":6,"bricks":"ttttttttttWtttt__ttt__ttt__ttt__tttt","svg":null},{"name":"icon:picky_eater","size":8,"bricks":"_rrr_______ry_____ryy_____r_y______yyy______________y_____WWWW__","svg":null},{"name":"icon:metamorphosis","size":8,"bricks":"aaaaaa__aaaa__________W___________ttaatt__tttttt_________WWW","svg":null},{"name":"icon:compound_interest","size":8,"bricks":"_________tttttt__ttt__t______y_____________W__y_________rrWWWrrr","svg":null},{"name":"icon:hot_start","size":7,"bricks":"ttttttttttt_tt_____W_____y_y_____y_____y_y_WWW_y_","svg":null},{"name":"icon:sapper","size":9,"bricks":"_____WW______W__W_tttWttt_yttgggtt__tgggggt__tgggggt__tgggggt__ttgggtt__ttttttt___________","svg":null,"color":"#000000"},{"name":"icon:bigger_explosions","size":8,"bricks":"__r_______ry_rr___ryry__ryyyW_rr_rrWyyy___yryrr__yrry_rr_rr","svg":null},{"name":"icon:extra_levels","size":6,"bricks":"__________b__t_bb_ttt_b__t_bbb____________","svg":null},{"name":"icon:pierce_color","size":8,"bricks":"bb___bbbb__b_bbb_____bbb____bbbbb____bbbbb____bbbbb____bbbbb____","svg":null},{"name":"icon:soft_reset","size":9,"bricks":"__rr______rrr_yy__rrrr_yyy_rrrr_yyyy_____yyyy_yyyyyyyy_yyyyyyyy__yyyyyy____yyyy__","svg":null},{"name":"icon:ball_repulse_ball","size":8,"bricks":"WsP__PsWs______sP______P________________P______Ps______sWsP__PsW","svg":null},{"name":"icon:ball_attract_ball","size":8,"bricks":"__P__P____s__s__PsW__WsP________________PsW__WsP__s__s____P__P__","svg":null},{"name":"icon:puck_repulse_ball","size":8,"bricks":"__________________W_______s___W___P__s______P____________WWW__","svg":null},{"name":"A","size":7,"bricks":"__ttt___ttttt_ttt_ttttt___ttttttttttt___tttt___tt","svg":null},{"name":"B","size":9,"bricks":"_bbbbb_____bb_bb____bb_bb____bb_bb____bbbb_____bb_bb____bb_bb____bb_bb___bbbbb____","svg":null},{"name":"C","size":8,"bricks":"__rrrr___rrrrrr_rrr___rrrr______rr______rrr___rr_rrrrrr___rrrr","svg":null},{"name":"D","size":8,"bricks":"_GGGGG____GG__G___GG__GG__GG__GG__GG__GG__GG__GG__GG__G__GGGGG","svg":null},{"name":"e","size":8,"bricks":"__tttt___tttttt_tt____tttt____tttttttttttt_______tt__tt___tttt_","svg":null},{"name":"icon:wind","size":9,"bricks":"_ss______s___PPPP_s_________sssssss___________sssssss_s________s___PPPP__ss","svg":null},{"name":"icon:sturdy_bricks","size":7,"bricks":"ttbttttbtttbtt____W_____W_W___W___W_______WWW____","svg":null},{"name":"icon:respawn","size":9,"bricks":"tttt___ttttt__t__ttta_ttt_______________________________W_________________WWW","svg":null},{"name":"Elephant","size":18,"bricks":"_________________________llll_________lll_llllll_lll___lsssllllllllsssl__lsssllllllllsssl__lsssllBllBllsssl__lssllWllllWllssl___ll__llllll__ll_________llll_______________ll______________llll______________ll________________________________________________________________________________________________________________________________________","svg":25,"color":"","credit":"https://prohama.com/elephant-5-pattern/"},{"name":"Orca","size":20,"bricks":"____________________________________________________________________________________________ggggg____ggg_ggg___ggggggg____ggggg___ggggggggg____ggg___ggggWggWWW_____gggggggggggWWWW_____ggggggggggWWWWW_____gggggggggWWWWW_______gggggggWWWWW___________WWggWWW______________ggg_gg______________gg__g__________________________________________________________________________________________________________","svg":null,"color":"#1c71d8","credit":"https://prohama.com/whale-2-pattern/"},{"name":"Shark","size":17,"bricks":"__________________________________________g_______________ggg____________ggggggg_________ggggggggg_______ggggggggggg_____gggggWWWggggg____gBgWWWWWWWgBg___ggWWWWrWrWWWWgg__ggWWWrrrrrWWWgg_ggWWWrrrrrrrWWWggggWWrrrrrrrrrWWgggWWWrWrWrWrWrWWWggWWrrWWWWWWWrrWWggWWWWWWWWWWWWWWWg_________________","svg":null,"color":"#3584e4","credit":"https://prohama.com/shark-2-pattern/"},{"name":"Bird","size":13,"bricks":"_______RRR____R____RSSSR___RR__RSSWWWR__RSR_RSWWBWR__RSSRRSWWWWyy_RSSSRSWWWR___RSSSSSSRR_____RRSSyyyy______RSyyyyy___RRRRSyyyy____RSSSRyyy_____RRRR______________________","svg":null,"color":"","credit":"https://prohama.com/bird-1-size-13x12/"},{"name":"Tux","size":14,"bricks":"_____gggg________gggggggg_____gggggggggg____gggggggggg___gggggggggggg__gggWBggWBggg__gggBBggBBggg__ggggyyyygggg_ggggggyyggggggggggWWWWWWggggg_gWWWWWWWWg_g__WWWWWWWWWW____WWWWWWWWWW____yyy____yyy__","svg":null,"color":"#62a0ea","credit":"https://prohama.com/pingwin-4-pattern/"},{"name":"Armenia","size":6,"bricks":"_______rrrr__bbbb__yyyy_____________","svg":null,"color":""},{"name":"Austria","size":6,"bricks":"_______rrrr__WWWW__rrrr______","svg":null,"color":""},{"name":"Benin","size":8,"bricks":"_________kkyyyy__kkyyyy__kkrrrr__kkrrrr__________________________","svg":null,"color":""},{"name":"Botswana","size":10,"bricks":"___________tttttttt__tttttttt__tttttttt__WWWWWWWW__BBBBBBBB__WWWWWWWW__tttttttt__tttttttt__tttttttt___________","svg":null,"color":""},{"name":"Bulgaria","size":6,"bricks":"_______WWWW__cccc__rrrr_____________","svg":null,"color":""},{"name":"Canada","size":7,"bricks":"________rWWWr__rWrWr__rWWWr______________________","svg":null,"color":""},{"name":"Chad","size":8,"bricks":"_________bbyyRR__bbyyRR__bbyyRR","svg":null,"color":""},{"name":"China","size":6,"bricks":"______RRyRRRRyRyRRRRyRRRRRRRRR______","svg":null,"color":""},{"name":"Colombia","size":7,"bricks":"________yyyyy__yyyyy__bbbbb__RRRRR_______________","svg":null,"color":""},{"name":"Republic of the Congo","size":7,"bricks":"________kkkyy__kkyyr__kyyrr__yyrrr_______________","svg":null,"color":""},{"name":"C\xf4te d\'Ivoire","size":8,"bricks":"_________OOWWGG__OOWWGG__OOWWGG","svg":null,"color":""},{"name":"Denmark","size":8,"bricks":"_________rrWrrr__rrWrrr__WWWWWW__rrWrrr__rrWrrr","svg":null,"color":""},{"name":"El Salvador","size":8,"bricks":"_________bbbbbb__bbbbbb__WWWkWW__WWkWWW__bbbbbb__bbbbbb","svg":null,"color":""},{"name":"Egypt","size":8,"bricks":"_________RRRRRR__RRRRRR__WWWyWW__WWyWWW__gggggg__gggggg","svg":null,"color":"#1c71d8"},{"name":"Estonia","size":8,"bricks":"_________tttttt__tttttt__gggggg__gggggg__WWWWWW__WWWWWW","svg":null,"color":"#26a269"},{"name":"Finland","size":6,"bricks":"_______WtWW__tttt__WtWW_____________","svg":null,"color":""},{"name":"Gabon","size":5,"bricks":"______CCC__yyy__ttt______","svg":null,"color":""},{"name":"Georgia","size":9,"bricks":"__________WrWrWrW__WWWrWWW__rrrrrrr__WWWrWWW__WrWrWrW__________________","svg":null,"color":""},{"name":"Guinea","size":8,"bricks":"_________rryycc__rryycc__rryycc","svg":null,"color":""},{"name":"Indonesia","size":6,"bricks":"_______rrrr__rrrr__WWWW__WWWW_______","svg":null,"color":""},{"name":"icon:one_more_choice","size":7,"bricks":"ttt____tbbb___tbttt__tbtbbb__btbbb___tbbb____bbb_","svg":null},{"name":"icon:instant_upgrade","size":5,"bricks":"ttt__tbbb_tbbb_tbbb__bbb_","svg":null},{"name":"icon:checkmark_checked","size":6,"bricks":"_ggggbgBBBbbbbBbbggbbbBggBbBBg_gggg_","svg":null},{"name":"icon:checkmark_unchecked","size":6,"bricks":"_gggg_gBBBBggBBBBggBBBBggBBBBg_gggg_","svg":null},{"name":"icon:concave_puck","size":7,"bricks":"___W_____________W__________W__W__WWW___WWWWWWWWW","svg":null,"color":""},{"name":"icon:helium","size":8,"bricks":"v______vvv____vvv______vv______vv______vv______vv______v__WWWW__","svg":null,"color":""},{"name":"icon:asceticism","size":8,"bricks":"_________y____y____W____y______y_________y____y_________y_WWWW_y","svg":null,"color":""},{"name":"icon:unbounded","size":9,"bricks":"WWWWWWWWWW_r_r_r_WWrtttttrWW_ttttt_WWr_____rWW_______WWr___W_rWW_______WWrWWW__rW","svg":null,"color":""},{"name":"icon:shunt","size":8,"bricks":"_______y______yy______yy__yCCyyy__y__yyy_yy__yyy_yy__yyyyyy__yyy","svg":null,"color":""},{"name":"icon:yoyo","size":8,"bricks":"_rrrrrr_rrrrrrrrrrrrrrrr_WWWWWW_rWrrrrrrrrWrrrrr_rrWrrr_____W___","svg":null,"color":""},{"name":"icon:nbricks","size":6,"bricks":"yy__yyyyy_yyyyyyyyyyyyyyyy_yyyyy__yy","svg":null,"color":""},{"name":"icon:etherealcoins","size":11,"bricks":"_____v_________vvv________ttt________ttt_______vtttv_____vvtttvv____vvtttvv____vvtttvv____v_ryr_v_______r________________","svg":null,"color":""},{"name":"icon:shocks","size":8,"bricks":"_r__r_r_rWWWyy_r_WWW__r_yWWWyry_y_ryyy_rry__WWW___ryWWWryr__WWWy","svg":null,"color":""},{"name":"icon:zen","size":9,"bricks":"___tt______tttt_____BttB_____bbbb____bbbbbb___BbbbbB___tttttt__tttttttt__tttttt__","svg":null,"color":""},{"name":"icon:sacrifice","size":9,"bricks":"__r___r___rrr_rrr_rrWWWWWrrrrWrWrWrrrrWWrWWrr_rrWWWrr___rWrWr_____rrr_______r____","svg":null,"color":""},{"name":"icon:trampoline","size":8,"bricks":"___y_____y____y___bbyb___bttttb_bttytttb_bttttb__tbbbbt__t____t_","svg":null,"color":""},{"name":"icon:ghost_coins","size":7,"bricks":"__yyy___yyyyy_yyOyOyyyyyyyyyyyOOOyyyyyyyyyyy_y_yy","svg":null,"color":""},{"name":"icon:forgiving","size":8,"bricks":"____G______G_G____G___G__G_____GG_____G__G___G____G_G____WWWWW__","svg":null,"color":""},{"name":"icon:ball_attracts_coins","size":8,"bricks":"WWW_____WWW_y___WWW____y__y_y____y____y_____y_____y____y___y_y__","svg":null,"color":""},{"name":"icon:reach","size":8,"bricks":"________ttt__tttttt_Wttt__t__t____r__r___________________WWW____","svg":null,"color":""},{"name":"icon:passive_income","size":8,"bricks":"__________tttt____tttt_______________W___________________rWWWr__","svg":null,"color":""},{"name":"icon:clairvoyant","size":9,"bricks":"__y___y__y__y_y__y_y__t__y____ttt_____tWWWt___tWWgWWt_tttWWWttt__________________","svg":null,"color":""},{"name":"icon:implosions","size":8,"bricks":"y______W__ryW_W__yr_WW____r_WWWy_WWW_rr___WW_rrryW_Wy___W_____y_","svg":null,"color":""},{"name":"icon:corner_shot","size":9,"bricks":"___W____y___W_y______W___y____W_y______W___y____W______W_W_WWW_WW_W_WWWWWW_W_WWWW","svg":null,"color":""},{"name":"icon:premium","size":11,"bricks":"__g____g___g____g____g_g__gbg__g______g______gg_gbg_gg_gbbgbbbgbbggbbgbbbgbbg_gbgbbbgbg___ggggggg____ggggggg_____________","svg":null,"color":""},{"name":"icon:reroll","size":8,"bricks":"__llllll_llBlBlelllllleBWWWWWeeeWBWBWeBeWWWWWeeeWBWBWBe_WWWWWe__","svg":null,"color":""},{"name":"icon:loop","size":7,"bricks":"bbbbbbbtttttt_aaaaa__cccc___CCC____GG_____y______","svg":null,"color":""},{"name":"icon:addiction","size":9,"bricks":"__________________________l__WWWWW_lWWWyylllly_WWWWW_ly_______l__________________","svg":null,"color":""},{"name":"icon:help","size":8,"bricks":"___bb_____bbbb___bb__bb__bb__bb_____bb_____bb______________bb___","svg":null,"color":""},{"name":"Pingwin","size":13,"bricks":"______gggg________ggWWgg_______gWWgWgy______ggWWWg_______ggggg_______gggWWW______gggggWWW___gggggggWWW____ggggggWWW_____ggggWWWW____gggWWWWW______ggWWWW________gWWyyy___","svg":null,"color":"#3584e4","credit":"https://prohama.com/pingwin-2-pattern/"},{"name":"Dog 8","size":17,"bricks":"_____________________________________gg_ggggg_gg____ggWWgWWWWWgWWgg__gWWgWWWWWWWgWWg__gWWgWWWWWWWgWWg__gggWWWWWWWWWggg___gWggWWWWWggWg____gWggWWWWWggWg____gWWWWgggWWWWg_____gWgWWgWWgWg______gWWggsggWWg_______gWgsssgWg_________ggsssgg____________ggg_________________________________________","svg":null,"color":"#62a0ea","credit":"https://prohama.com/dog-8-pattern/"},{"name":"Sunglasses","size":24,"bricks":"____________________________________________________ggggg______ggggg_______gg___g______g___gg_____gg________________gg___gg__________________gg_gggggggggg____gggggggggggggtttttggggggggbbbbbgggggtWWWttttggggbbbbWWWbgg_gtWttttttggggbbbbWbbbg__gtttttttgg__ggbbbbbbbg__gtttttttg____gbbbbbbbg__ggtttttgg____ggbbbbbgg___ggtttgg______ggbbbgg_____ggggg________ggggg___________________________________________________________________________________________________________________________________________________________________________________________________________________________","svg":null,"color":"#26a269","credit":"https://prohama.com/sunglasses-pattern-1/"},{"name":"Balloon","size":21,"bricks":"_____bbbWbbbWbbb_________PWbWPWbWPWbWP_______bWbbbWbbbWbbbWb_____WbbbWbbbWbbbWbbbW___WPWbWPWbWPWbWPWbWPW__bWbbbWbbbWbbbWbbbWb__bbbPbbbPbbbPbbbPbbb__bbPPPbPPPbPPPbPPPbb___PPWPPPWPPPWPPPWPP____PWbWPWbWPWbWPWbWP_____PWPPPWPPPWPPPWP_______PPWPPPWPPPWPP_________WbWPWbWPWbW___________bbbbbbbbb_____________b_____b______________b_____b______________b_____b______________WWWWWWW_______________PPPPP________________PPPPP________________PPPPP________","svg":null,"color":"#240a8b","credit":"https://prohama.com/balloon-1/"},{"name":"Opening","size":14,"bricks":"bbbbbbbbbbbbbbbbbbbbbbbbbbbbbyyyyyyyyyyyybbyB___BB___Bybby__________ybbyyy______yyybbbbyyB__Byybbbbbbbyy__yybbbbbbbbby__ybbbbbyyyyby__ybyyyy___yby__yby______yby__yby______yBy__yBy______yyy__yyy___","svg":null,"color":"#000000"},{"name":"Stripes","size":17,"bricks":"bbb______tttttt________tttttt________tttttt______bbtttttt______bbbbbttt______bbbbbb________bbbbbb________bbbbbb______ttbbbbbb______tttttbbb______tttttt________tttttt________tttttt______bbtttttt______bbbbbttt______bbbbbb________bbbbbb________bbbbbb________bbbbbb___________bbb______________","svg":null,"color":""},{"name":"icon:starting_perks","size":8,"bricks":"_________b_b_b___________g_g_g_g_________g_g_g_g_________g_g_g_g","svg":null,"color":""},{"name":"icon:download","size":8,"bricks":"___bb______bb______bb______bb______bb____bbbbbb___bbbb__gggbbggg","svg":null,"color":""},{"name":"icon:upload","size":8,"bricks":"gggbbggg__bbbb___bbbbbb____bb______bb______bb______bb______bb___","svg":null,"color":""},{"name":"icon:coins","size":8,"bricks":"__bbbb___bbggbb_bbggggbbbggggggbbggggggbbbggggbb_bbggbb___bbbb__","svg":null,"color":""},{"name":"icon:particles","size":8,"bricks":"_b_b_b__________b_bbb_b___bbb___b_bbb__b_____b___b_b__b________b","svg":null,"color":""},{"name":"icon:reset","size":8,"bricks":"bb____bbbbb__bbb_bbbbbb___bbbb____bbbb___bbbbbb_bbb__bbbbb____bb","svg":null,"color":""},{"name":"icon:fountain_toss","size":12,"bricks":"__________________________________________________WWWWWWWW___WttttttttW_WtytttytyttWWtttyttttttWlWtyttttytWl_lWWWWWWWWl___llllllll______________","svg":null,"color":""},{"name":"You are here","size":13,"bricks":"_____rrr_________rrrrr_______rrr_rrr______rr___rr______rr___rr_______rr_rr________rrrrr_________rrr__________rrr_________WWrWW_______WWWrWWW______WWWWWWW_______WWWWW____","svg":null,"color":""},{"name":"Gear","size":13,"bricks":"_________________l_l_l______l_lllll_l_____lllllll____lllll_lllll___lll___lll___lll_____lll___lll___lll___lllll_lllll____lllllll_____l_lllll_l______l_l_l_________________","svg":null,"color":""},{"name":"Play","size":15,"bricks":"_________________rrrrrrrrrrr___rrrrWWrrrrrrr__rrrrWWWrrrrrr__rrrrWWWWrrrrr__rrrrWWWWWrrrr__rrrrWWWWWWrrr__rrrrWWWWWrrrr__rrrrWWWWrrrrr__rrrrWWWrrrrrr__rrrrWWrrrrrrr___rrrrrrrrrrr_______________________________________________","svg":null,"color":""},{"name":"City","size":18,"bricks":"_______yyy___bbbbb________yyy__ybyyb________yyy__ybyyb__tt___yyy_b_ybbbb_tttt______bbbbbbbtttttt_______ybyybbbbbbb_______ybyybbyybyb_____b_ybbbbbyybyb_____bbbbbbbbbbbbb__bb___bbbbbbybyyb_bbbb__ybyybbybyybbbbbbb_ybyybbbbbbbtttttt_ybbbbbyybybtyyyyt_bbbbbbyybybtyyyyt_bbbbbbbbbbbtttttt_byybybybyybtytyyt_byybybybyybtttttt_byybb","svg":null,"color":""},{"name":"Wiggle","size":17,"bricks":"__________________cccccc_ccc_cccc__c____c_c_c_c__c__ccc_cc_c_ccc_cc____c_c__c_____c___ccc_cccc_ccc_cc__c________c_c__c__ccc_ccc_cc_cccc____c_c_c_c________ccc_c_c_ccccccc__c___c_________c__ccc_ccccccccccc____c______________ccc_ccc_ccc_ccc__c___c_c_c_c_c_c__ccccc_ccc_ccc_c__________________","svg":null,"color":""},{"name":"Graph","size":18,"bricks":"_______________________yy________________yyt__yytttt______tt_tttyy___t____yyt____t_____t____yy____tt_____t____t_____t______yy___t_____t______yy__tt_____yytttttt___tt___ttyy_____t___t____t__t_____t___yytttt__t_____t___yy______tt____t____t_______yy___t____ttt_____yyttyy______tyy___t___yy_______yytttt_________________________","svg":null,"color":""},{"name":"Lightbulb","size":14,"bricks":"_______________y__yyyyy___y____yyyyyyy______yyyyyyyyy_____yyyyyyyyy___y_yyyyyyyyy__y__yyyyyyyyy_____yyyyyyyyy_____yyyBBByyy___y__yyByByy___y____yByBy_________lllll______y___lll___y_______lll______","svg":null,"color":""},{"name":"Note","size":16,"bricks":"_____________WWW__________WWWWWW_______WWWWWW__W____WWWWWW_____W____WWW________W____W__________W____W__________W____W__________W____W__________W____W________WWW____W_______WWWW____W_______WWW___WWW____________WWWW____________WWW____________________________","svg":null,"color":""},{"name":"Rocket","size":13,"bricks":"______b___________bbb_________bbBbb________btttb________ttBtt________ttttt________ttBtt________ttttt________ttBtt_______bbtttbb_____bbbyyybbb____bbbyyybbb____bb_ByB_bb__","svg":null,"color":""},{"name":"Abstract","size":16,"bricks":"________________aaaaa_cccc_aaaaaaaaaa_cccc_aaaaa________________aaaa_cccc_aaaaaaaaaa_cccc_aaaaaa________________aaa_cccc_aaaaaaaaaa_cccc_aaaaaaa________________aa_cccc_aaaaaaaaaa_cccc_aaaaaaaa________________a_cccc_aaaaaaaaaa_cccc_aaaaaaaaa________________","svg":null,"color":""},{"name":"Fingerprint","size":15,"bricks":"___SSSSSSSS______S_______SS____S__SSSSS__SS__S__S____SS__S____S__SS__SS_S___S__S_SS__S__S_S__S___SS_SS__SS_S_____S___S__S_S__SS__S__SS_S_S_SS_S__S__S_S_S_S___S_S__S_S_S_S___S_S__S___S_S___S_S__S__S__S___S_S__S__S__S__S___S_S_","svg":null,"color":""},{"name":"Leaf","size":14,"bricks":"____________________________________________________________GGkGG________GGkGGkGG_____GGkGGkGGkkG_kkkkkkkkkkkGGG__GGkGGkGGkkG____GGkGGkGG_______GGkGG_______________________________________________","svg":null,"color":""},{"name":"Abstract 2","size":14,"bricks":"______________yyyy______yyyy______________bbb_bbbbbb_bbbbb___bbbb___bbb__y__bb__y__b______________bbb_bbbbbb_bbbbb___bbbb___bbb__y__bb__y__b______________bbb_bbbbbb_bbbbb___bbbb___bbb__y__bb__y__b","svg":null,"color":""},{"name":"Abstract 3","size":13,"bricks":"______________p_aaa_ppp_a__p___a_p___a__ppp_a_p_aaa_______________aaa_p_a_ppp__a___p_a___p__a_ppp_aaa_p_______________p_aaa_ppp_a__p___a_p___a__ppp_a_p_aaa______________","svg":null,"color":""},{"name":"Abstract 4","size":13,"bricks":"______________y_y_y_y_y_y__y_y_y_y_y_y__y_y_y_y_y_y_______________bbb_bbb_bbb_______________bbb_bbb_bbb_______________y_y_y_y_y_y__y_y_y_y_y_y__y_y_y_y_y_y______________","svg":null,"color":""},{"name":"Abstract 5","size":13,"bricks":"______________ccc_ccc_ccc__c_a_c_c_a_c__caa_aaa_aac_______________cca_aaa_acc__c_a_a_a_a_c__cca_aaa_acc_______________caa_aaa_aac__c_a_c_c_a_c__ccc_ccc_ccc______________","svg":null,"color":""},{"name":"Abstract 6","size":13,"bricks":"_vvvvv_vvvvv__v___v_v___v__v_bbbbbbb_v__v_b_v_v_b_v__v_b_v_v_b_v__v_b_v_v_b_v__v_b_v_v_b_v__v_b_v_v_b_v__v_b_v_v_b_v__v_b_vvv_b_v__v_b_____b_v__vvvvvvvvvvv_bbbb_____bbbb","svg":null,"color":""},{"name":"icon:new_run","size":7,"bricks":"_ggg____gbgg___gbbgg__gbbbg__gbbgg__gbgg___ggg___","svg":null,"color":""},{"name":"icon:unlocks","size":6,"bricks":"_bbbb__b__b__b__b_gggggggggggggggggg","svg":null,"color":""},{"name":"icon:settings","size":9,"bricks":"___g_g____g_ggg_g___ggbgg__gggbbbggg_gbb_bbg_gggbbbggg__ggbgg___g_ggg_g____g_g___","svg":null,"color":""},{"name":"icon:creative","size":7,"bricks":"bbg_bgg_______bbb_bgg_______bgg_bbg_______bbg_bbb","svg":null,"color":""},{"name":"icon:limitless","size":12,"bricks":"_________________________bbb____ttb_bbbbb__tttbbbb_bbbttt_bbbb__bbbt__bbbb_ttbbb__bbttttttbbbbbb_ttt___bbbb_____________________________________","svg":null,"color":""},{"name":"icon:history","size":8,"bricks":"__gggg___ggbggg_gggbgggggggbggggggggbbgggggggggg_gggggg___gggg__","svg":null,"color":""},{"name":"Hemiola","size":11,"bricks":"___gggg_____gggrrgg_____ggrrg_______gggg_____gggyygg_____ggyyg_______gggg_____gggCCgg_____ggCCg_______gggg________gg_____","svg":null,"color":"#240a8b","credit":"Left a wonderful review on the play store."},{"name":"Obigre","size":13,"bricks":"_______________________________________OOOORgRgRgOOOOWOORgRgRgOOOOOWORgRgRgOWOOWOORgRgRgOOWOOWORgRgRgOWOOWOORgRgRgOOOOOOORgRgRgOOO_______________________________________","svg":null,"color":"#62a0ea","credit":"Colin helped a lot with the game design https://colin-crapahute.bearblog.dev/"},{"name":"Noodlemire","size":15,"bricks":"_________________________________ggggggggg_____g_________g___g___________g_g_____________gg_____________gg_____yyy_____ggg__yyyyyyy__ggggtyyyyyyyyytggggtttttttttttgggg_ttttttttt_gg_____ttttt___________________________________","svg":null,"color":"#240a8b","credit":"Early adopter of the game"},{"name":"Bearded axe","size":12,"bricks":"______________WyyyOOy_____WyyyOOy_____Wyy_OO______Wyy_OO______Wyy_OO__________OO__________OO__________OO__________OO__________OO__________OO____","svg":null,"color":"","credit":"Did some nice bug reports"},{"name":"icon:minefield","size":7,"bricks":"W__B__WWWBBBWWB__W__BBBWWWBBW__B__WWWBBBWW_______","svg":null,"color":""},{"name":"icon:side_flip","size":7,"bricks":"________ttttt__rttty__rttty__rttty__ttttt________","svg":null,"color":""},{"name":"icon:side_kick","size":7,"bricks":"________ttttt__ytttr__ytttr__ytttr__ttttt________","svg":null,"color":""},{"name":"Lebanon","size":9,"bricks":"_________rrrrrrrrrWWWWkWWWWWWWkkkWWWWWkkkkkWWWWWWkWWWWrrrrrrrrr__________________","svg":null,"color":""},{"name":"Spain","size":9,"bricks":"_________rrrrrrrrryyyyyyyyyyWrWyyyyyyrWryyyyyyWrWyyyyyyyyyyyyyyrrrrrrrrr_________","svg":null,"color":""},{"name":"Uzbekistan","size":8,"bricks":"tWtttWttWtttWttttWtWtWttWWWWWWWWWWWWWWWWGGGGGGGGGGGGGGGGGGGGGGGG","svg":null,"color":""},{"name":"Pakistan","size":8,"bricks":"________WWkkkkkkWWkkWkWkWWkWkkkkWWkWkkWkWWkkWWkkWWkkkkkk________","svg":null,"color":""},{"name":"Korea","size":10,"bricks":"__________WWWWWWWWWWWgWWWWWWgWWgWrrrrWgWWWWrrbbWWWWWWrrbbWWWWgWbbbbWgWWgWWWWWWgWWWWWWWWWWW__________","svg":null,"color":"#62a0ea"},{"name":"icon:trickledown","size":8,"bricks":"_ytttttt_________y_y_y__tttttt____________y_y_y___tttttt_y______","svg":null,"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__","svg":null,"color":""},{"name":"icon:superhot","size":11,"bricks":"____________________________________________W_W_WWW_WWWWWW_W_W__W_W_W_WWW__W_____________________________________________","svg":null,"color":""},{"name":"icon:bricks_attract_coins","size":7,"bricks":"_y__y___tttttyyttttt__ttttt_yttttty_ttttt___y__y_","svg":null,"color":""},{"name":"icon:rainbow","size":6,"bricks":"__rOyC_rOyCa_rOyCarOyCatrOyCatrOyCat","svg":null,"color":""},{"name":"icon:hypnosis","size":8,"bricks":"WrrrrrrrWrWWWWWrWrWrrrWrWrWrWrWrWrWWWrWrWrrrrrWrWWWWWWWrrrrrrrrr","svg":null,"color":""},{"name":"icon:bricks_attract_ball","size":8,"bricks":"llW_____ll_v________p________bll____t_ll___G____lly_____ll_r____","svg":null,"color":""}]');
},{}],"iyP6E":[function(require,module,exports,__globalThis) {
-module.exports = JSON.parse("\"29072514\"");
+module.exports = JSON.parse("\"29073274\"");
},{}],"1u3Dx":[function(require,module,exports,__globalThis) {
var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js");
diff --git a/src/PWA/sw-b71.js b/src/PWA/sw-b71.js
index 60529a0..4b1d431 100644
--- a/src/PWA/sw-b71.js
+++ b/src/PWA/sw-b71.js
@@ -1,5 +1,5 @@
// The version of the cache.
-const VERSION = "29072514";
+const VERSION = "29073274";
// The name of the cache
const CACHE_NAME = `breakout-71-${VERSION}`;
diff --git a/src/creative.ts b/src/creative.ts
index c66f290..1b4c1fc 100644
--- a/src/creative.ts
+++ b/src/creative.ts
@@ -16,7 +16,7 @@ import {
sumOfValues,
} from "./game_utils";
import { getHistory } from "./gameOver";
-import {noCreative} from "./upgrades";
+import { noCreative } from "./upgrades";
export function creativeMode(gameState: GameState) {
return {
diff --git a/src/data/levels.json b/src/data/levels.json
index 676b58d..1e6d4eb 100644
--- a/src/data/levels.json
+++ b/src/data/levels.json
@@ -1412,4 +1412,4 @@
"svg": null,
"color": ""
}
-]
\ No newline at end of file
+]
diff --git a/src/data/version.json b/src/data/version.json
index 3fa7421..ec0d5c7 100644
--- a/src/data/version.json
+++ b/src/data/version.json
@@ -1 +1 @@
-"29072514"
+"29073274"
diff --git a/src/game.ts b/src/game.ts
index bebdb28..52a14fa 100644
--- a/src/game.ts
+++ b/src/game.ts
@@ -134,15 +134,15 @@ export function pause(playerAskedForPause: boolean) {
}
}
-export const fitSize = (gameState:GameState) => {
- if(!gameState) throw new Error("Missign game state")
+export const fitSize = (gameState: GameState) => {
+ if (!gameState) throw new Error("Missign game state");
const past_off = gameState.offsetXRoundedDown,
past_width = gameState.gameZoneWidthRoundedUp,
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.canvasHeight = height;
gameCanvas.width = width;
@@ -153,21 +153,36 @@ export const fitSize = (gameState:GameState) => {
haloCanvas.height = height / haloScale;
gameState.gameZoneHeight = isOptionOn("mobile-mode")
- ? Math.floor(height * .80) : height;
+ ? Math.floor(height * 0.8)
+ : height;
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.offsetX = Math.floor(
(gameState.canvasWidth - gameState.gameZoneWidth) / 2,
);
// Space between left side and border
- gameState.offsetXRoundedDown = gameState.offsetX - gameState.perks.unbounded*gameState.brickWidth;
- if (gameState.offsetX < gameState.ballSize+gameState.perks.unbounded*2*gameState.brickWidth) gameState.offsetXRoundedDown = 0;
+ gameState.offsetXRoundedDown =
+ 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;
backgroundCanvas.title = "resized";
// Ensure puck stays within bounds
@@ -201,8 +216,8 @@ export const fitSize = (gameState:GameState) => {
`${window.innerHeight * 0.01}px`,
);
};
-window.addEventListener("resize", ()=>fitSize(gameState));
-window.addEventListener("fullscreenchange", ()=>fitSize(gameState));
+window.addEventListener("resize", () => fitSize(gameState));
+window.addEventListener("fullscreenchange", () => fitSize(gameState));
setInterval(() => {
// 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);
if (gameState.running) {
- gameState.levelTime += timeDeltaMs*frames;
- gameState.runStatistics.runTime += timeDeltaMs*frames;
+ gameState.levelTime += timeDeltaMs * frames;
+ gameState.runStatistics.runTime += timeDeltaMs * frames;
gameStateTick(gameState, frames);
}
if (gameState.running || gameState.needsRender) {
@@ -717,10 +732,7 @@ async function openSettingsMenu() {
} catch (e: any) {
await asyncAlert({
title: t("settings.save_file_error"),
- content: [
- e.message,
- { text: t("settings.save_file_loaded_ok") },
- ],
+ content: [e.message, { text: t("settings.save_file_loaded_ok") }],
});
}
input.value = "";
@@ -986,17 +998,20 @@ export function restart(params: RunParams) {
setLevel(gameState, 0);
}
-restart(window.location.search.includes('stress')?{
-
- perks:{
- bricks_attract_ball:2,
- superhot:1,
- bricks_attract_coins:3,
- hot_start:3,
- pierce:3,
- rainbow:3
- }
-}:{});
+restart(
+ window.location.search.includes("stress")
+ ? {
+ perks: {
+ bricks_attract_ball: 2,
+ superhot: 1,
+ bricks_attract_coins: 3,
+ hot_start: 3,
+ pierce: 3,
+ rainbow: 3,
+ },
+ }
+ : {},
+);
tick();
setupTooltips();
diff --git a/src/gameStateMutators.ts b/src/gameStateMutators.ts
index de76dc9..e523b05 100644
--- a/src/gameStateMutators.ts
+++ b/src/gameStateMutators.ts
@@ -1,2003 +1,2029 @@
import {
- Ball,
- BallLike,
- Coin,
- colorString,
- GameState,
- LightFlash,
- ParticleFlash,
- PerkId,
- ReusableArray,
- TextFlash,
+ Ball,
+ BallLike,
+ Coin,
+ colorString,
+ GameState,
+ LightFlash,
+ ParticleFlash,
+ PerkId,
+ ReusableArray,
+ TextFlash,
} from "./types";
import {
- ballTransparency,
- brickCenterX,
- brickCenterY,
- currentLevelInfo,
- distance2,
- distanceBetween,
- getClosestBall,
- getMajorityValue,
- getPossibleUpgrades,
- getRowColIndex,
- isMovingWhilePassiveIncome,
- isPickyEatingPossible,
- max_levels,
- reachRedRowIndex,
- shouldPierceByColor,
- telekinesisEffectRate,
- yoyoEffectRate,
+ ballTransparency,
+ brickCenterX,
+ brickCenterY,
+ currentLevelInfo,
+ distance2,
+ distanceBetween,
+ getClosestBall,
+ getMajorityValue,
+ getPossibleUpgrades,
+ getRowColIndex,
+ isMovingWhilePassiveIncome,
+ isPickyEatingPossible,
+ max_levels,
+ reachRedRowIndex,
+ shouldPierceByColor,
+ telekinesisEffectRate,
+ yoyoEffectRate,
} from "./game_utils";
-import {t} from "./i18n/i18n";
-import {icons} from "./loadGameData";
+import { t } from "./i18n/i18n";
+import { icons } from "./loadGameData";
-import {getCurrentMaxCoins, getCurrentMaxParticles} from "./settings";
-import {background} from "./render";
-import {gameOver} from "./gameOver";
-import {brickIndex, fitSize, gameState, hasBrick, hitsSomething, openUpgradesPicker, pause,} from "./game";
-import {stopRecording} from "./recording";
-import {isOptionOn} from "./options";
-import {clamp, comboKeepingRate} from "./pure_functions";
-import {addToTotalScore} from "./addToTotalScore";
+import { getCurrentMaxCoins, getCurrentMaxParticles } from "./settings";
+import { background } from "./render";
+import { gameOver } from "./gameOver";
+import {
+ brickIndex,
+ fitSize,
+ gameState,
+ hasBrick,
+ hitsSomething,
+ openUpgradesPicker,
+ pause,
+} from "./game";
+import { stopRecording } from "./recording";
+import { isOptionOn } from "./options";
+import { clamp, comboKeepingRate } from "./pure_functions";
+import { addToTotalScore } from "./addToTotalScore";
export function setMousePos(gameState: GameState, x: number) {
- gameState.puckPosition = x;
- // Sets the puck position, and updates the ball position if they are supposed to follow it
- gameState.needsRender = true;
+ gameState.puckPosition = x;
+ // Sets the puck position, and updates the ball position if they are supposed to follow it
+ gameState.needsRender = true;
}
function getBallDefaultVx(gameState: GameState) {
- return (
- (gameState.perks.concave_puck ? 0 : 1) *
- (Math.random() > 0.5 ? gameState.baseSpeed : -gameState.baseSpeed)
- );
+ return (
+ (gameState.perks.concave_puck ? 0 : 1) *
+ (Math.random() > 0.5 ? gameState.baseSpeed : -gameState.baseSpeed)
+ );
}
export function resetBalls(gameState: GameState) {
- // Always compute speed first
- normalizeGameState(gameState);
- const count = 1 + (gameState.perks?.multiball || 0);
- const perBall = gameState.puckWidth / (count + 1);
- gameState.balls = [];
- gameState.ballsColor = "#FFFFFF";
- if (gameState.perks.picky_eater || gameState.perks.pierce_color) {
- gameState.ballsColor =
- getMajorityValue(gameState.bricks.filter((i) => i)) || "#FFFFFF";
- }
- for (let i = 0; i < count; i++) {
- const x =
- gameState.puckPosition - gameState.puckWidth / 2 + perBall * (i + 1);
- const vx = getBallDefaultVx(gameState);
+ // Always compute speed first
+ normalizeGameState(gameState);
+ const count = 1 + (gameState.perks?.multiball || 0);
+ const perBall = gameState.puckWidth / (count + 1);
+ gameState.balls = [];
+ gameState.ballsColor = "#FFFFFF";
+ if (gameState.perks.picky_eater || gameState.perks.pierce_color) {
+ gameState.ballsColor =
+ getMajorityValue(gameState.bricks.filter((i) => i)) || "#FFFFFF";
+ }
+ for (let i = 0; i < count; i++) {
+ const x =
+ gameState.puckPosition - gameState.puckWidth / 2 + perBall * (i + 1);
+ const vx = getBallDefaultVx(gameState);
- gameState.balls.push({
- x,
- previousX: x,
- y: gameState.gameZoneHeight - 1.5 * gameState.ballSize,
- previousY: gameState.gameZoneHeight - 1.5 * gameState.ballSize,
- vx,
- previousVX: vx,
- vy: -gameState.baseSpeed,
- previousVY: -gameState.baseSpeed,
- piercePoints: gameState.perks.pierce * 3,
- hitSinceBounce: 0,
- brokenSinceBounce: 0,
- sapperUses: 0,
- });
- }
- gameState.ballStickToPuck = true;
+ gameState.balls.push({
+ x,
+ previousX: x,
+ y: gameState.gameZoneHeight - 1.5 * gameState.ballSize,
+ previousY: gameState.gameZoneHeight - 1.5 * gameState.ballSize,
+ vx,
+ previousVX: vx,
+ vy: -gameState.baseSpeed,
+ previousVY: -gameState.baseSpeed,
+ piercePoints: gameState.perks.pierce * 3,
+ hitSinceBounce: 0,
+ brokenSinceBounce: 0,
+ sapperUses: 0,
+ });
+ }
+ gameState.ballStickToPuck = true;
}
export function putBallsAtPuck(gameState: GameState) {
- // This reset could be abused to cheat quite easily
- const count = gameState.balls.length;
- const perBall = gameState.puckWidth / (count + 1);
- // const vx = getBallDefaultVx(gameState);
- gameState.balls.forEach((ball, i) => {
- const x =
- gameState.puckPosition - gameState.puckWidth / 2 + perBall * (i + 1);
+ // This reset could be abused to cheat quite easily
+ const count = gameState.balls.length;
+ const perBall = gameState.puckWidth / (count + 1);
+ // const vx = getBallDefaultVx(gameState);
+ gameState.balls.forEach((ball, i) => {
+ const x =
+ gameState.puckPosition - gameState.puckWidth / 2 + perBall * (i + 1);
- ball.x = x;
- ball.previousX = x;
- ball.y = gameState.gameZoneHeight - 1.5 * gameState.ballSize;
- ball.previousY = ball.y;
- ball.hitSinceBounce = 0;
- ball.brokenSinceBounce = 0;
- ball.piercePoints = gameState.perks.pierce * 3;
- });
+ ball.x = x;
+ ball.previousX = x;
+ ball.y = gameState.gameZoneHeight - 1.5 * gameState.ballSize;
+ ball.previousY = ball.y;
+ ball.hitSinceBounce = 0;
+ ball.brokenSinceBounce = 0;
+ ball.piercePoints = gameState.perks.pierce * 3;
+ });
}
export function normalizeGameState(gameState: GameState) {
- // This function resets most parameters on the state to correct values, and should be used even when the game is paused
+ // This function resets most parameters on the state to correct values, and should be used even when the game is paused
- gameState.baseSpeed = Math.max(
- 3,
- gameState.gameZoneWidth / 12 / 10 +
- gameState.currentLevel / 3 +
- gameState.levelTime / (30 * 1000) -
- gameState.perks.slow_down * 2,
- );
+ gameState.baseSpeed = Math.max(
+ 3,
+ gameState.gameZoneWidth / 12 / 10 +
+ gameState.currentLevel / 3 +
+ gameState.levelTime / (30 * 1000) -
+ gameState.perks.slow_down * 2,
+ );
- gameState.puckWidth = Math.max(
- gameState.ballSize,
- (gameState.gameZoneWidth / 12) *
- Math.min(
- 12,
- 3 - gameState.perks.smaller_puck + gameState.perks.bigger_puck,
- ),
- );
+ gameState.puckWidth = Math.max(
+ gameState.ballSize,
+ (gameState.gameZoneWidth / 12) *
+ Math.min(
+ 12,
+ 3 - gameState.perks.smaller_puck + gameState.perks.bigger_puck,
+ ),
+ );
+ const corner =
+ (gameState.levelTime
+ ? gameState.perks.corner_shot * gameState.puckWidth
+ : 0) -
+ gameState.perks.unbounded * gameState.brickWidth;
- const corner = (gameState.levelTime ? gameState.perks.corner_shot * gameState.puckWidth : 0) - gameState.perks.unbounded * gameState.brickWidth;
+ let minX = gameState.offsetXRoundedDown + gameState.puckWidth / 2 - corner;
- let minX =
- gameState.offsetXRoundedDown +
- gameState.puckWidth / 2 -
- corner;
+ let maxX =
+ gameState.offsetXRoundedDown +
+ gameState.gameZoneWidthRoundedUp -
+ gameState.puckWidth / 2 +
+ corner;
- let maxX =
- gameState.offsetXRoundedDown +
- gameState.gameZoneWidthRoundedUp -
- gameState.puckWidth / 2 +
- corner;
+ gameState.puckPosition = clamp(gameState.puckPosition, minX, maxX);
- gameState.puckPosition = clamp(gameState.puckPosition, minX, maxX);
+ if (gameState.ballStickToPuck) {
+ putBallsAtPuck(gameState);
+ }
- if (gameState.ballStickToPuck) {
- putBallsAtPuck(gameState);
- }
-
- if (
- Math.abs(gameState.lastPuckPosition - gameState.puckPosition) > 1 &&
- gameState.running
- ) {
- gameState.lastPuckMove = gameState.levelTime;
- }
- gameState.lastPuckPosition = gameState.puckPosition;
+ if (
+ Math.abs(gameState.lastPuckPosition - gameState.puckPosition) > 1 &&
+ gameState.running
+ ) {
+ gameState.lastPuckMove = gameState.levelTime;
+ }
+ gameState.lastPuckPosition = gameState.puckPosition;
}
export function baseCombo(gameState: GameState) {
- const mineFieldBonus =
- gameState.perks.minefield &&
- gameState.bricks.filter((b) => b === "black").length *
- gameState.perks.minefield;
- return (
- 1 +
- gameState.perks.base_combo * 3 +
- gameState.perks.smaller_puck * 5 +
- mineFieldBonus
- );
+ const mineFieldBonus =
+ gameState.perks.minefield &&
+ gameState.bricks.filter((b) => b === "black").length *
+ gameState.perks.minefield;
+ return (
+ 1 +
+ gameState.perks.base_combo * 3 +
+ gameState.perks.smaller_puck * 5 +
+ mineFieldBonus
+ );
}
export function resetCombo(
- gameState: GameState,
- x: number | undefined,
- y: number | undefined,
+ gameState: GameState,
+ x: number | undefined,
+ y: number | undefined,
) {
- const prev = gameState.combo;
- gameState.combo = baseCombo(gameState);
+ const prev = gameState.combo;
+ gameState.combo = baseCombo(gameState);
- if (prev > gameState.combo && gameState.perks.soft_reset) {
- gameState.combo += Math.floor(
- (prev - gameState.combo) * comboKeepingRate(gameState.perks.soft_reset),
- );
+ if (prev > gameState.combo && gameState.perks.soft_reset) {
+ gameState.combo += Math.floor(
+ (prev - gameState.combo) * comboKeepingRate(gameState.perks.soft_reset),
+ );
+ }
+ const lost = Math.max(0, prev - gameState.combo);
+ if (lost) {
+ for (let i = 0; i < lost && i < 8; i++) {
+ setTimeout(
+ () => schedulGameSound(gameState, "comboDecrease", x, 1),
+ i * 100,
+ );
}
- const lost = Math.max(0, prev - gameState.combo);
- if (lost) {
- for (let i = 0; i < lost && i < 8; i++) {
- setTimeout(
- () => schedulGameSound(gameState, "comboDecrease", x, 1),
- i * 100,
- );
- }
- if (typeof x !== "undefined" && typeof y !== "undefined") {
- makeText(
- gameState,
- x,
- y,
- "#FF0000",
- "-" + lost,
- 20,
- 500 + clamp(lost, 0, 500),
- );
- }
+ if (typeof x !== "undefined" && typeof y !== "undefined") {
+ makeText(
+ gameState,
+ x,
+ y,
+ "#FF0000",
+ "-" + lost,
+ 20,
+ 500 + clamp(lost, 0, 500),
+ );
}
- return lost;
+ }
+ return lost;
}
export function increaseCombo(
- gameState: GameState,
- by: number,
- x: number,
- y: number,
+ gameState: GameState,
+ by: number,
+ x: number,
+ y: number,
) {
- if (by <= 0) {
- return;
- }
- gameState.combo += by;
- if (
- isOptionOn("comboIncreaseTexts") &&
- typeof x !== "undefined" &&
- typeof y !== "undefined"
- ) {
- makeText(gameState, x, y, "#ffd300", "+" + by, 25, 400 + by);
- }
+ if (by <= 0) {
+ return;
+ }
+ gameState.combo += by;
+ if (
+ isOptionOn("comboIncreaseTexts") &&
+ typeof x !== "undefined" &&
+ typeof y !== "undefined"
+ ) {
+ makeText(gameState, x, y, "#ffd300", "+" + by, 25, 400 + by);
+ }
}
export function decreaseCombo(
- gameState: GameState,
- by: number,
- x: number,
- y: number,
+ gameState: GameState,
+ by: number,
+ x: number,
+ y: number,
) {
- const prev = gameState.combo;
- gameState.combo = Math.max(baseCombo(gameState), gameState.combo - by);
- const lost = Math.max(0, prev - gameState.combo);
+ const prev = gameState.combo;
+ gameState.combo = Math.max(baseCombo(gameState), gameState.combo - by);
+ const lost = Math.max(0, prev - gameState.combo);
- if (lost) {
- schedulGameSound(gameState, "comboDecrease", x, 1);
- if (typeof x !== "undefined" && typeof y !== "undefined") {
- makeText(gameState, x, y, "#FF0000", "-" + lost, 20, 400 + lost);
- }
+ if (lost) {
+ schedulGameSound(gameState, "comboDecrease", x, 1);
+ if (typeof x !== "undefined" && typeof y !== "undefined") {
+ makeText(gameState, x, y, "#FF0000", "-" + lost, 20, 400 + lost);
}
+ }
}
export function spawnExplosion(
- gameState: GameState,
- count: number,
- x: number,
- y: number,
- color: string,
+ gameState: GameState,
+ count: number,
+ x: number,
+ y: number,
+ color: string,
) {
- if (!!isOptionOn("basic")) return;
+ if (!!isOptionOn("basic")) return;
- if (liveCount(gameState.particles) > getCurrentMaxParticles()) {
- // Avoid freezing when lots of explosion happen at once
- count = 1;
- }
- for (let i = 0; i < count; i++) {
- makeParticle(
- gameState,
+ if (liveCount(gameState.particles) > getCurrentMaxParticles()) {
+ // Avoid freezing when lots of explosion happen at once
+ count = 1;
+ }
+ for (let i = 0; i < count; i++) {
+ makeParticle(
+ gameState,
- x + ((Math.random() - 0.5) * gameState.brickWidth) / 2,
- y + ((Math.random() - 0.5) * gameState.brickWidth) / 2,
- (Math.random() - 0.5) * 30,
- (Math.random() - 0.5) * 30,
- color,
- false,
- );
- }
+ x + ((Math.random() - 0.5) * gameState.brickWidth) / 2,
+ y + ((Math.random() - 0.5) * gameState.brickWidth) / 2,
+ (Math.random() - 0.5) * 30,
+ (Math.random() - 0.5) * 30,
+ color,
+ false,
+ );
+ }
}
export function spawnImplosion(
- gameState: GameState,
- count: number,
- x: number,
- y: number,
- color: string,
+ gameState: GameState,
+ count: number,
+ x: number,
+ y: number,
+ color: string,
) {
- if (!!isOptionOn("basic")) return;
+ if (!!isOptionOn("basic")) return;
- if (liveCount(gameState.particles) > getCurrentMaxParticles()) {
- // Avoid freezing when lots of explosion happen at once
- count = 1;
- }
- for (let i = 0; i < count; i++) {
- const dx = ((Math.random() - 0.5) * gameState.brickWidth) / 2;
- const dy = ((Math.random() - 0.5) * gameState.brickWidth) / 2;
- makeParticle(gameState, x - dx * 10, y - dy * 10, dx, dy, color, false);
- }
+ if (liveCount(gameState.particles) > getCurrentMaxParticles()) {
+ // Avoid freezing when lots of explosion happen at once
+ count = 1;
+ }
+ for (let i = 0; i < count; i++) {
+ const dx = ((Math.random() - 0.5) * gameState.brickWidth) / 2;
+ const dy = ((Math.random() - 0.5) * gameState.brickWidth) / 2;
+ makeParticle(gameState, x - dx * 10, y - dy * 10, dx, dy, color, false);
+ }
}
export function explosionAt(
- gameState: GameState,
- index: number,
- x: number,
- y: number,
- ball: Ball,
- extraSize: number = 0,
+ gameState: GameState,
+ index: number,
+ x: number,
+ y: number,
+ ball: Ball,
+ extraSize: number = 0,
) {
- const size =
- 1 +
- gameState.perks.bigger_explosions +
- Math.max(0, gameState.perks.implosions - 1) +
- extraSize;
- schedulGameSound(gameState, "explode", ball.x, 1);
- if (index !== -1) {
- const col = index % gameState.gridSize;
- const row = Math.floor(index / gameState.gridSize);
- // Break bricks around
- for (let dx = -size; dx <= size; dx++) {
- for (let dy = -size; dy <= size; dy++) {
- const i = getRowColIndex(gameState, row + dy, col + dx);
- if (gameState.bricks[i] && i !== -1) {
- // Study bricks resist explosions too
- gameState.brickHP[i]--;
- if (gameState.brickHP[i] <= 0) {
- explodeBrick(gameState, i, ball, true);
- }
- }
- }
+ const size =
+ 1 +
+ gameState.perks.bigger_explosions +
+ Math.max(0, gameState.perks.implosions - 1) +
+ extraSize;
+ schedulGameSound(gameState, "explode", ball.x, 1);
+ if (index !== -1) {
+ const col = index % gameState.gridSize;
+ const row = Math.floor(index / gameState.gridSize);
+ // Break bricks around
+ for (let dx = -size; dx <= size; dx++) {
+ for (let dy = -size; dy <= size; dy++) {
+ const i = getRowColIndex(gameState, row + dy, col + dx);
+ if (gameState.bricks[i] && i !== -1) {
+ // Study bricks resist explosions too
+ gameState.brickHP[i]--;
+ if (gameState.brickHP[i] <= 0) {
+ explodeBrick(gameState, i, ball, true);
+ }
}
+ }
}
+ }
- const factor = gameState.perks.implosions ? -1 : 1;
- // Blow nearby coins
- forEachLiveOne(gameState.coins, (c) => {
- const dx = c.x - x;
- const dy = c.y - y;
- const d2 = Math.max(gameState.brickWidth, Math.abs(dx) + Math.abs(dy));
- c.vx += (((dx / d2) * 10 * size) / c.weight) * factor;
- c.vy += (((dy / d2) * 10 * size) / c.weight) * factor;
- });
- gameState.lastExplosion = Date.now();
+ const factor = gameState.perks.implosions ? -1 : 1;
+ // Blow nearby coins
+ forEachLiveOne(gameState.coins, (c) => {
+ const dx = c.x - x;
+ const dy = c.y - y;
+ const d2 = Math.max(gameState.brickWidth, Math.abs(dx) + Math.abs(dy));
+ c.vx += (((dx / d2) * 10 * size) / c.weight) * factor;
+ c.vy += (((dy / d2) * 10 * size) / c.weight) * factor;
+ });
+ gameState.lastExplosion = Date.now();
- if (gameState.perks.implosions) {
- spawnImplosion(gameState, 7 * size, x, y, "#FFFFFF");
- } else {
- spawnExplosion(gameState, 7 * size, x, y, "#FFFFFF");
- }
+ if (gameState.perks.implosions) {
+ spawnImplosion(gameState, 7 * size, x, y, "#FFFFFF");
+ } else {
+ spawnExplosion(gameState, 7 * size, x, y, "#FFFFFF");
+ }
- gameState.runStatistics.bricks_broken++;
+ gameState.runStatistics.bricks_broken++;
- if (gameState.perks.zen) {
- resetCombo(gameState, x, y);
- }
+ if (gameState.perks.zen) {
+ resetCombo(gameState, x, y);
+ }
}
export function explodeBrick(
- gameState: GameState,
- index: number,
- ball: Ball,
- isExplosion: boolean,
+ gameState: GameState,
+ index: number,
+ ball: Ball,
+ isExplosion: boolean,
) {
- const color = gameState.bricks[index];
- if (!color) return;
+ const color = gameState.bricks[index];
+ if (!color) return;
- const wasPickyEaterPossible =
- gameState.perks.picky_eater && isPickyEatingPossible(gameState);
- const redRowReach = reachRedRowIndex(gameState);
+ const wasPickyEaterPossible =
+ gameState.perks.picky_eater && isPickyEatingPossible(gameState);
+ const redRowReach = reachRedRowIndex(gameState);
- gameState.lastBrickBroken = gameState.levelTime;
+ gameState.lastBrickBroken = gameState.levelTime;
- if (color === "black") {
- const x = brickCenterX(gameState, index),
- y = brickCenterY(gameState, index);
+ if (color === "black") {
+ const x = brickCenterX(gameState, index),
+ y = brickCenterY(gameState, index);
- // if (color === "transparent") {
- // schedulGameSound(gameState, "void", x, 1);
- // resetCombo(gameState, x, y);
- // }
- setBrick(gameState, index, "");
- explosionAt(gameState, index, x, y, ball, 0);
- if (gameState.perks.minefield) {
- decreaseCombo(gameState, gameState.perks.minefield, x, y);
- }
- } else if (color) {
- // Even if it bounces we don't want to count that as a miss
+ // if (color === "transparent") {
+ // schedulGameSound(gameState, "void", x, 1);
+ // resetCombo(gameState, x, y);
+ // }
+ setBrick(gameState, index, "");
+ explosionAt(gameState, index, x, y, ball, 0);
+ if (gameState.perks.minefield) {
+ decreaseCombo(gameState, gameState.perks.minefield, x, y);
+ }
+ } else if (color) {
+ // Even if it bounces we don't want to count that as a miss
- // Flashing is take care of by the tick loop
- const x = brickCenterX(gameState, index),
- y = brickCenterY(gameState, index);
+ // Flashing is take care of by the tick loop
+ const x = brickCenterX(gameState, index),
+ y = brickCenterY(gameState, index);
- setBrick(gameState, index, "");
+ setBrick(gameState, index, "");
- let coinsToSpawn = gameState.combo;
- if (gameState.lastCombo > coinsToSpawn) {
- // In case a reset happens in the same frame as a spawn, i want the combo to stay high (for minefield and zen in particular)
- coinsToSpawn = gameState.lastCombo;
- }
- if (gameState.perks.sturdy_bricks) {
- // +10% per level
- coinsToSpawn += Math.ceil(
- ((2 + gameState.perks.sturdy_bricks) / 2) * coinsToSpawn,
- );
- }
- if (gameState.perks.transparency) {
- coinsToSpawn = Math.round(
- coinsToSpawn *
- (1 +
- (ballTransparency(ball, gameState) * gameState.perks.transparency) /
- 2),
- );
- }
+ let coinsToSpawn = gameState.combo;
+ if (gameState.lastCombo > coinsToSpawn) {
+ // In case a reset happens in the same frame as a spawn, i want the combo to stay high (for minefield and zen in particular)
+ coinsToSpawn = gameState.lastCombo;
+ }
+ if (gameState.perks.sturdy_bricks) {
+ // +10% per level
+ coinsToSpawn += Math.ceil(
+ ((2 + gameState.perks.sturdy_bricks) / 2) * coinsToSpawn,
+ );
+ }
+ if (gameState.perks.transparency) {
+ coinsToSpawn = Math.round(
+ coinsToSpawn *
+ (1 +
+ (ballTransparency(ball, gameState) * gameState.perks.transparency) /
+ 2),
+ );
+ }
- gameState.levelSpawnedCoins += coinsToSpawn;
- gameState.runStatistics.coins_spawned += coinsToSpawn;
- gameState.runStatistics.bricks_broken++;
+ gameState.levelSpawnedCoins += coinsToSpawn;
+ gameState.runStatistics.coins_spawned += coinsToSpawn;
+ gameState.runStatistics.bricks_broken++;
- const maxCoins = getCurrentMaxCoins() * (isOptionOn("basic") ? 0.5 : 1);
- const spawnableCoins =
- liveCount(gameState.coins) > getCurrentMaxCoins()
- ? 1
- : Math.floor(maxCoins - liveCount(gameState.coins)) / 3;
+ const maxCoins = getCurrentMaxCoins() * (isOptionOn("basic") ? 0.5 : 1);
+ const spawnableCoins =
+ liveCount(gameState.coins) > getCurrentMaxCoins()
+ ? 1
+ : Math.floor(maxCoins - liveCount(gameState.coins)) / 3;
- const pointsPerCoin = Math.max(1, Math.ceil(coinsToSpawn / spawnableCoins));
+ const pointsPerCoin = Math.max(1, Math.ceil(coinsToSpawn / spawnableCoins));
- while (coinsToSpawn > 0) {
- const points = Math.min(pointsPerCoin, coinsToSpawn);
- if (points < 0 || isNaN(points)) {
- console.error({points});
- debugger;
- }
+ while (coinsToSpawn > 0) {
+ const points = Math.min(pointsPerCoin, coinsToSpawn);
+ if (points < 0 || isNaN(points)) {
+ console.error({ points });
+ debugger;
+ }
- coinsToSpawn -= points;
+ coinsToSpawn -= points;
- const cx =
- x +
- (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize),
- cy =
- y +
- (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize);
+ const cx =
+ x +
+ (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize),
+ cy =
+ y +
+ (Math.random() - 0.5) * (gameState.brickWidth - gameState.coinSize);
- makeCoin(
- gameState,
- cx,
- cy,
- ball.previousVX * (0.5 + Math.random()),
- ball.previousVY * (0.5 + Math.random()),
- color,
- points,
- );
- }
+ makeCoin(
+ gameState,
+ cx,
+ cy,
+ ball.previousVX * (0.5 + Math.random()),
+ ball.previousVY * (0.5 + Math.random()),
+ color,
+ points,
+ );
+ }
- increaseCombo(
+ increaseCombo(
+ gameState,
+ gameState.perks.streak_shots +
+ gameState.perks.compound_interest +
+ gameState.perks.left_is_lava +
+ gameState.perks.right_is_lava +
+ gameState.perks.top_is_lava +
+ gameState.perks.picky_eater +
+ gameState.perks.asceticism * 3 +
+ gameState.perks.zen +
+ gameState.perks.passive_income +
+ gameState.perks.addiction,
+ ball.x,
+ ball.y,
+ );
+
+ if (Math.abs(ball.y - y) < Math.abs(ball.x - x)) {
+ if (gameState.perks.side_kick) {
+ if (ball.previousVX > 0) {
+ increaseCombo(gameState, gameState.perks.side_kick, ball.x, ball.y);
+ } else {
+ decreaseCombo(
gameState,
- gameState.perks.streak_shots +
- gameState.perks.compound_interest +
- gameState.perks.left_is_lava +
- gameState.perks.right_is_lava +
- gameState.perks.top_is_lava +
- gameState.perks.picky_eater +
- gameState.perks.asceticism * 3 +
- gameState.perks.zen +
- gameState.perks.passive_income +
- gameState.perks.addiction,
+ gameState.perks.side_kick * 2,
ball.x,
ball.y,
- );
-
- if (Math.abs(ball.y - y) < Math.abs(ball.x - x)) {
- if (gameState.perks.side_kick) {
- if (ball.previousVX > 0) {
- increaseCombo(gameState, gameState.perks.side_kick, ball.x, ball.y);
- } else {
- decreaseCombo(
- gameState,
- gameState.perks.side_kick * 2,
- ball.x,
- ball.y,
- );
- }
- }
- if (gameState.perks.side_flip) {
- if (ball.previousVX < 0) {
- increaseCombo(gameState, gameState.perks.side_flip, ball.x, ball.y);
- } else {
- decreaseCombo(
- gameState,
- gameState.perks.side_flip * 2,
- ball.x,
- ball.y,
- );
- }
- }
+ );
}
-
- if (redRowReach !== -1) {
- if (Math.floor(index / gameState.level.size) === redRowReach) {
- resetCombo(gameState, x, y);
- } else {
- for (let x = 0; x < gameState.level.size; x++) {
- if (gameState.bricks[redRowReach * gameState.level.size + x])
- gameState.combo++;
- }
- }
+ }
+ if (gameState.perks.side_flip) {
+ if (ball.previousVX < 0) {
+ increaseCombo(gameState, gameState.perks.side_flip, ball.x, ball.y);
+ } else {
+ decreaseCombo(
+ gameState,
+ gameState.perks.side_flip * 2,
+ ball.x,
+ ball.y,
+ );
}
-
- if (isMovingWhilePassiveIncome(gameState)) {
- resetCombo(gameState, x, y);
- }
-
- if (!isExplosion) {
- // color change
- if (
- (gameState.perks.picky_eater || gameState.perks.pierce_color) &&
- color !== gameState.ballsColor &&
- color
- ) {
- if (wasPickyEaterPossible) {
- resetCombo(gameState, ball.x, ball.y);
- }
- schedulGameSound(gameState, "colorChange", ball.x, 0.8);
- gameState.lastExplosion = gameState.levelTime;
- gameState.ballsColor = color;
- if (!isOptionOn("basic")) {
- gameState.balls.forEach((ball) => {
- spawnExplosion(gameState, 7, ball.previousX, ball.previousY, color);
- });
- }
- } else {
- schedulGameSound(gameState, "comboIncreaseMaybe", ball.x, 1);
- }
- }
- // makeLight(gameState, x, y, color, gameState.brickWidth, 40);
-
- spawnExplosion(gameState, 5 + Math.min(gameState.combo, 30), x, y, color);
+ }
}
- if (
- gameState.perks.respawn &&
- color !== "black" &&
- !gameState.bricks[index]
- ) {
- if (Math.random() < comboKeepingRate(gameState.perks.respawn)) {
- append(gameState.respawns, (b) => {
- b.color = color;
- b.index = index;
- b.time = gameState.levelTime + (3 * 1000) / gameState.perks.respawn;
- });
+ if (redRowReach !== -1) {
+ if (Math.floor(index / gameState.level.size) === redRowReach) {
+ resetCombo(gameState, x, y);
+ } else {
+ for (let x = 0; x < gameState.level.size; x++) {
+ if (gameState.bricks[redRowReach * gameState.level.size + x])
+ gameState.combo++;
}
+ }
}
+
+ if (isMovingWhilePassiveIncome(gameState)) {
+ resetCombo(gameState, x, y);
+ }
+
+ if (!isExplosion) {
+ // color change
+ if (
+ (gameState.perks.picky_eater || gameState.perks.pierce_color) &&
+ color !== gameState.ballsColor &&
+ color
+ ) {
+ if (wasPickyEaterPossible) {
+ resetCombo(gameState, ball.x, ball.y);
+ }
+ schedulGameSound(gameState, "colorChange", ball.x, 0.8);
+ gameState.lastExplosion = gameState.levelTime;
+ gameState.ballsColor = color;
+ if (!isOptionOn("basic")) {
+ gameState.balls.forEach((ball) => {
+ spawnExplosion(gameState, 7, ball.previousX, ball.previousY, color);
+ });
+ }
+ } else {
+ schedulGameSound(gameState, "comboIncreaseMaybe", ball.x, 1);
+ }
+ }
+ // makeLight(gameState, x, y, color, gameState.brickWidth, 40);
+
+ spawnExplosion(gameState, 5 + Math.min(gameState.combo, 30), x, y, color);
+ }
+
+ if (
+ gameState.perks.respawn &&
+ color !== "black" &&
+ !gameState.bricks[index]
+ ) {
+ if (Math.random() < comboKeepingRate(gameState.perks.respawn)) {
+ append(gameState.respawns, (b) => {
+ b.color = color;
+ b.index = index;
+ b.time = gameState.levelTime + (3 * 1000) / gameState.perks.respawn;
+ });
+ }
+ }
}
export function dontOfferTooSoon(gameState: GameState, id: PerkId) {
- gameState.lastOffered[id] = Math.round(Date.now() / 1000);
+ gameState.lastOffered[id] = Math.round(Date.now() / 1000);
}
export function pickRandomUpgrades(gameState: GameState, count: number) {
- let list = getPossibleUpgrades(gameState)
- .map((u) => ({
- ...u,
- score: Math.random() + (gameState.lastOffered[u.id] || 0),
- }))
- .sort((a, b) => a.score - b.score)
- .filter((u) => gameState.perks[u.id] < u.max + gameState.perks.limitless)
- .slice(0, count)
- .sort((a, b) => (a.id > b.id ? 1 : -1));
+ let list = getPossibleUpgrades(gameState)
+ .map((u) => ({
+ ...u,
+ score: Math.random() + (gameState.lastOffered[u.id] || 0),
+ }))
+ .sort((a, b) => a.score - b.score)
+ .filter((u) => gameState.perks[u.id] < u.max + gameState.perks.limitless)
+ .slice(0, count)
+ .sort((a, b) => (a.id > b.id ? 1 : -1));
- list.forEach((u) => {
- dontOfferTooSoon(gameState, u.id);
- });
+ list.forEach((u) => {
+ dontOfferTooSoon(gameState, u.id);
+ });
- return list.map((u) => ({
- text:
- u.name +
- (gameState.perks[u.id]
- ? t("level_up.upgrade_perk_to_level", {
- level: gameState.perks[u.id] + 1,
- })
- : ""),
- icon: icons["icon:" + u.id],
- value: u.id as PerkId,
- help: u.help(gameState.perks[u.id] + 1),
- }));
+ return list.map((u) => ({
+ text:
+ u.name +
+ (gameState.perks[u.id]
+ ? t("level_up.upgrade_perk_to_level", {
+ level: gameState.perks[u.id] + 1,
+ })
+ : ""),
+ icon: icons["icon:" + u.id],
+ value: u.id as PerkId,
+ help: u.help(gameState.perks[u.id] + 1),
+ }));
}
export function schedulGameSound(
- gameState: GameState,
- sound: keyof GameState["aboutToPlaySound"],
- x: number | void,
- vol: number,
+ gameState: GameState,
+ sound: keyof GameState["aboutToPlaySound"],
+ x: number | void,
+ vol: number,
) {
- if (!vol) return;
- if (!isOptionOn("sound")) return;
- x ??= gameState.offsetX + gameState.gameZoneWidth / 2;
- const ex = gameState.aboutToPlaySound[sound] as { vol: number; x: number };
+ if (!vol) return;
+ if (!isOptionOn("sound")) return;
+ x ??= gameState.offsetX + gameState.gameZoneWidth / 2;
+ const ex = gameState.aboutToPlaySound[sound] as { vol: number; x: number };
- ex.x = (x * vol + ex.x * ex.vol) / (vol + ex.vol);
- ex.vol += vol;
+ ex.x = (x * vol + ex.x * ex.vol) / (vol + ex.vol);
+ ex.vol += vol;
}
export function addToScore(gameState: GameState, coin: Coin) {
- gameState.score += coin.points;
- gameState.lastScoreIncrease = gameState.levelTime;
- addToTotalScore(gameState, coin.points);
- if (gameState.score > gameState.highScore && !gameState.creative) {
- gameState.highScore = gameState.score;
- localStorage.setItem("breakout-3-hs-short", gameState.score.toString());
- }
- if (!isOptionOn("basic")) {
- makeParticle(
- gameState,
- coin.previousX,
- coin.previousY,
- (gameState.canvasWidth - coin.x) / 100,
- -coin.y / 100,
- gameState.perks.metamorphosis || isOptionOn("colorful_coins")
- ? coin.color
- : "#ffd300",
+ gameState.score += coin.points;
+ gameState.lastScoreIncrease = gameState.levelTime;
+ addToTotalScore(gameState, coin.points);
+ if (gameState.score > gameState.highScore && !gameState.creative) {
+ gameState.highScore = gameState.score;
+ localStorage.setItem("breakout-3-hs-short", gameState.score.toString());
+ }
+ if (!isOptionOn("basic")) {
+ makeParticle(
+ gameState,
+ coin.previousX,
+ coin.previousY,
+ (gameState.canvasWidth - coin.x) / 100,
+ -coin.y / 100,
+ gameState.perks.metamorphosis || isOptionOn("colorful_coins")
+ ? coin.color
+ : "#ffd300",
- true,
- gameState.coinSize / 2,
- 100 + Math.random() * 50,
- );
- }
+ true,
+ gameState.coinSize / 2,
+ 100 + Math.random() * 50,
+ );
+ }
- schedulGameSound(gameState, "coinCatch", coin.x, 1);
- gameState.runStatistics.score += coin.points;
- if (gameState.perks.asceticism) {
- decreaseCombo(
- gameState,
- gameState.perks.asceticism * 3 * coin.points,
- coin.x,
- coin.y,
- );
- }
+ schedulGameSound(gameState, "coinCatch", coin.x, 1);
+ gameState.runStatistics.score += coin.points;
+ if (gameState.perks.asceticism) {
+ decreaseCombo(
+ gameState,
+ gameState.perks.asceticism * 3 * coin.points,
+ coin.x,
+ coin.y,
+ );
+ }
}
export async function setLevel(gameState: GameState, l: number) {
- // Here to alleviate double upgrades issues
- if (gameState.upgradesOfferedFor >= l) {
- debugger;
- return console.warn("Extra upgrade request ignored ");
- }
- gameState.upgradesOfferedFor = l;
- pause(false);
- stopRecording();
+ // Here to alleviate double upgrades issues
+ if (gameState.upgradesOfferedFor >= l) {
+ debugger;
+ return console.warn("Extra upgrade request ignored ");
+ }
+ gameState.upgradesOfferedFor = l;
+ pause(false);
+ stopRecording();
- if (l > 0) {
- await openUpgradesPicker(gameState);
- }
- gameState.currentLevel = l;
+ if (l > 0) {
+ await openUpgradesPicker(gameState);
+ }
+ gameState.currentLevel = l;
- gameState.level = gameState.runLevels[l];
+ gameState.level = gameState.runLevels[l];
- gameState.levelTime = 0;
- gameState.winAt = 0;
- gameState.levelWallBounces = 0;
- gameState.lastPuckMove = 0;
- gameState.autoCleanUses = 0;
- gameState.lastTickDown = gameState.levelTime;
- gameState.levelStartScore = gameState.score;
- gameState.levelSpawnedCoins = 0;
- gameState.levelLostCoins = 0;
- gameState.levelMisses = 0;
- gameState.lastBrickBroken = 0;
- gameState.runStatistics.levelsPlayed++;
+ gameState.levelTime = 0;
+ gameState.winAt = 0;
+ gameState.levelWallBounces = 0;
+ gameState.lastPuckMove = 0;
+ gameState.autoCleanUses = 0;
+ gameState.lastTickDown = gameState.levelTime;
+ gameState.levelStartScore = gameState.score;
+ gameState.levelSpawnedCoins = 0;
+ gameState.levelLostCoins = 0;
+ gameState.levelMisses = 0;
+ gameState.lastBrickBroken = 0;
+ gameState.runStatistics.levelsPlayed++;
- // Reset combo silently
- const finalCombo = gameState.combo;
- gameState.combo = baseCombo(gameState);
- if (gameState.perks.shunt) {
- gameState.combo += Math.round(
- Math.max(
- 0,
- (finalCombo - gameState.combo) *
- comboKeepingRate(gameState.perks.shunt),
- ),
- );
- }
+ // Reset combo silently
+ const finalCombo = gameState.combo;
+ gameState.combo = baseCombo(gameState);
+ if (gameState.perks.shunt) {
+ gameState.combo += Math.round(
+ Math.max(
+ 0,
+ (finalCombo - gameState.combo) *
+ comboKeepingRate(gameState.perks.shunt),
+ ),
+ );
+ }
- gameState.combo += gameState.perks.hot_start * 30;
+ gameState.combo += gameState.perks.hot_start * 30;
- const lvl = currentLevelInfo(gameState);
- if (lvl.size !== gameState.gridSize) {
- gameState.gridSize = lvl.size;
- fitSize(gameState);
- }
- gameState.levelLostCoins += empty(gameState.coins);
- empty(gameState.particles);
- empty(gameState.lights);
- empty(gameState.texts);
- empty(gameState.respawns);
- gameState.bricks = [];
+ const lvl = currentLevelInfo(gameState);
+ if (lvl.size !== gameState.gridSize) {
+ gameState.gridSize = lvl.size;
+ fitSize(gameState);
+ }
+ gameState.levelLostCoins += empty(gameState.coins);
+ empty(gameState.particles);
+ empty(gameState.lights);
+ empty(gameState.texts);
+ empty(gameState.respawns);
+ gameState.bricks = [];
- for (let i = 0; i < lvl.size * lvl.size; i++) {
- setBrick(gameState, i, lvl.bricks[i]);
- }
+ for (let i = 0; i < lvl.size * lvl.size; i++) {
+ setBrick(gameState, i, lvl.bricks[i]);
+ }
- // Balls color will depend on most common brick color sometimes
- resetBalls(gameState);
- gameState.needsRender = true;
- // This caused problems with accented characters like the ô of côte d'ivoire for odd reasons
- // background.src = 'data:image/svg+xml;base64,' + btoa(lvl.svg)
- background.src = "data:image/svg+xml;UTF8," + lvl.svg;
- document.body.style.setProperty("--level-background", lvl.color || "#000000");
- document
- .getElementById("themeColor")
- ?.setAttribute("content", lvl.color || "#000000");
+ // Balls color will depend on most common brick color sometimes
+ resetBalls(gameState);
+ gameState.needsRender = true;
+ // This caused problems with accented characters like the ô of côte d'ivoire for odd reasons
+ // background.src = 'data:image/svg+xml;base64,' + btoa(lvl.svg)
+ background.src = "data:image/svg+xml;UTF8," + lvl.svg;
+ document.body.style.setProperty("--level-background", lvl.color || "#000000");
+ document
+ .getElementById("themeColor")
+ ?.setAttribute("content", lvl.color || "#000000");
}
function setBrick(gameState: GameState, index: number, color: string) {
- gameState.bricks[index] = color || "";
- gameState.brickHP[index] =
- (color === "black" && 1) ||
- (color && 1 + gameState.perks.sturdy_bricks) ||
- 0;
- if (gameState.perks.minefield && color === "black") {
- increaseCombo(
- gameState,
- gameState.perks.minefield,
- brickCenterX(gameState, index),
- brickCenterY(gameState, index),
- );
- }
+ gameState.bricks[index] = color || "";
+ gameState.brickHP[index] =
+ (color === "black" && 1) ||
+ (color && 1 + gameState.perks.sturdy_bricks) ||
+ 0;
+ if (gameState.perks.minefield && color === "black") {
+ increaseCombo(
+ gameState,
+ gameState.perks.minefield,
+ brickCenterX(gameState, index),
+ brickCenterY(gameState, index),
+ );
+ }
}
const rainbow = [
- "#ff2e2e",
- "#ffe02e",
- "#70ff33",
- "#33ffa7",
- "#38acff",
- "#7038ff",
- "#ff3de5",
+ "#ff2e2e",
+ "#ffe02e",
+ "#70ff33",
+ "#33ffa7",
+ "#38acff",
+ "#7038ff",
+ "#ff3de5",
];
export function rainbowColor(): colorString {
- return rainbow[Math.floor(gameState.levelTime / 50) % rainbow.length];
+ return rainbow[Math.floor(gameState.levelTime / 50) % rainbow.length];
}
export function repulse(
- gameState: GameState,
- a: Ball,
- b: BallLike,
- power: number,
- impactsBToo: boolean,
+ gameState: GameState,
+ a: Ball,
+ b: BallLike,
+ power: number,
+ impactsBToo: boolean,
) {
- const distance = distanceBetween(a, b);
- // Ensure we don't get soft locked
- const max = gameState.gameZoneWidth / 4;
- if (distance > max) return;
- // Unit vector
- const dx = (a.x - b.x) / distance;
- const dy = (a.y - b.y) / distance;
- const fact =
- (((-power * (max - distance)) / (max * 1.2) / 3) *
- Math.min(500, gameState.levelTime)) /
- 500;
- if (
- impactsBToo &&
- typeof b.vx !== "undefined" &&
- typeof b.vy !== "undefined"
- ) {
- b.vx += dx * fact;
- b.vy += dy * fact;
- }
- a.vx -= dx * fact;
- a.vy -= dy * fact;
+ const distance = distanceBetween(a, b);
+ // Ensure we don't get soft locked
+ const max = gameState.gameZoneWidth / 4;
+ if (distance > max) return;
+ // Unit vector
+ const dx = (a.x - b.x) / distance;
+ const dy = (a.y - b.y) / distance;
+ const fact =
+ (((-power * (max - distance)) / (max * 1.2) / 3) *
+ Math.min(500, gameState.levelTime)) /
+ 500;
+ if (
+ impactsBToo &&
+ typeof b.vx !== "undefined" &&
+ typeof b.vy !== "undefined"
+ ) {
+ b.vx += dx * fact;
+ b.vy += dy * fact;
+ }
+ a.vx -= dx * fact;
+ a.vy -= dy * fact;
- const speed = 10;
- const rand = 2;
+ const speed = 10;
+ const rand = 2;
+ makeParticle(
+ gameState,
+ a.x,
+ a.y,
+ -dx * speed + a.vx + (Math.random() - 0.5) * rand,
+ -dy * speed + a.vy + (Math.random() - 0.5) * rand,
+ rainbowColor(),
+ true,
+ gameState.coinSize / 2,
+ 100,
+ );
+ if (
+ impactsBToo &&
+ typeof b.vx !== "undefined" &&
+ typeof b.vy !== "undefined"
+ ) {
makeParticle(
- gameState,
- a.x,
- a.y,
- -dx * speed + a.vx + (Math.random() - 0.5) * rand,
- -dy * speed + a.vy + (Math.random() - 0.5) * rand,
- rainbowColor(),
- true,
- gameState.coinSize / 2,
- 100,
+ gameState,
+ b.x,
+ b.y,
+ dx * speed + b.vx + (Math.random() - 0.5) * rand,
+ dy * speed + b.vy + (Math.random() - 0.5) * rand,
+ rainbowColor(),
+ true,
+ gameState.coinSize / 2,
+ 100,
);
- if (
- impactsBToo &&
- typeof b.vx !== "undefined" &&
- typeof b.vy !== "undefined"
- ) {
- makeParticle(
- gameState,
- b.x,
- b.y,
- dx * speed + b.vx + (Math.random() - 0.5) * rand,
- dy * speed + b.vy + (Math.random() - 0.5) * rand,
- rainbowColor(),
- true,
- gameState.coinSize / 2,
- 100,
- );
- }
+ }
}
export function attract(gameState: GameState, a: Ball, b: Ball, power: number) {
- const distance = distanceBetween(a, b);
- // Ensure we don't get soft locked
- const min = (gameState.gameZoneWidth * 3) / 4;
- if (distance < min) return;
- // Unit vector
- const dx = (a.x - b.x) / distance;
- const dy = (a.y - b.y) / distance;
+ const distance = distanceBetween(a, b);
+ // Ensure we don't get soft locked
+ const min = (gameState.gameZoneWidth * 3) / 4;
+ if (distance < min) return;
+ // Unit vector
+ const dx = (a.x - b.x) / distance;
+ const dy = (a.y - b.y) / distance;
- const fact =
- (((power * (distance - min)) / min) * Math.min(500, gameState.levelTime)) /
- 500;
- b.vx += dx * fact;
- b.vy += dy * fact;
- a.vx -= dx * fact;
- a.vy -= dy * fact;
+ const fact =
+ (((power * (distance - min)) / min) * Math.min(500, gameState.levelTime)) /
+ 500;
+ b.vx += dx * fact;
+ b.vy += dy * fact;
+ a.vx -= dx * fact;
+ a.vy -= dy * fact;
- const speed = 10;
- const rand = 2;
+ const speed = 10;
+ const rand = 2;
- makeParticle(
- gameState,
- a.x,
- a.y,
- dx * speed + a.vx + (Math.random() - 0.5) * rand,
- dy * speed + a.vy + (Math.random() - 0.5) * rand,
- rainbowColor(),
- true,
- gameState.coinSize / 2,
- 100,
- );
- makeParticle(
- gameState,
- b.x,
- b.y,
- -dx * speed + b.vx + (Math.random() - 0.5) * rand,
- -dy * speed + b.vy + (Math.random() - 0.5) * rand,
- rainbowColor(),
- true,
- gameState.coinSize / 2,
- 100,
- );
+ makeParticle(
+ gameState,
+ a.x,
+ a.y,
+ dx * speed + a.vx + (Math.random() - 0.5) * rand,
+ dy * speed + a.vy + (Math.random() - 0.5) * rand,
+ rainbowColor(),
+ true,
+ gameState.coinSize / 2,
+ 100,
+ );
+ makeParticle(
+ gameState,
+ b.x,
+ b.y,
+ -dx * speed + b.vx + (Math.random() - 0.5) * rand,
+ -dy * speed + b.vy + (Math.random() - 0.5) * rand,
+ rainbowColor(),
+ true,
+ gameState.coinSize / 2,
+ 100,
+ );
}
export function coinBrickHitCheck(gameState: GameState, coin: Coin) {
- // Make ball/coin bonce, and return bricks that were hit
- const radius = coin.size / 2;
- const {x, y, previousX, previousY} = coin;
+ // Make ball/coin bonce, and return bricks that were hit
+ const radius = coin.size / 2;
+ const { x, y, previousX, previousY } = coin;
- const vhit = hitsSomething(previousX, y, radius);
- const hhit = hitsSomething(x, previousY, radius);
- const chit =
- (typeof vhit == "undefined" &&
- typeof hhit == "undefined" &&
- hitsSomething(x, y, radius)) ||
- undefined;
+ const vhit = hitsSomething(previousX, y, radius);
+ const hhit = hitsSomething(x, previousY, radius);
+ const chit =
+ (typeof vhit == "undefined" &&
+ typeof hhit == "undefined" &&
+ hitsSomething(x, y, radius)) ||
+ undefined;
- if (gameState.perks.ghost_coins) {
- // slow down
- if (typeof (vhit ?? hhit ?? chit) !== "undefined") {
- coin.vy *= 1 - 0.2 / gameState.perks.ghost_coins;
- coin.vx *= 1 - 0.2 / gameState.perks.ghost_coins;
- }
- } else {
- if (typeof vhit !== "undefined" || typeof chit !== "undefined") {
- coin.y = coin.previousY;
- coin.vy *= -1;
-
- // Roll on corners
- const leftHit = gameState.bricks[brickIndex(x - radius, y + radius)];
- const rightHit = gameState.bricks[brickIndex(x + radius, y + radius)];
-
- if (leftHit && !rightHit) {
- coin.vx += 1;
- coin.sa -= 1;
- }
- if (!leftHit && rightHit) {
- coin.vx -= 1;
- coin.sa += 1;
- }
- }
- if (typeof hhit !== "undefined" || typeof chit !== "undefined") {
- coin.x = coin.previousX;
- coin.vx *= -1;
- }
+ if (gameState.perks.ghost_coins) {
+ // slow down
+ if (typeof (vhit ?? hhit ?? chit) !== "undefined") {
+ coin.vy *= 1 - 0.2 / gameState.perks.ghost_coins;
+ coin.vx *= 1 - 0.2 / gameState.perks.ghost_coins;
}
- return vhit ?? hhit ?? chit;
+ } else {
+ if (typeof vhit !== "undefined" || typeof chit !== "undefined") {
+ coin.y = coin.previousY;
+ coin.vy *= -1;
+
+ // Roll on corners
+ const leftHit = gameState.bricks[brickIndex(x - radius, y + radius)];
+ const rightHit = gameState.bricks[brickIndex(x + radius, y + radius)];
+
+ if (leftHit && !rightHit) {
+ coin.vx += 1;
+ coin.sa -= 1;
+ }
+ if (!leftHit && rightHit) {
+ coin.vx -= 1;
+ coin.sa += 1;
+ }
+ }
+ if (typeof hhit !== "undefined" || typeof chit !== "undefined") {
+ coin.x = coin.previousX;
+ coin.vx *= -1;
+ }
+ }
+ return vhit ?? hhit ?? chit;
}
export function bordersHitCheck(
- gameState: GameState,
- coin: Coin | Ball,
- radius: number,
- delta: number,
+ gameState: GameState,
+ coin: Coin | Ball,
+ radius: number,
+ delta: number,
) {
- if (coin.destroyed) return;
- coin.previousX = coin.x;
- coin.previousY = coin.y;
- coin.x += coin.vx * delta;
- coin.y += coin.vy * delta;
+ if (coin.destroyed) return;
+ coin.previousX = coin.x;
+ coin.previousY = coin.y;
+ coin.x += coin.vx * delta;
+ coin.y += coin.vy * delta;
- if (gameState.perks.wind) {
- coin.vx +=
- ((gameState.puckPosition -
- (gameState.offsetX + gameState.gameZoneWidth / 2)) /
- gameState.gameZoneWidth) *
- gameState.perks.wind *
- 0.5;
- }
+ if (gameState.perks.wind) {
+ coin.vx +=
+ ((gameState.puckPosition -
+ (gameState.offsetX + gameState.gameZoneWidth / 2)) /
+ gameState.gameZoneWidth) *
+ gameState.perks.wind *
+ 0.5;
+ }
- let vhit = 0,
- hhit = 0;
+ let vhit = 0,
+ hhit = 0;
- if (
- coin.x < gameState.offsetXRoundedDown + radius
- ) {
- coin.x =
- gameState.offsetXRoundedDown +
- radius +
- (gameState.offsetXRoundedDown + radius - coin.x);
- coin.vx *= -1;
- hhit = 1;
- }
- if (coin.y < radius) {
- coin.y = radius + (radius - coin.y);
- coin.vy *= -1;
- vhit = 1;
- }
- if (
- coin.x > gameState.canvasWidth - gameState.offsetXRoundedDown - radius
- ) {
- coin.x =
- gameState.canvasWidth -
- gameState.offsetXRoundedDown -
- radius -
- (coin.x -
- (gameState.canvasWidth - gameState.offsetXRoundedDown - radius));
- coin.vx *= -1;
- hhit = 1;
- }
+ if (coin.x < gameState.offsetXRoundedDown + radius) {
+ coin.x =
+ gameState.offsetXRoundedDown +
+ radius +
+ (gameState.offsetXRoundedDown + radius - coin.x);
+ coin.vx *= -1;
+ hhit = 1;
+ }
+ if (coin.y < radius) {
+ coin.y = radius + (radius - coin.y);
+ coin.vy *= -1;
+ vhit = 1;
+ }
+ if (coin.x > gameState.canvasWidth - gameState.offsetXRoundedDown - radius) {
+ coin.x =
+ gameState.canvasWidth -
+ gameState.offsetXRoundedDown -
+ radius -
+ (coin.x -
+ (gameState.canvasWidth - gameState.offsetXRoundedDown - radius));
+ coin.vx *= -1;
+ hhit = 1;
+ }
- return hhit + vhit * 2;
+ return hhit + vhit * 2;
}
export function gameStateTick(
- gameState: GameState,
- // How many frames to compute at once, can go above 1 to compensate lag
- frames = 1,
+ gameState: GameState,
+ // How many frames to compute at once, can go above 1 to compensate lag
+ frames = 1,
) {
- gameState.runStatistics.max_combo = Math.max(
- gameState.runStatistics.max_combo,
- gameState.combo,
+ gameState.runStatistics.max_combo = Math.max(
+ gameState.runStatistics.max_combo,
+ gameState.combo,
+ );
+
+ gameState.lastCombo = gameState.combo;
+
+ if (
+ gameState.perks.addiction &&
+ gameState.lastBrickBroken &&
+ gameState.lastBrickBroken <
+ gameState.levelTime - 5000 / gameState.perks.addiction
+ ) {
+ resetCombo(
+ gameState,
+ gameState.puckPosition,
+ gameState.gameZoneHeight - gameState.puckHeight * 2,
);
+ }
- gameState.lastCombo = gameState.combo;
+ gameState.balls = gameState.balls.filter((ball) => !ball.destroyed);
- if (
- gameState.perks.addiction &&
- gameState.lastBrickBroken &&
- gameState.lastBrickBroken <
- gameState.levelTime - 5000 / gameState.perks.addiction
- ) {
- resetCombo(
- gameState,
- gameState.puckPosition,
- gameState.gameZoneHeight - gameState.puckHeight * 2,
- );
+ const remainingBricks = gameState.bricks.filter(
+ (b) => b && b !== "black",
+ ).length;
+
+ if (!remainingBricks && gameState.lastBrickBroken) {
+ // Avoid a combo reset just because we're waiting for coins
+ gameState.lastBrickBroken = 0;
+ }
+
+ if (
+ gameState.levelTime > gameState.lastTickDown + 1000 &&
+ gameState.perks.hot_start
+ ) {
+ gameState.lastTickDown = gameState.levelTime;
+ decreaseCombo(
+ gameState,
+ gameState.perks.hot_start,
+ gameState.puckPosition,
+ gameState.gameZoneHeight - 2 * gameState.puckHeight,
+ );
+ }
+
+ if (
+ remainingBricks <= gameState.perks.skip_last &&
+ !gameState.autoCleanUses
+ ) {
+ gameState.bricks.forEach((type, index) => {
+ if (type) {
+ explodeBrick(gameState, index, gameState.balls[0], true);
+ }
+ });
+ gameState.autoCleanUses++;
+ }
+
+ const hasPendingBricks = liveCount(gameState.respawns);
+
+ if (gameState.running && !remainingBricks && !hasPendingBricks) {
+ if (!gameState.winAt) {
+ gameState.winAt = gameState.levelTime + 5000;
}
+ } else {
+ gameState.winAt = 0;
+ }
- gameState.balls = gameState.balls.filter((ball) => !ball.destroyed);
-
- const remainingBricks = gameState.bricks.filter(
- (b) => b && b !== "black",
- ).length;
-
- if (!remainingBricks && gameState.lastBrickBroken) {
- // Avoid a combo reset just because we're waiting for coins
- gameState.lastBrickBroken = 0;
- }
-
- if (
- gameState.levelTime > gameState.lastTickDown + 1000 &&
- gameState.perks.hot_start
- ) {
- gameState.lastTickDown = gameState.levelTime;
- decreaseCombo(
- gameState,
- gameState.perks.hot_start,
- gameState.puckPosition,
- gameState.gameZoneHeight - 2 * gameState.puckHeight,
- );
- }
-
- if (
- remainingBricks <= gameState.perks.skip_last &&
- !gameState.autoCleanUses
- ) {
- gameState.bricks.forEach((type, index) => {
- if (type) {
- explodeBrick(gameState, index, gameState.balls[0], true);
- }
- });
- gameState.autoCleanUses++;
- }
-
- const hasPendingBricks = liveCount(gameState.respawns);
-
- if (gameState.running && !remainingBricks && !hasPendingBricks) {
- if (!gameState.winAt) {
- gameState.winAt = gameState.levelTime + 5000;
- }
+ if (
+ (gameState.running &&
+ // Delayed win when coins are still flying
+ gameState.winAt &&
+ gameState.levelTime > gameState.winAt) ||
+ // instant win condition
+ (gameState.levelTime && !remainingBricks && !liveCount(gameState.coins))
+ ) {
+ if (gameState.currentLevel + 1 < max_levels(gameState)) {
+ setLevel(gameState, gameState.currentLevel + 1);
} else {
- gameState.winAt = 0;
+ gameOver(
+ t("gameOver.win.title"),
+ t("gameOver.win.summary", { score: gameState.score }),
+ );
}
+ } else if (gameState.running || gameState.levelTime) {
+ const coinRadius = Math.round(gameState.coinSize / 2);
- if (
- (gameState.running &&
- // Delayed win when coins are still flying
- gameState.winAt &&
- gameState.levelTime > gameState.winAt) ||
- // instant win condition
- (gameState.levelTime && !remainingBricks && !liveCount(gameState.coins))
- ) {
- if (gameState.currentLevel + 1 < max_levels(gameState)) {
- setLevel(gameState, gameState.currentLevel + 1);
- } else {
- gameOver(
- t("gameOver.win.title"),
- t("gameOver.win.summary", {score: gameState.score}),
- );
- }
- } else if (gameState.running || gameState.levelTime) {
- const coinRadius = Math.round(gameState.coinSize / 2);
+ forEachLiveOne(gameState.coins, (coin, coinIndex) => {
+ if (gameState.perks.coin_magnet) {
+ const strength =
+ (100 /
+ (100 +
+ Math.pow(coin.y - gameState.gameZoneHeight, 2) +
+ Math.pow(coin.x - gameState.puckPosition, 2))) *
+ gameState.perks.coin_magnet;
- forEachLiveOne(gameState.coins, (coin, coinIndex) => {
- if (gameState.perks.coin_magnet) {
- const strength =
- (100 /
- (100 +
- Math.pow(coin.y - gameState.gameZoneHeight, 2) +
- Math.pow(coin.x - gameState.puckPosition, 2))) *
- gameState.perks.coin_magnet;
+ const attractionX =
+ frames * (gameState.puckPosition - coin.x) * strength;
- const attractionX =
- frames * (gameState.puckPosition - coin.x) * strength;
+ coin.vx += attractionX;
+ coin.vy +=
+ (frames * (gameState.gameZoneHeight - coin.y) * strength) / 2;
+ coin.sa -= attractionX / 10;
+ }
- coin.vx += attractionX;
- coin.vy +=
- (frames * (gameState.gameZoneHeight - coin.y) * strength) / 2;
- coin.sa -= attractionX / 10;
- }
-
- if (gameState.perks.ball_attracts_coins && gameState.balls.length) {
- // Find closest ball
- let closestBall = getClosestBall(gameState, coin.x, coin.y);
- if (closestBall) {
- let dist = distance2(closestBall, coin);
-
- const minDist = gameState.brickWidth * gameState.brickWidth;
- if (
- dist > minDist &&
- dist < minDist * 4 * 4 * gameState.perks.ball_attracts_coins
- ) {
- // Slow down coins in effect radius
- const ratio =
- 1 - 0.02 * (0.5 + gameState.perks.ball_attracts_coins);
- coin.vx *= ratio;
- coin.vy *= ratio;
- coin.vy *= ratio;
- // Carry them
- const dx =
- ((closestBall.x - coin.x) / dist) *
- 50 *
- gameState.perks.ball_attracts_coins;
- const dy =
- ((closestBall.y - coin.y) / dist) *
- 50 *
- gameState.perks.ball_attracts_coins;
- coin.vx += dx;
- coin.vy += dy;
-
- if (
- !isOptionOn("basic") &&
- Math.random() * gameState.perks.ball_attracts_coins * frames > 0.9
- ) {
- makeParticle(
- gameState,
- coin.x + dx * 5,
- coin.y + dy * 5,
- dx * 2,
- dy * 2,
- rainbowColor(),
- true,
- gameState.coinSize / 2,
- 100,
- );
- }
- }
- }
- }
-
- if (gameState.perks.bricks_attract_coins) {
- goToNearestBrick(gameState, coin, gameState.perks.bricks_attract_coins * frames, 2,false)
- }
+ if (gameState.perks.ball_attracts_coins && gameState.balls.length) {
+ // Find closest ball
+ let closestBall = getClosestBall(gameState, coin.x, coin.y);
+ if (closestBall) {
+ let dist = distance2(closestBall, coin);
+ const minDist = gameState.brickWidth * gameState.brickWidth;
+ if (
+ dist > minDist &&
+ dist < minDist * 4 * 4 * gameState.perks.ball_attracts_coins
+ ) {
+ // Slow down coins in effect radius
const ratio =
- 1 -
- ((gameState.perks.viscosity * 0.03 + 0.002) * frames) /
- (1 + gameState.perks.etherealcoins);
- if (!gameState.perks.etherealcoins) {
- coin.vy *= ratio;
- coin.vx *= ratio;
- }
- if (coin.vx > 7 * gameState.baseSpeed) coin.vx = 7 * gameState.baseSpeed;
- if (coin.vx < -7 * gameState.baseSpeed)
- coin.vx = -7 * gameState.baseSpeed;
- if (coin.vy > 7 * gameState.baseSpeed) coin.vy = 7 * gameState.baseSpeed;
- if (coin.vy < -7 * gameState.baseSpeed)
- coin.vy = -7 * gameState.baseSpeed;
- coin.a += coin.sa;
-
- // Gravity
- const flip =
- gameState.perks.helium > 0 &&
- Math.abs(coin.x - gameState.puckPosition) * 2 >
- gameState.puckWidth + coin.size;
- let dvy =
- frames * coin.weight * 0.8 * (flip ? -gameState.perks.helium : 1);
-
- if (gameState.perks.etherealcoins) {
- if (gameState.perks.helium) {
- dvy *= 0.2 / gameState.perks.etherealcoins;
- } else {
- dvy *= 0;
- }
- }
-
- coin.vy += dvy;
+ 1 - 0.02 * (0.5 + gameState.perks.ball_attracts_coins);
+ coin.vx *= ratio;
+ coin.vy *= ratio;
+ coin.vy *= ratio;
+ // Carry them
+ const dx =
+ ((closestBall.x - coin.x) / dist) *
+ 50 *
+ gameState.perks.ball_attracts_coins;
+ const dy =
+ ((closestBall.y - coin.y) / dist) *
+ 50 *
+ gameState.perks.ball_attracts_coins;
+ coin.vx += dx;
+ coin.vy += dy;
if (
- gameState.perks.helium &&
- !isOptionOn("basic") &&
- Math.random() < 0.1 * frames
+ !isOptionOn("basic") &&
+ Math.random() * gameState.perks.ball_attracts_coins * frames > 0.9
) {
- makeParticle(
- gameState,
- coin.x,
- coin.y,
- 0,
- dvy * 10,
- gameState.perks.metamorphosis || isOptionOn("colorful_coins")
- ? coin.color
- : "#ffd300",
- true,
- 5,
- 250,
- );
- }
-
- const speed = (Math.abs(coin.vx) + Math.abs(coin.vy)) * 10;
- const hitBorder = bordersHitCheck(gameState, coin, coin.size / 2, frames);
-
- if (
- coin.y > gameState.gameZoneHeight - coinRadius - gameState.puckHeight &&
- coin.y < gameState.gameZoneHeight + gameState.puckHeight + coin.vy &&
- Math.abs(coin.x - gameState.puckPosition) <
- coinRadius +
- gameState.puckWidth / 2 +
- // a bit of margin to be nice , negative in case it's a negative coin
- gameState.puckHeight * (coin.points ? 1 : -1)
- ) {
- addToScore(gameState, coin);
- destroy(gameState.coins, coinIndex);
- } else if (coin.y > gameState.canvasHeight + coinRadius * 10) {
- gameState.levelLostCoins += coin.points;
- destroy(gameState.coins, coinIndex);
- if (gameState.perks.compound_interest) {
- resetCombo(gameState, coin.x, gameState.gameZoneHeight - 20);
- }
- if (
- gameState.combo < gameState.perks.fountain_toss * 30 &&
- Math.random() < (1 / gameState.combo) * gameState.perks.fountain_toss
- ) {
- increaseCombo(gameState, 1, coin.x, gameState.gameZoneHeight - 20);
- }
- }
-
- const hitBrick = coinBrickHitCheck(gameState, coin);
- if (gameState.perks.metamorphosis && typeof hitBrick !== "undefined") {
- if (
- gameState.bricks[hitBrick] &&
- coin.color !== gameState.bricks[hitBrick] &&
- gameState.bricks[hitBrick] !== "black" &&
- coin.metamorphosisPoints
- ) {
- // Not using setbrick because we don't want to reset HP
- gameState.bricks[hitBrick] = coin.color;
- coin.metamorphosisPoints--;
- schedulGameSound(gameState, "colorChange", coin.x, 0.3);
-
- if (gameState.perks.hypnosis) {
- const closestBall = getClosestBall(gameState, coin.x, coin.y);
- if (closestBall) {
- coin.x = closestBall.x;
- coin.y = closestBall.y;
- coin.vx = (Math.random() - 0.5) * gameState.baseSpeed;
- coin.vy = (Math.random() - 0.5) * gameState.baseSpeed;
- coin.metamorphosisPoints = gameState.perks.metamorphosis;
- }
- }
- }
- }
-
- if (
- (!gameState.perks.ghost_coins && typeof hitBrick !== "undefined") ||
- hitBorder
- ) {
- const ratio = 1 - 0.2 / (1 + gameState.perks.etherealcoins);
- coin.vx *= ratio;
- coin.vy *= ratio;
- if (Math.abs(coin.vy) < 1) {
- coin.vy = 0;
- }
- coin.sa *= 0.9;
- if (speed > 20 && !coin.collidedLastFrame) {
- schedulGameSound(gameState, "coinBounce", coin.x, 0.2);
- }
- coin.collidedLastFrame = true;
- } else {
- coin.collidedLastFrame = false;
- }
- });
-
- gameState.balls.forEach((ball) => ballTick(gameState, ball, frames));
-
- if (gameState.perks.shocks) {
- gameState.balls.forEach((a, ai) =>
- gameState.balls.forEach((b, bi) => {
- if (
- ai < bi &&
- !a.destroyed &&
- !b.destroyed &&
- distance2(a, b) < gameState.ballSize * gameState.ballSize
- ) {
- let tempVx = a.vx;
- let tempVy = a.vy;
- a.vx = b.vx;
- a.vy = b.vy;
- b.vx = tempVx;
- b.vy = tempVy;
-
- let x = (a.x + b.x) / 2;
- let y = (a.y + b.y) / 2;
- const limit = gameState.baseSpeed;
- a.vx +=
- clamp(a.x - x, -limit, limit) +
- ((Math.random() - 0.5) * limit) / 3;
- a.vy +=
- clamp(a.y - y, -limit, limit) +
- ((Math.random() - 0.5) * limit) / 3;
- b.vx +=
- clamp(b.x - x, -limit, limit) +
- ((Math.random() - 0.5) * limit) / 3;
- b.vy +=
- clamp(b.y - y, -limit, limit) +
- ((Math.random() - 0.5) * limit) / 3;
-
- let index = brickIndex(x, y);
- explosionAt(
- gameState,
- index,
- x,
- y,
- a,
- Math.max(0, gameState.perks.shocks - 1),
- );
- }
- }),
- );
- }
-
- if (gameState.perks.wind) {
- const windD =
- ((gameState.puckPosition -
- (gameState.offsetX + gameState.gameZoneWidth / 2)) /
- gameState.gameZoneWidth) *
- 2 *
- gameState.perks.wind;
- for (let i = 0; i < gameState.perks.wind; i++) {
- if (Math.random() * Math.abs(windD) > 0.5) {
- makeParticle(
- gameState,
- gameState.offsetXRoundedDown +
- Math.random() * gameState.gameZoneWidthRoundedUp,
- Math.random() * gameState.gameZoneHeight,
- windD * 8,
- 0,
- rainbowColor(),
- true,
- gameState.coinSize / 2,
- 150,
- );
- }
- }
- }
- forEachLiveOne(gameState.particles, (flash, index) => {
- flash.x += flash.vx * frames;
- flash.y += flash.vy * frames;
- if (!flash.ethereal) {
- flash.vy += 0.5 * frames;
- if (hasBrick(brickIndex(flash.x, flash.y))) {
- destroy(gameState.particles, index);
- }
- }
- });
- }
-
- if (
- gameState.combo > baseCombo(gameState) &&
- !isOptionOn("basic") &&
- (gameState.combo - baseCombo(gameState)) * Math.random() > 5
- ) {
- // The red should still be visible on a white bg
-
- if (gameState.perks.top_is_lava) {
- makeParticle(
+ makeParticle(
gameState,
- gameState.offsetXRoundedDown +
- Math.random() * gameState.gameZoneWidthRoundedUp,
- 0,
- (Math.random() - 0.5) * 10,
- 5,
- "#FF0000",
- true,
- gameState.coinSize / 2,
- 100 * (Math.random() + 1),
- );
- }
-
- if (gameState.perks.left_is_lava) {
- makeParticle(
- gameState,
- gameState.offsetXRoundedDown,
- Math.random() * gameState.gameZoneHeight,
- 5,
- (Math.random() - 0.5) * 10,
- "#FF0000",
- true,
- gameState.coinSize / 2,
- 100 * (Math.random() + 1),
- );
- }
-
- if (gameState.perks.right_is_lava) {
- makeParticle(
- gameState,
- gameState.offsetXRoundedDown + gameState.gameZoneWidthRoundedUp,
- Math.random() * gameState.gameZoneHeight,
- -5,
- (Math.random() - 0.5) * 10,
- "#FF0000",
- true,
- gameState.coinSize / 2,
- 100 * (Math.random() + 1),
- );
- }
-
- if (gameState.perks.compound_interest) {
- let x = gameState.puckPosition,
- attemps = 0;
- do {
- x =
- gameState.offsetXRoundedDown +
- gameState.gameZoneWidthRoundedUp * Math.random();
- attemps++;
- } while (
- Math.abs(x - gameState.puckPosition) < gameState.puckWidth / 2 &&
- attemps < 10
- );
-
- makeParticle(
- gameState,
- x,
- gameState.gameZoneHeight,
- (Math.random() - 0.5) * 10,
- -5,
- "#FF0000",
- true,
- gameState.coinSize / 2,
- 100 * (Math.random() + 1),
- );
- }
- if (gameState.perks.streak_shots) {
- const pos = 0.5 - Math.random();
- makeParticle(
- gameState,
- gameState.puckPosition + gameState.puckWidth * pos,
- gameState.gameZoneHeight - gameState.puckHeight,
- pos * 10,
- -5,
- "#FF0000",
- true,
- gameState.coinSize / 2,
- 100 * (Math.random() + 1),
- );
- }
- }
-
- // Respawn what's needed, show particles
- forEachLiveOne(gameState.respawns, (r, ri) => {
- if (gameState.bricks[r.index]) {
- destroy(gameState.respawns, ri);
- } else if (gameState.levelTime > r.time) {
- setBrick(gameState, r.index, r.color);
- destroy(gameState.respawns, ri);
- } else {
- const {index, color} = r;
- const vertical = Math.random() > 0.5;
- const dx = Math.random() > 0.5 ? 1 : -1;
- const dy = Math.random() > 0.5 ? 1 : -1;
-
- makeParticle(
- gameState,
- brickCenterX(gameState, index) + (dx * gameState.brickWidth) / 2,
- brickCenterY(gameState, index) + (dy * gameState.brickWidth) / 2,
- vertical ? 0 : -dx * gameState.baseSpeed,
- vertical ? -dy * gameState.baseSpeed : 0,
- color,
- true,
- gameState.coinSize / 2,
- 250,
- );
- }
- });
-
- forEachLiveOne(gameState.particles, (p, pi) => {
- if (gameState.levelTime > p.time + p.duration) {
- destroy(gameState.particles, pi);
- }
- });
- forEachLiveOne(gameState.texts, (p, pi) => {
- if (gameState.levelTime > p.time + p.duration) {
- destroy(gameState.texts, pi);
- }
- });
- forEachLiveOne(gameState.lights, (p, pi) => {
- if (gameState.levelTime > p.time + p.duration) {
- destroy(gameState.lights, pi);
- }
- });
-}
-
-export function ballTick(gameState: GameState, ball: Ball, frames: number) {
- ball.previousVX = ball.vx;
- ball.previousVY = ball.vy;
-
- let speedLimitDampener =
- 1 +
- gameState.perks.telekinesis +
- gameState.perks.ball_repulse_ball +
- gameState.perks.puck_repulse_ball +
- gameState.perks.ball_attract_ball;
-
- if (telekinesisEffectRate(gameState, ball) > 0) {
- speedLimitDampener += 3;
- ball.vx +=
- ((gameState.puckPosition - ball.x) / 1000) *
- frames *
- gameState.perks.telekinesis *
- telekinesisEffectRate(gameState, ball);
- }
- if (yoyoEffectRate(gameState, ball) > 0) {
- speedLimitDampener += 3;
-
- ball.vx +=
- ((gameState.puckPosition - ball.x) / 1000) *
- frames *
- gameState.perks.yoyo *
- yoyoEffectRate(gameState, ball);
- }
-
- if (ball.hitSinceBounce < gameState.perks.bricks_attract_ball * 3) {
- goToNearestBrick(gameState, ball, gameState.perks.bricks_attract_ball * frames * 0.2,
- 2 + gameState.perks.bricks_attract_ball,Math.random()<0.5*frames)
- }
-
- if (
- ball.vx * ball.vx + ball.vy * ball.vy <
- gameState.baseSpeed * gameState.baseSpeed * 2
- ) {
- ball.vx *= 1 + 0.02 / speedLimitDampener;
- ball.vy *= 1 + 0.02 / speedLimitDampener;
- } else {
- ball.vx *= 1 - 0.02 / speedLimitDampener;
- ball.vy *= 1 - 0.02 / speedLimitDampener;
- }
- // Ball could get stuck horizontally because of ball-ball interactions in repulse/attract
- if (Math.abs(ball.vy) < 0.2 * gameState.baseSpeed) {
- ball.vy += ((ball.vy > 0 ? 1 : -1) * 0.02) / speedLimitDampener;
- }
-
- if (gameState.perks.ball_repulse_ball) {
- for (let b2 of gameState.balls) {
- // avoid computing this twice, and repulsing itself
- if (b2.x >= ball.x) continue;
- repulse(gameState, ball, b2, gameState.perks.ball_repulse_ball, true);
- }
- }
- if (gameState.perks.ball_attract_ball) {
- for (let b2 of gameState.balls) {
- // avoid computing this twice, and repulsing itself
- if (b2.x >= ball.x) continue;
- attract(gameState, ball, b2, gameState.perks.ball_attract_ball);
- }
- }
- if (
- gameState.perks.puck_repulse_ball &&
- Math.abs(ball.x - gameState.puckPosition) <
- gameState.puckWidth / 2 +
- (gameState.ballSize * (9 + gameState.perks.puck_repulse_ball)) / 10
- ) {
- repulse(
- gameState,
- ball,
- {
- x: gameState.puckPosition,
- y: gameState.gameZoneHeight,
- },
- gameState.perks.puck_repulse_ball + 1,
- false,
- );
- }
-
- const borderHitCode = bordersHitCheck(
- gameState,
- ball,
- gameState.ballSize / 2,
- frames,
- );
- if (borderHitCode) {
- if (
- gameState.perks.left_is_lava &&
- borderHitCode % 2 &&
- ball.x < gameState.offsetX + gameState.gameZoneWidth / 2
- ) {
- resetCombo(gameState, ball.x, ball.y);
- }
-
- if (
- gameState.perks.right_is_lava &&
- borderHitCode % 2 &&
- ball.x > gameState.offsetX + gameState.gameZoneWidth / 2
- ) {
- resetCombo(gameState, ball.x, ball.y);
- }
-
- if (gameState.perks.top_is_lava && borderHitCode >= 2) {
- resetCombo(gameState, ball.x, ball.y + gameState.ballSize * 3);
- }
- if (gameState.perks.trampoline) {
- decreaseCombo(
- gameState,
- gameState.perks.trampoline,
- ball.x,
- ball.y + gameState.ballSize,
- );
- }
-
- schedulGameSound(gameState, "wallBeep", ball.x, 1);
- gameState.levelWallBounces++;
- gameState.runStatistics.wall_bounces++;
- }
-
- // Puck collision
- const ylimit =
- gameState.gameZoneHeight - gameState.puckHeight - gameState.ballSize / 2;
- const ballIsUnderPuck =
- Math.abs(ball.x - gameState.puckPosition) <
- gameState.ballSize / 2 + gameState.puckWidth / 2;
- if (
- ball.y > ylimit &&
- ball.vy > 0 &&
- (ballIsUnderPuck ||
- (gameState.balls.length < 2 &&
- gameState.perks.extra_life &&
- ball.y > ylimit + gameState.puckHeight / 2))
- ) {
- if (ballIsUnderPuck) {
- const speed = Math.sqrt(ball.vx * ball.vx + ball.vy * ball.vy);
- const angle = Math.atan2(
- -gameState.puckWidth / 2,
- (ball.x - gameState.puckPosition) *
- (gameState.perks.concave_puck
- ? -1 / (1 + gameState.perks.concave_puck)
- : 1),
- );
- ball.vx = speed * Math.cos(angle);
- ball.vy = speed * Math.sin(angle);
- schedulGameSound(gameState, "wallBeep", ball.x, 1);
- } else {
- ball.vy *= -1;
- justLostALife(gameState, ball, ball.x, ball.y);
- }
- if (gameState.perks.streak_shots) {
- resetCombo(gameState, ball.x, ball.y);
- }
- if (gameState.perks.trampoline) {
- increaseCombo(gameState, gameState.perks.trampoline, ball.x, ball.y);
- }
- if (
- gameState.perks.nbricks &&
- ball.hitSinceBounce < gameState.perks.nbricks
- ) {
- resetCombo(gameState, ball.x, ball.y);
- }
-
- if (!ball.hitSinceBounce && gameState.bricks.find((i) => i)) {
- gameState.runStatistics.misses++;
- if (gameState.perks.forgiving) {
- const loss = Math.floor(
- (gameState.levelMisses / 10 / gameState.perks.forgiving) *
- (gameState.combo - baseCombo(gameState)),
- );
- decreaseCombo(gameState, loss, ball.x, ball.y - gameState.ballSize);
- } else {
- resetCombo(gameState, ball.x, ball.y);
- }
- gameState.levelMisses++;
- makeText(
- gameState,
- gameState.puckPosition,
- gameState.gameZoneHeight - gameState.puckHeight * 2,
- "#FF0000",
- t("play.missed_ball"),
- gameState.puckHeight,
- 500,
- );
- }
- gameState.runStatistics.puck_bounces++;
- ball.hitSinceBounce = 0;
- ball.brokenSinceBounce = 0;
- ball.sapperUses = 0;
- ball.piercePoints = gameState.perks.pierce * 3;
- }
-
- if (
- gameState.running && (ball.y > gameState.gameZoneHeight + gameState.ballSize / 2)
- ) {
- ball.destroyed = true;
- gameState.runStatistics.balls_lost++;
- if (!gameState.balls.find((b) => !b.destroyed)) {
- gameOver(
- t("gameOver.lost.title"),
- t("gameOver.lost.summary", {score: gameState.score}),
- );
- }
- }
- const radius = gameState.ballSize / 2;
- // Make ball/coin bonce, and return bricks that were hit
- const {x, y, previousX, previousY} = ball;
-
- const vhit = hitsSomething(previousX, y, radius);
- const hhit = hitsSomething(x, previousY, radius);
- const chit =
- (typeof vhit == "undefined" &&
- typeof hhit == "undefined" &&
- hitsSomething(x, y, radius)) ||
- undefined;
-
- const hitBrick = vhit ?? hhit ?? chit;
-
- if (typeof hitBrick !== "undefined") {
- const initialBrickColor = gameState.bricks[hitBrick];
- ball.hitSinceBounce++;
-
- if (gameState.perks.nbricks) {
- if (ball.hitSinceBounce > gameState.perks.nbricks) {
- resetCombo(gameState, ball.x, ball.y);
- } else {
- increaseCombo(gameState, gameState.perks.nbricks, ball.x, ball.y);
- }
- // We need to reset at each hit, otherwise it's just an OP version of single puck hit streak
- }
-
- let pierce = false;
- let damage =
- 1 +
- (shouldPierceByColor(gameState, vhit, hhit, chit)
- ? gameState.perks.pierce_color
- : 0);
-
- gameState.brickHP[hitBrick] -= damage;
-
- const used = Math.min(
- ball.piercePoints,
- Math.max(1, gameState.brickHP[hitBrick] + 1),
- );
- gameState.brickHP[hitBrick] -= used;
- ball.piercePoints -= used;
-
- if (gameState.brickHP[hitBrick] < 0) {
- gameState.brickHP[hitBrick] = 0;
- pierce = true;
- }
- if (typeof vhit !== "undefined" || typeof chit !== "undefined") {
- if (!pierce) {
- ball.y = ball.previousY;
- ball.vy *= -1;
- }
- }
- if (typeof hhit !== "undefined" || typeof chit !== "undefined") {
- if (!pierce) {
- ball.x = ball.previousX;
- ball.vx *= -1;
- }
- }
-
- if (!gameState.brickHP[hitBrick]) {
- ball.brokenSinceBounce++;
-
- explodeBrick(gameState, hitBrick, ball, false);
- if (
- ball.sapperUses < gameState.perks.sapper &&
- initialBrickColor !== "black" && // don't replace a brick that bounced with sturdy_bricks
- !gameState.bricks[hitBrick]
- ) {
- setBrick(gameState, hitBrick, "black");
- ball.sapperUses++;
- }
- } else {
- schedulGameSound(gameState, "wallBeep", x, 1);
- makeLight(
- gameState,
- brickCenterX(gameState, hitBrick),
- brickCenterY(gameState, hitBrick),
- "#FFFFFF",
- gameState.brickWidth + 2,
- 50 * gameState.brickHP[hitBrick],
- );
- }
- }
-
- if (
- !isOptionOn("basic") &&
- ballTransparency(ball, gameState) < Math.random()
- ) {
- const remainingPierce = ball.piercePoints;
- const remainingSapper = ball.sapperUses < gameState.perks.sapper;
- const willMiss =
- isOptionOn("red_miss") && ball.vy > 0 && !ball.hitSinceBounce;
- const extraCombo = gameState.combo - 1;
-
- if (
- willMiss ||
- (extraCombo && Math.random() > 0.1 / (1 + extraCombo)) ||
- (remainingSapper && Math.random() > 0.1 / (1 + remainingSapper)) ||
- (extraCombo && Math.random() > 0.1 / (1 + extraCombo))
- ) {
- const color =
- (remainingSapper && (Math.random() > 0.5 ? "#ffb92a" : "#FF0000")) ||
- (willMiss && "#FF0000") ||
- gameState.ballsColor;
-
- makeParticle(
- gameState,
- ball.x,
- ball.y,
- gameState.perks.pierce_color || remainingPierce
- ? -ball.vx + ((Math.random() - 0.5) * gameState.baseSpeed) / 3
- : (Math.random() - 0.5) * gameState.baseSpeed,
- gameState.perks.pierce_color || remainingPierce
- ? -ball.vy + ((Math.random() - 0.5) * gameState.baseSpeed) / 3
- : (Math.random() - 0.5) * gameState.baseSpeed,
- color,
+ coin.x + dx * 5,
+ coin.y + dy * 5,
+ dx * 2,
+ dy * 2,
+ rainbowColor(),
true,
gameState.coinSize / 2,
100,
- );
+ );
+ }
+ }
}
+ }
+
+ if (gameState.perks.bricks_attract_coins) {
+ goToNearestBrick(
+ gameState,
+ coin,
+ gameState.perks.bricks_attract_coins * frames,
+ 2,
+ false,
+ );
+ }
+
+ const ratio =
+ 1 -
+ ((gameState.perks.viscosity * 0.03 + 0.002) * frames) /
+ (1 + gameState.perks.etherealcoins);
+ if (!gameState.perks.etherealcoins) {
+ coin.vy *= ratio;
+ coin.vx *= ratio;
+ }
+ if (coin.vx > 7 * gameState.baseSpeed) coin.vx = 7 * gameState.baseSpeed;
+ if (coin.vx < -7 * gameState.baseSpeed)
+ coin.vx = -7 * gameState.baseSpeed;
+ if (coin.vy > 7 * gameState.baseSpeed) coin.vy = 7 * gameState.baseSpeed;
+ if (coin.vy < -7 * gameState.baseSpeed)
+ coin.vy = -7 * gameState.baseSpeed;
+ coin.a += coin.sa;
+
+ // Gravity
+ const flip =
+ gameState.perks.helium > 0 &&
+ Math.abs(coin.x - gameState.puckPosition) * 2 >
+ gameState.puckWidth + coin.size;
+ let dvy =
+ frames * coin.weight * 0.8 * (flip ? -gameState.perks.helium : 1);
+
+ if (gameState.perks.etherealcoins) {
+ if (gameState.perks.helium) {
+ dvy *= 0.2 / gameState.perks.etherealcoins;
+ } else {
+ dvy *= 0;
+ }
+ }
+
+ coin.vy += dvy;
+
+ if (
+ gameState.perks.helium &&
+ !isOptionOn("basic") &&
+ Math.random() < 0.1 * frames
+ ) {
+ makeParticle(
+ gameState,
+ coin.x,
+ coin.y,
+ 0,
+ dvy * 10,
+ gameState.perks.metamorphosis || isOptionOn("colorful_coins")
+ ? coin.color
+ : "#ffd300",
+ true,
+ 5,
+ 250,
+ );
+ }
+
+ const speed = (Math.abs(coin.vx) + Math.abs(coin.vy)) * 10;
+ const hitBorder = bordersHitCheck(gameState, coin, coin.size / 2, frames);
+
+ if (
+ coin.y > gameState.gameZoneHeight - coinRadius - gameState.puckHeight &&
+ coin.y < gameState.gameZoneHeight + gameState.puckHeight + coin.vy &&
+ Math.abs(coin.x - gameState.puckPosition) <
+ coinRadius +
+ gameState.puckWidth / 2 +
+ // a bit of margin to be nice , negative in case it's a negative coin
+ gameState.puckHeight * (coin.points ? 1 : -1)
+ ) {
+ addToScore(gameState, coin);
+ destroy(gameState.coins, coinIndex);
+ } else if (coin.y > gameState.canvasHeight + coinRadius * 10) {
+ gameState.levelLostCoins += coin.points;
+ destroy(gameState.coins, coinIndex);
+ if (gameState.perks.compound_interest) {
+ resetCombo(gameState, coin.x, gameState.gameZoneHeight - 20);
+ }
+ if (
+ gameState.combo < gameState.perks.fountain_toss * 30 &&
+ Math.random() < (1 / gameState.combo) * gameState.perks.fountain_toss
+ ) {
+ increaseCombo(gameState, 1, coin.x, gameState.gameZoneHeight - 20);
+ }
+ }
+
+ const hitBrick = coinBrickHitCheck(gameState, coin);
+ if (gameState.perks.metamorphosis && typeof hitBrick !== "undefined") {
+ if (
+ gameState.bricks[hitBrick] &&
+ coin.color !== gameState.bricks[hitBrick] &&
+ gameState.bricks[hitBrick] !== "black" &&
+ coin.metamorphosisPoints
+ ) {
+ // Not using setbrick because we don't want to reset HP
+ gameState.bricks[hitBrick] = coin.color;
+ coin.metamorphosisPoints--;
+ schedulGameSound(gameState, "colorChange", coin.x, 0.3);
+
+ if (gameState.perks.hypnosis) {
+ const closestBall = getClosestBall(gameState, coin.x, coin.y);
+ if (closestBall) {
+ coin.x = closestBall.x;
+ coin.y = closestBall.y;
+ coin.vx = (Math.random() - 0.5) * gameState.baseSpeed;
+ coin.vy = (Math.random() - 0.5) * gameState.baseSpeed;
+ coin.metamorphosisPoints = gameState.perks.metamorphosis;
+ }
+ }
+ }
+ }
+
+ if (
+ (!gameState.perks.ghost_coins && typeof hitBrick !== "undefined") ||
+ hitBorder
+ ) {
+ const ratio = 1 - 0.2 / (1 + gameState.perks.etherealcoins);
+ coin.vx *= ratio;
+ coin.vy *= ratio;
+ if (Math.abs(coin.vy) < 1) {
+ coin.vy = 0;
+ }
+ coin.sa *= 0.9;
+ if (speed > 20 && !coin.collidedLastFrame) {
+ schedulGameSound(gameState, "coinBounce", coin.x, 0.2);
+ }
+ coin.collidedLastFrame = true;
+ } else {
+ coin.collidedLastFrame = false;
+ }
+ });
+
+ gameState.balls.forEach((ball) => ballTick(gameState, ball, frames));
+
+ if (gameState.perks.shocks) {
+ gameState.balls.forEach((a, ai) =>
+ gameState.balls.forEach((b, bi) => {
+ if (
+ ai < bi &&
+ !a.destroyed &&
+ !b.destroyed &&
+ distance2(a, b) < gameState.ballSize * gameState.ballSize
+ ) {
+ let tempVx = a.vx;
+ let tempVy = a.vy;
+ a.vx = b.vx;
+ a.vy = b.vy;
+ b.vx = tempVx;
+ b.vy = tempVy;
+
+ let x = (a.x + b.x) / 2;
+ let y = (a.y + b.y) / 2;
+ const limit = gameState.baseSpeed;
+ a.vx +=
+ clamp(a.x - x, -limit, limit) +
+ ((Math.random() - 0.5) * limit) / 3;
+ a.vy +=
+ clamp(a.y - y, -limit, limit) +
+ ((Math.random() - 0.5) * limit) / 3;
+ b.vx +=
+ clamp(b.x - x, -limit, limit) +
+ ((Math.random() - 0.5) * limit) / 3;
+ b.vy +=
+ clamp(b.y - y, -limit, limit) +
+ ((Math.random() - 0.5) * limit) / 3;
+
+ let index = brickIndex(x, y);
+ explosionAt(
+ gameState,
+ index,
+ x,
+ y,
+ a,
+ Math.max(0, gameState.perks.shocks - 1),
+ );
+ }
+ }),
+ );
}
+
+ if (gameState.perks.wind) {
+ const windD =
+ ((gameState.puckPosition -
+ (gameState.offsetX + gameState.gameZoneWidth / 2)) /
+ gameState.gameZoneWidth) *
+ 2 *
+ gameState.perks.wind;
+ for (let i = 0; i < gameState.perks.wind; i++) {
+ if (Math.random() * Math.abs(windD) > 0.5) {
+ makeParticle(
+ gameState,
+ gameState.offsetXRoundedDown +
+ Math.random() * gameState.gameZoneWidthRoundedUp,
+ Math.random() * gameState.gameZoneHeight,
+ windD * 8,
+ 0,
+ rainbowColor(),
+ true,
+ gameState.coinSize / 2,
+ 150,
+ );
+ }
+ }
+ }
+ forEachLiveOne(gameState.particles, (flash, index) => {
+ flash.x += flash.vx * frames;
+ flash.y += flash.vy * frames;
+ if (!flash.ethereal) {
+ flash.vy += 0.5 * frames;
+ if (hasBrick(brickIndex(flash.x, flash.y))) {
+ destroy(gameState.particles, index);
+ }
+ }
+ });
+ }
+
+ if (
+ gameState.combo > baseCombo(gameState) &&
+ !isOptionOn("basic") &&
+ (gameState.combo - baseCombo(gameState)) * Math.random() > 5
+ ) {
+ // The red should still be visible on a white bg
+
+ if (gameState.perks.top_is_lava) {
+ makeParticle(
+ gameState,
+ gameState.offsetXRoundedDown +
+ Math.random() * gameState.gameZoneWidthRoundedUp,
+ 0,
+ (Math.random() - 0.5) * 10,
+ 5,
+ "#FF0000",
+ true,
+ gameState.coinSize / 2,
+ 100 * (Math.random() + 1),
+ );
+ }
+
+ if (gameState.perks.left_is_lava) {
+ makeParticle(
+ gameState,
+ gameState.offsetXRoundedDown,
+ Math.random() * gameState.gameZoneHeight,
+ 5,
+ (Math.random() - 0.5) * 10,
+ "#FF0000",
+ true,
+ gameState.coinSize / 2,
+ 100 * (Math.random() + 1),
+ );
+ }
+
+ if (gameState.perks.right_is_lava) {
+ makeParticle(
+ gameState,
+ gameState.offsetXRoundedDown + gameState.gameZoneWidthRoundedUp,
+ Math.random() * gameState.gameZoneHeight,
+ -5,
+ (Math.random() - 0.5) * 10,
+ "#FF0000",
+ true,
+ gameState.coinSize / 2,
+ 100 * (Math.random() + 1),
+ );
+ }
+
+ if (gameState.perks.compound_interest) {
+ let x = gameState.puckPosition,
+ attemps = 0;
+ do {
+ x =
+ gameState.offsetXRoundedDown +
+ gameState.gameZoneWidthRoundedUp * Math.random();
+ attemps++;
+ } while (
+ Math.abs(x - gameState.puckPosition) < gameState.puckWidth / 2 &&
+ attemps < 10
+ );
+
+ makeParticle(
+ gameState,
+ x,
+ gameState.gameZoneHeight,
+ (Math.random() - 0.5) * 10,
+ -5,
+ "#FF0000",
+ true,
+ gameState.coinSize / 2,
+ 100 * (Math.random() + 1),
+ );
+ }
+ if (gameState.perks.streak_shots) {
+ const pos = 0.5 - Math.random();
+ makeParticle(
+ gameState,
+ gameState.puckPosition + gameState.puckWidth * pos,
+ gameState.gameZoneHeight - gameState.puckHeight,
+ pos * 10,
+ -5,
+ "#FF0000",
+ true,
+ gameState.coinSize / 2,
+ 100 * (Math.random() + 1),
+ );
+ }
+ }
+
+ // Respawn what's needed, show particles
+ forEachLiveOne(gameState.respawns, (r, ri) => {
+ if (gameState.bricks[r.index]) {
+ destroy(gameState.respawns, ri);
+ } else if (gameState.levelTime > r.time) {
+ setBrick(gameState, r.index, r.color);
+ destroy(gameState.respawns, ri);
+ } else {
+ const { index, color } = r;
+ const vertical = Math.random() > 0.5;
+ const dx = Math.random() > 0.5 ? 1 : -1;
+ const dy = Math.random() > 0.5 ? 1 : -1;
+
+ makeParticle(
+ gameState,
+ brickCenterX(gameState, index) + (dx * gameState.brickWidth) / 2,
+ brickCenterY(gameState, index) + (dy * gameState.brickWidth) / 2,
+ vertical ? 0 : -dx * gameState.baseSpeed,
+ vertical ? -dy * gameState.baseSpeed : 0,
+ color,
+ true,
+ gameState.coinSize / 2,
+ 250,
+ );
+ }
+ });
+
+ forEachLiveOne(gameState.particles, (p, pi) => {
+ if (gameState.levelTime > p.time + p.duration) {
+ destroy(gameState.particles, pi);
+ }
+ });
+ forEachLiveOne(gameState.texts, (p, pi) => {
+ if (gameState.levelTime > p.time + p.duration) {
+ destroy(gameState.texts, pi);
+ }
+ });
+ forEachLiveOne(gameState.lights, (p, pi) => {
+ if (gameState.levelTime > p.time + p.duration) {
+ destroy(gameState.lights, pi);
+ }
+ });
+}
+
+export function ballTick(gameState: GameState, ball: Ball, frames: number) {
+ ball.previousVX = ball.vx;
+ ball.previousVY = ball.vy;
+
+ let speedLimitDampener =
+ 1 +
+ gameState.perks.telekinesis +
+ gameState.perks.ball_repulse_ball +
+ gameState.perks.puck_repulse_ball +
+ gameState.perks.ball_attract_ball;
+
+ if (telekinesisEffectRate(gameState, ball) > 0) {
+ speedLimitDampener += 3;
+ ball.vx +=
+ ((gameState.puckPosition - ball.x) / 1000) *
+ frames *
+ gameState.perks.telekinesis *
+ telekinesisEffectRate(gameState, ball);
+ }
+ if (yoyoEffectRate(gameState, ball) > 0) {
+ speedLimitDampener += 3;
+
+ ball.vx +=
+ ((gameState.puckPosition - ball.x) / 1000) *
+ frames *
+ gameState.perks.yoyo *
+ yoyoEffectRate(gameState, ball);
+ }
+
+ if (ball.hitSinceBounce < gameState.perks.bricks_attract_ball * 3) {
+ goToNearestBrick(
+ gameState,
+ ball,
+ gameState.perks.bricks_attract_ball * frames * 0.2,
+ 2 + gameState.perks.bricks_attract_ball,
+ Math.random() < 0.5 * frames,
+ );
+ }
+
+ if (
+ ball.vx * ball.vx + ball.vy * ball.vy <
+ gameState.baseSpeed * gameState.baseSpeed * 2
+ ) {
+ ball.vx *= 1 + 0.02 / speedLimitDampener;
+ ball.vy *= 1 + 0.02 / speedLimitDampener;
+ } else {
+ ball.vx *= 1 - 0.02 / speedLimitDampener;
+ ball.vy *= 1 - 0.02 / speedLimitDampener;
+ }
+ // Ball could get stuck horizontally because of ball-ball interactions in repulse/attract
+ if (Math.abs(ball.vy) < 0.2 * gameState.baseSpeed) {
+ ball.vy += ((ball.vy > 0 ? 1 : -1) * 0.02) / speedLimitDampener;
+ }
+
+ if (gameState.perks.ball_repulse_ball) {
+ for (let b2 of gameState.balls) {
+ // avoid computing this twice, and repulsing itself
+ if (b2.x >= ball.x) continue;
+ repulse(gameState, ball, b2, gameState.perks.ball_repulse_ball, true);
+ }
+ }
+ if (gameState.perks.ball_attract_ball) {
+ for (let b2 of gameState.balls) {
+ // avoid computing this twice, and repulsing itself
+ if (b2.x >= ball.x) continue;
+ attract(gameState, ball, b2, gameState.perks.ball_attract_ball);
+ }
+ }
+ if (
+ gameState.perks.puck_repulse_ball &&
+ Math.abs(ball.x - gameState.puckPosition) <
+ gameState.puckWidth / 2 +
+ (gameState.ballSize * (9 + gameState.perks.puck_repulse_ball)) / 10
+ ) {
+ repulse(
+ gameState,
+ ball,
+ {
+ x: gameState.puckPosition,
+ y: gameState.gameZoneHeight,
+ },
+ gameState.perks.puck_repulse_ball + 1,
+ false,
+ );
+ }
+
+ const borderHitCode = bordersHitCheck(
+ gameState,
+ ball,
+ gameState.ballSize / 2,
+ frames,
+ );
+ if (borderHitCode) {
+ if (
+ gameState.perks.left_is_lava &&
+ borderHitCode % 2 &&
+ ball.x < gameState.offsetX + gameState.gameZoneWidth / 2
+ ) {
+ resetCombo(gameState, ball.x, ball.y);
+ }
+
+ if (
+ gameState.perks.right_is_lava &&
+ borderHitCode % 2 &&
+ ball.x > gameState.offsetX + gameState.gameZoneWidth / 2
+ ) {
+ resetCombo(gameState, ball.x, ball.y);
+ }
+
+ if (gameState.perks.top_is_lava && borderHitCode >= 2) {
+ resetCombo(gameState, ball.x, ball.y + gameState.ballSize * 3);
+ }
+ if (gameState.perks.trampoline) {
+ decreaseCombo(
+ gameState,
+ gameState.perks.trampoline,
+ ball.x,
+ ball.y + gameState.ballSize,
+ );
+ }
+
+ schedulGameSound(gameState, "wallBeep", ball.x, 1);
+ gameState.levelWallBounces++;
+ gameState.runStatistics.wall_bounces++;
+ }
+
+ // Puck collision
+ const ylimit =
+ gameState.gameZoneHeight - gameState.puckHeight - gameState.ballSize / 2;
+ const ballIsUnderPuck =
+ Math.abs(ball.x - gameState.puckPosition) <
+ gameState.ballSize / 2 + gameState.puckWidth / 2;
+ if (
+ ball.y > ylimit &&
+ ball.vy > 0 &&
+ (ballIsUnderPuck ||
+ (gameState.balls.length < 2 &&
+ gameState.perks.extra_life &&
+ ball.y > ylimit + gameState.puckHeight / 2))
+ ) {
+ if (ballIsUnderPuck) {
+ const speed = Math.sqrt(ball.vx * ball.vx + ball.vy * ball.vy);
+ const angle = Math.atan2(
+ -gameState.puckWidth / 2,
+ (ball.x - gameState.puckPosition) *
+ (gameState.perks.concave_puck
+ ? -1 / (1 + gameState.perks.concave_puck)
+ : 1),
+ );
+ ball.vx = speed * Math.cos(angle);
+ ball.vy = speed * Math.sin(angle);
+ schedulGameSound(gameState, "wallBeep", ball.x, 1);
+ } else {
+ ball.vy *= -1;
+ justLostALife(gameState, ball, ball.x, ball.y);
+ }
+ if (gameState.perks.streak_shots) {
+ resetCombo(gameState, ball.x, ball.y);
+ }
+ if (gameState.perks.trampoline) {
+ increaseCombo(gameState, gameState.perks.trampoline, ball.x, ball.y);
+ }
+ if (
+ gameState.perks.nbricks &&
+ ball.hitSinceBounce < gameState.perks.nbricks
+ ) {
+ resetCombo(gameState, ball.x, ball.y);
+ }
+
+ if (!ball.hitSinceBounce && gameState.bricks.find((i) => i)) {
+ gameState.runStatistics.misses++;
+ if (gameState.perks.forgiving) {
+ const loss = Math.floor(
+ (gameState.levelMisses / 10 / gameState.perks.forgiving) *
+ (gameState.combo - baseCombo(gameState)),
+ );
+ decreaseCombo(gameState, loss, ball.x, ball.y - gameState.ballSize);
+ } else {
+ resetCombo(gameState, ball.x, ball.y);
+ }
+ gameState.levelMisses++;
+ makeText(
+ gameState,
+ gameState.puckPosition,
+ gameState.gameZoneHeight - gameState.puckHeight * 2,
+ "#FF0000",
+ t("play.missed_ball"),
+ gameState.puckHeight,
+ 500,
+ );
+ }
+ gameState.runStatistics.puck_bounces++;
+ ball.hitSinceBounce = 0;
+ ball.brokenSinceBounce = 0;
+ ball.sapperUses = 0;
+ ball.piercePoints = gameState.perks.pierce * 3;
+ }
+
+ if (
+ gameState.running &&
+ ball.y > gameState.gameZoneHeight + gameState.ballSize / 2
+ ) {
+ ball.destroyed = true;
+ gameState.runStatistics.balls_lost++;
+ if (!gameState.balls.find((b) => !b.destroyed)) {
+ gameOver(
+ t("gameOver.lost.title"),
+ t("gameOver.lost.summary", { score: gameState.score }),
+ );
+ }
+ }
+ const radius = gameState.ballSize / 2;
+ // Make ball/coin bonce, and return bricks that were hit
+ const { x, y, previousX, previousY } = ball;
+
+ const vhit = hitsSomething(previousX, y, radius);
+ const hhit = hitsSomething(x, previousY, radius);
+ const chit =
+ (typeof vhit == "undefined" &&
+ typeof hhit == "undefined" &&
+ hitsSomething(x, y, radius)) ||
+ undefined;
+
+ const hitBrick = vhit ?? hhit ?? chit;
+
+ if (typeof hitBrick !== "undefined") {
+ const initialBrickColor = gameState.bricks[hitBrick];
+ ball.hitSinceBounce++;
+
+ if (gameState.perks.nbricks) {
+ if (ball.hitSinceBounce > gameState.perks.nbricks) {
+ resetCombo(gameState, ball.x, ball.y);
+ } else {
+ increaseCombo(gameState, gameState.perks.nbricks, ball.x, ball.y);
+ }
+ // We need to reset at each hit, otherwise it's just an OP version of single puck hit streak
+ }
+
+ let pierce = false;
+ let damage =
+ 1 +
+ (shouldPierceByColor(gameState, vhit, hhit, chit)
+ ? gameState.perks.pierce_color
+ : 0);
+
+ gameState.brickHP[hitBrick] -= damage;
+
+ const used = Math.min(
+ ball.piercePoints,
+ Math.max(1, gameState.brickHP[hitBrick] + 1),
+ );
+ gameState.brickHP[hitBrick] -= used;
+ ball.piercePoints -= used;
+
+ if (gameState.brickHP[hitBrick] < 0) {
+ gameState.brickHP[hitBrick] = 0;
+ pierce = true;
+ }
+ if (typeof vhit !== "undefined" || typeof chit !== "undefined") {
+ if (!pierce) {
+ ball.y = ball.previousY;
+ ball.vy *= -1;
+ }
+ }
+ if (typeof hhit !== "undefined" || typeof chit !== "undefined") {
+ if (!pierce) {
+ ball.x = ball.previousX;
+ ball.vx *= -1;
+ }
+ }
+
+ if (!gameState.brickHP[hitBrick]) {
+ ball.brokenSinceBounce++;
+
+ explodeBrick(gameState, hitBrick, ball, false);
+ if (
+ ball.sapperUses < gameState.perks.sapper &&
+ initialBrickColor !== "black" && // don't replace a brick that bounced with sturdy_bricks
+ !gameState.bricks[hitBrick]
+ ) {
+ setBrick(gameState, hitBrick, "black");
+ ball.sapperUses++;
+ }
+ } else {
+ schedulGameSound(gameState, "wallBeep", x, 1);
+ makeLight(
+ gameState,
+ brickCenterX(gameState, hitBrick),
+ brickCenterY(gameState, hitBrick),
+ "#FFFFFF",
+ gameState.brickWidth + 2,
+ 50 * gameState.brickHP[hitBrick],
+ );
+ }
+ }
+
+ if (
+ !isOptionOn("basic") &&
+ ballTransparency(ball, gameState) < Math.random()
+ ) {
+ const remainingPierce = ball.piercePoints;
+ const remainingSapper = ball.sapperUses < gameState.perks.sapper;
+ const willMiss =
+ isOptionOn("red_miss") && ball.vy > 0 && !ball.hitSinceBounce;
+ const extraCombo = gameState.combo - 1;
+
+ if (
+ willMiss ||
+ (extraCombo && Math.random() > 0.1 / (1 + extraCombo)) ||
+ (remainingSapper && Math.random() > 0.1 / (1 + remainingSapper)) ||
+ (extraCombo && Math.random() > 0.1 / (1 + extraCombo))
+ ) {
+ const color =
+ (remainingSapper && (Math.random() > 0.5 ? "#ffb92a" : "#FF0000")) ||
+ (willMiss && "#FF0000") ||
+ gameState.ballsColor;
+
+ makeParticle(
+ gameState,
+ ball.x,
+ ball.y,
+ gameState.perks.pierce_color || remainingPierce
+ ? -ball.vx + ((Math.random() - 0.5) * gameState.baseSpeed) / 3
+ : (Math.random() - 0.5) * gameState.baseSpeed,
+ gameState.perks.pierce_color || remainingPierce
+ ? -ball.vy + ((Math.random() - 0.5) * gameState.baseSpeed) / 3
+ : (Math.random() - 0.5) * gameState.baseSpeed,
+ color,
+ true,
+ gameState.coinSize / 2,
+ 100,
+ );
+ }
+ }
}
function justLostALife(gameState: GameState, ball: Ball, x: number, y: number) {
- gameState.perks.extra_life -= 1;
- if (gameState.perks.extra_life < 0) {
- gameState.perks.extra_life = 0;
- } else if (gameState.perks.sacrifice) {
- gameState.combo *= gameState.perks.sacrifice;
- gameState.bricks.forEach(
- (color, index) => color && explodeBrick(gameState, index, ball, true),
- );
- }
+ gameState.perks.extra_life -= 1;
+ if (gameState.perks.extra_life < 0) {
+ gameState.perks.extra_life = 0;
+ } else if (gameState.perks.sacrifice) {
+ gameState.combo *= gameState.perks.sacrifice;
+ gameState.bricks.forEach(
+ (color, index) => color && explodeBrick(gameState, index, ball, true),
+ );
+ }
- schedulGameSound(gameState, "lifeLost", ball.x, 1);
+ schedulGameSound(gameState, "lifeLost", ball.x, 1);
- if (!isOptionOn("basic")) {
- for (let i = 0; i < 10; i++)
- makeParticle(
- gameState,
- x,
- y,
- Math.random() * gameState.baseSpeed * 3,
- gameState.baseSpeed * 3,
- "#FF0000",
- false,
- gameState.coinSize / 2,
- 150,
- );
- }
+ if (!isOptionOn("basic")) {
+ for (let i = 0; i < 10; i++)
+ makeParticle(
+ gameState,
+ x,
+ y,
+ Math.random() * gameState.baseSpeed * 3,
+ gameState.baseSpeed * 3,
+ "#FF0000",
+ false,
+ gameState.coinSize / 2,
+ 150,
+ );
+ }
}
function makeCoin(
- gameState: GameState,
- x: number,
- y: number,
- vx: number,
- vy: number,
- color = "#ffd300",
- points = 1,
+ gameState: GameState,
+ x: number,
+ y: number,
+ vx: number,
+ vy: number,
+ color = "#ffd300",
+ points = 1,
) {
- let weight = 0.8 + Math.random() * 0.2 + Math.min(2, points * 0.01);
- weight *= 5 / (5 + gameState.perks.etherealcoins);
+ let weight = 0.8 + Math.random() * 0.2 + Math.min(2, points * 0.01);
+ weight *= 5 / (5 + gameState.perks.etherealcoins);
- if (gameState.perks.trickledown) y = -20;
- if (
- gameState.perks.rainbow &&
- Math.random() > 1 / (1 + gameState.perks.rainbow)
- )
- color = rainbowColor();
+ if (gameState.perks.trickledown) y = -20;
+ if (
+ gameState.perks.rainbow &&
+ Math.random() > 1 / (1 + gameState.perks.rainbow)
+ )
+ color = rainbowColor();
- append(gameState.coins, (p: Partial) => {
- p.x = x;
- p.y = y;
- p.collidedLastFrame = true;
- p.size = gameState.coinSize;
- p.previousX = x;
- p.previousY = y;
- p.vx = vx;
- p.vy = vy;
- // p.sx = 0;
- // p.sy = 0;
- p.color = color;
- p.a = Math.random() * Math.PI * 2;
- p.sa = Math.random() - 0.5;
- p.points = points;
- p.weight = weight;
- p.metamorphosisPoints = gameState.perks.metamorphosis;
- });
+ append(gameState.coins, (p: Partial) => {
+ p.x = x;
+ p.y = y;
+ p.collidedLastFrame = true;
+ p.size = gameState.coinSize;
+ p.previousX = x;
+ p.previousY = y;
+ p.vx = vx;
+ p.vy = vy;
+ // p.sx = 0;
+ // p.sy = 0;
+ p.color = color;
+ p.a = Math.random() * Math.PI * 2;
+ p.sa = Math.random() - 0.5;
+ p.points = points;
+ p.weight = weight;
+ p.metamorphosisPoints = gameState.perks.metamorphosis;
+ });
}
function makeParticle(
- gameState: GameState,
- x: number,
- y: number,
- vx: number,
- vy: number,
- color: colorString,
- ethereal = false,
- size = 8,
- duration = 150,
+ gameState: GameState,
+ x: number,
+ y: number,
+ vx: number,
+ vy: number,
+ color: colorString,
+ ethereal = false,
+ size = 8,
+ duration = 150,
) {
- append(gameState.particles, (p: Partial) => {
- p.time = gameState.levelTime;
- p.x = x;
- p.y = y;
- p.vx = vx;
- p.vy = vy;
- p.color = color;
- p.size = size;
- p.duration = duration;
- p.ethereal = ethereal;
- });
+ append(gameState.particles, (p: Partial) => {
+ p.time = gameState.levelTime;
+ p.x = x;
+ p.y = y;
+ p.vx = vx;
+ p.vy = vy;
+ p.color = color;
+ p.size = size;
+ p.duration = duration;
+ p.ethereal = ethereal;
+ });
}
function makeText(
- gameState: GameState,
- x: number,
- y: number,
- color: colorString,
- text: string,
- size = 20,
- duration = 500,
+ gameState: GameState,
+ x: number,
+ y: number,
+ color: colorString,
+ text: string,
+ size = 20,
+ duration = 500,
) {
- append(gameState.texts, (p: Partial) => {
- p.time = gameState.levelTime;
- p.x = x;
- p.y = y;
- p.color = color;
- p.size = size;
- p.duration = clamp(duration, 400, 2000);
- p.text = text;
- });
+ append(gameState.texts, (p: Partial) => {
+ p.time = gameState.levelTime;
+ p.x = x;
+ p.y = y;
+ p.color = color;
+ p.size = size;
+ p.duration = clamp(duration, 400, 2000);
+ p.text = text;
+ });
}
function makeLight(
- gameState: GameState,
- x: number,
- y: number,
- color: colorString,
- size = 8,
- duration = 150,
+ gameState: GameState,
+ x: number,
+ y: number,
+ color: colorString,
+ size = 8,
+ duration = 150,
) {
- append(gameState.lights, (p: Partial) => {
- p.time = gameState.levelTime;
- p.x = x;
- p.y = y;
- p.color = color;
- p.size = size;
- p.duration = duration;
- });
+ append(gameState.lights, (p: Partial) => {
+ p.time = gameState.levelTime;
+ p.x = x;
+ p.y = y;
+ p.color = color;
+ p.size = size;
+ p.duration = duration;
+ });
}
export function append(
- where: ReusableArray,
- makeItem: (match: Partial) => void,
+ where: ReusableArray,
+ makeItem: (match: Partial) => void,
) {
- while (
- where.list[where.indexMin] &&
- !where.list[where.indexMin].destroyed &&
- where.indexMin < where.list.length
- ) {
- where.indexMin++;
- }
- if (where.indexMin < where.list.length) {
- where.list[where.indexMin].destroyed = false;
- makeItem(where.list[where.indexMin]);
- where.indexMin++;
- } else {
- const p = {destroyed: false};
- makeItem(p);
- where.list.push(p);
- }
- where.total++;
+ while (
+ where.list[where.indexMin] &&
+ !where.list[where.indexMin].destroyed &&
+ where.indexMin < where.list.length
+ ) {
+ where.indexMin++;
+ }
+ if (where.indexMin < where.list.length) {
+ where.list[where.indexMin].destroyed = false;
+ makeItem(where.list[where.indexMin]);
+ where.indexMin++;
+ } else {
+ const p = { destroyed: false };
+ makeItem(p);
+ where.list.push(p);
+ }
+ where.total++;
}
export function destroy(where: ReusableArray, index: number) {
- if (where.list[index].destroyed) return;
- where.list[index].destroyed = true;
- where.indexMin = Math.min(where.indexMin, index);
- where.total--;
+ if (where.list[index].destroyed) return;
+ where.list[index].destroyed = true;
+ where.indexMin = Math.min(where.indexMin, index);
+ where.total--;
}
export function liveCount(where: ReusableArray) {
- return where.total;
+ return where.total;
}
export function empty(where: ReusableArray) {
- let destroyed = 0;
- where.total = 0;
- where.indexMin = 0;
- where.list.forEach((i) => {
- if (!i.destroyed) {
- i.destroyed = true;
- destroyed++;
- }
- });
- return destroyed;
+ let destroyed = 0;
+ where.total = 0;
+ where.indexMin = 0;
+ where.list.forEach((i) => {
+ if (!i.destroyed) {
+ i.destroyed = true;
+ destroyed++;
+ }
+ });
+ return destroyed;
}
export function forEachLiveOne(
- where: ReusableArray,
- cb: (t: T, index: number) => void,
+ where: ReusableArray,
+ cb: (t: T, index: number) => void,
) {
- where.list.forEach((item: T, index: number) => {
- if (item && !item.destroyed) {
- cb(item, index);
- }
- });
+ where.list.forEach((item: T, index: number) => {
+ if (item && !item.destroyed) {
+ cb(item, index);
+ }
+ });
}
-function goToNearestBrick(gameState: GameState, coin: Ball | Coin, strength, size = 2, particle=false) {
- const row = Math.floor(coin.y / gameState.brickWidth);
- const col = Math.floor(
- (coin.x - gameState.offsetX) / gameState.brickWidth,
+function goToNearestBrick(
+ gameState: GameState,
+ coin: Ball | Coin,
+ strength,
+ size = 2,
+ particle = false,
+) {
+ const row = Math.floor(coin.y / gameState.brickWidth);
+ const col = Math.floor((coin.x - gameState.offsetX) / gameState.brickWidth);
+ let vx = 0,
+ vy = 0;
+ for (let dcol = -size; dcol < size; dcol++) {
+ for (let drow = -size; drow < size; drow++) {
+ const index = getRowColIndex(gameState, row + drow, col + dcol);
+ if (gameState.bricks[index]) {
+ const dx =
+ brickCenterX(gameState, index) +
+ (clamp(-dcol, -1, 1) * gameState.brickWidth) / 2 -
+ coin.x;
+ const dy =
+ brickCenterY(gameState, index) +
+ (clamp(-drow, -1, 1) * gameState.brickWidth) / 2 -
+ coin.y;
+ const d2 = dx * dx + dy * dy;
+ vx += (dx / d2) * 20;
+ vy += (dy / d2) * 20;
+ }
+ }
+ }
+
+ coin.vx += vx * strength;
+ coin.vy += vy * strength;
+ const s2 = coin.vx * coin.vx + coin.vy * coin.vy;
+ if (s2 > gameState.baseSpeed * gameState.baseSpeed * 2) {
+ coin.vx *= 0.95;
+ coin.vy *= 0.95;
+ }
+
+ if ((vx || vy) && particle) {
+ makeParticle(
+ gameState,
+ coin.x,
+ coin.y,
+ -vx * 2,
+ -vy * 2,
+ rainbowColor(),
+ true,
);
- let vx = 0, vy = 0
- for (let dcol = -size; dcol < size; dcol++) {
- for (let drow = -size; drow < size; drow++) {
- const index = getRowColIndex(gameState, row + drow, col + dcol);
- if (gameState.bricks[index]) {
- const dx =
- brickCenterX(gameState, index) +
- clamp(-dcol, -1, 1) * gameState.brickWidth / 2 -
- coin.x;
- const dy =
- brickCenterY(gameState, index) +
- clamp(-drow, -1, 1) * gameState.brickWidth / 2 -
- coin.y;
- const d2 = dx * dx + dy * dy;
- vx += (dx / d2) * 20
- vy += (dy / d2) * 20
-
- }
- }
- }
-
-
- coin.vx += vx * strength
- coin.vy += vy * strength
- const s2 = coin.vx * coin.vx + coin.vy * coin.vy
- if (s2 > gameState.baseSpeed * gameState.baseSpeed * 2) {
- coin.vx *= 0.95
- coin.vy *= 0.95
- }
-
- if((vx ||vy) && particle){
- makeParticle(gameState, coin.x, coin.y, -vx*2,-vy*2, rainbowColor(), true)
- }
-
+ }
}
diff --git a/src/openScorePanel.ts b/src/openScorePanel.ts
index 84d9001..b5f1368 100644
--- a/src/openScorePanel.ts
+++ b/src/openScorePanel.ts
@@ -69,7 +69,7 @@ export function getNearestUnlockHTML(gameState: GameState) {
});
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(", ");
const title =
diff --git a/src/render.ts b/src/render.ts
index d4cb68b..fd36129 100644
--- a/src/render.ts
+++ b/src/render.ts
@@ -329,9 +329,9 @@ export function render(gameState: GameState) {
ctx.fillStyle = gameState.puckColor;
for (let i = 0; i < gameState.perks.extra_life; i++) {
ctx.fillRect(
- gameState.offsetXRoundedDown,
+ gameState.offsetXRoundedDown,
gameState.gameZoneHeight - gameState.puckHeight / 2 + 2 * i,
- gameState.gameZoneWidthRoundedUp,
+ gameState.gameZoneWidthRoundedUp,
1,
);
}
@@ -444,18 +444,14 @@ export function render(gameState: GameState) {
// Borders
ctx.globalCompositeOperation = "source-over";
- ctx.globalAlpha = 1;
+ ctx.globalAlpha = 1;
let redLeftSide =
- hasCombo &&
- (gameState.perks.left_is_lava || gameState.perks.trampoline);
+ hasCombo && (gameState.perks.left_is_lava || gameState.perks.trampoline);
let redRightSide =
- hasCombo &&
- (gameState.perks.right_is_lava || gameState.perks.trampoline);
+ hasCombo && (gameState.perks.right_is_lava || gameState.perks.trampoline);
let redTop =
- hasCombo &&
- (gameState.perks.top_is_lava || gameState.perks.trampoline);
-
+ hasCombo && (gameState.perks.top_is_lava || gameState.perks.trampoline);
if (gameState.offsetXRoundedDown) {
// draw outside of gaming area to avoid capturing borders in recordings
@@ -466,7 +462,8 @@ export function render(gameState: GameState) {
gameState.offsetXRoundedDown - 1,
0,
gameState.offsetXRoundedDown - 1,
- height, 1,
+ height,
+ 1,
);
drawStraightLine(
@@ -477,7 +474,7 @@ export function render(gameState: GameState) {
0,
width - gameState.offsetXRoundedDown + 1,
height,
- 1,
+ 1,
);
} else {
drawStraightLine(
@@ -507,9 +504,9 @@ export function render(gameState: GameState) {
ctx,
gameState,
"#FF0000",
- gameState.offsetXRoundedDown,
+ gameState.offsetXRoundedDown,
1,
- width - gameState.offsetXRoundedDown,
+ width - gameState.offsetXRoundedDown,
1,
1,
);
diff --git a/src/startingPerks.ts b/src/startingPerks.ts
index 9a9512f..765bd1c 100644
--- a/src/startingPerks.ts
+++ b/src/startingPerks.ts
@@ -4,7 +4,7 @@ import { t } from "./i18n/i18n";
import { icons, upgrades } from "./loadGameData";
import { getSettingValue, getTotalScore, setSettingValue } from "./settings";
import { isOptionOn } from "./options";
-import {notStartingPerk} from "./upgrades";
+import { notStartingPerk } from "./upgrades";
export function startingPerkMenuButton() {
return {
@@ -20,15 +20,14 @@ export function startingPerkMenuButton() {
export function isBlackListedForStart(u: Upgrade) {
return !!(
- notStartingPerk.includes(u.id) ||
+ notStartingPerk.includes(u.id) ||
u.requires ||
u.threshold > getTotalScore()
);
}
export function isStartingPerk(u: Upgrade): boolean {
return (
- !isBlackListedForStart(u) &&
- getSettingValue("start_with_" + u.id, u.gift)
+ !isBlackListedForStart(u) && getSettingValue("start_with_" + u.id, u.gift)
);
}
diff --git a/src/upgrades.ts b/src/upgrades.ts
index c9883ac..bb4e508 100644
--- a/src/upgrades.ts
+++ b/src/upgrades.ts
@@ -1,831 +1,827 @@
-import {t} from "./i18n/i18n";
-
-import {comboKeepingRate} from "./pure_functions";
-import {PerkId} from "./types";
+import { t } from "./i18n/i18n";
+import { comboKeepingRate } from "./pure_functions";
+import { PerkId } from "./types";
// Those perks are excluded from creative mode
export const noCreative: PerkId[] = [
- "extra_levels",
- "shunt",
- "one_more_choice",
- "instant_upgrade",
+ "extra_levels",
+ "shunt",
+ "one_more_choice",
+ "instant_upgrade",
];
-
// Those perks are excluded from the starting perks list
-export const notStartingPerk: PerkId[] = [
- "instant_upgrade",
-];
-
+export const notStartingPerk: PerkId[] = ["instant_upgrade"];
export const rawUpgrades = [
- {
- requires: "",
- threshold: 0,
- gift: false,
-
- id: "extra_life",
- max: 7,
- name: t("upgrades.extra_life.name"),
- help: (lvl: number) =>
- lvl === 1
- ? t("upgrades.extra_life.tooltip")
- : t("upgrades.extra_life.help_plural", {lvl}),
- fullHelp: t("upgrades.extra_life.verbose_description"),
- },
-
- {
- requires: "",
- threshold: 0,
- id: "base_combo",
- gift: true,
-
- max: 7,
- name: t("upgrades.base_combo.name"),
- help: (lvl: number) =>
- t("upgrades.base_combo.tooltip", {coins: 1 + lvl * 3}),
- fullHelp: t("upgrades.base_combo.verbose_description"),
- },
- {
- requires: "",
- threshold: 0,
- gift: false,
-
- id: "slow_down",
- max: 2,
- name: t("upgrades.slow_down.name"),
- help: (lvl: number) => t("upgrades.slow_down.tooltip", {lvl}),
- fullHelp: t("upgrades.slow_down.verbose_description"),
- },
- {
- requires: "",
- threshold: 0,
- gift: false,
-
- id: "bigger_puck",
- max: 2,
- name: t("upgrades.bigger_puck.name"),
- help: () => t("upgrades.bigger_puck.tooltip"),
- fullHelp: t("upgrades.bigger_puck.verbose_description"),
- },
- {
- requires: "",
- threshold: 0,
- gift: false,
-
- id: "viscosity",
- max: 3,
-
- name: t("upgrades.viscosity.name"),
- help: () => t("upgrades.viscosity.tooltip"),
- fullHelp: t("upgrades.viscosity.verbose_description"),
- },
- {
- requires: "",
- threshold: 50,
- gift: false,
-
- id: "skip_last",
- max: 7,
- name: t("upgrades.skip_last.name"),
- help: (lvl: number) =>
- lvl == 1
- ? t("upgrades.skip_last.tooltip")
- : t("upgrades.skip_last.help_plural", {lvl}),
- fullHelp: t("upgrades.skip_last.verbose_description"),
- },
- {
- requires: "",
- threshold: 100,
- id: "streak_shots",
- gift: true,
-
- max: 1,
- name: t("upgrades.streak_shots.name"),
- help: (lvl: number) => t("upgrades.streak_shots.tooltip", {lvl}),
- fullHelp: t("upgrades.streak_shots.verbose_description"),
- },
-
- {
- requires: "",
-
- threshold: 200,
- id: "left_is_lava",
- gift: true,
-
- max: 1,
-
- name: t("upgrades.left_is_lava.name"),
- help: (lvl: number) => t("upgrades.left_is_lava.tooltip", {lvl}),
- fullHelp: t("upgrades.left_is_lava.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 300,
- id: "right_is_lava",
- gift: true,
-
- max: 1,
- name: t("upgrades.right_is_lava.name"),
- help: (lvl: number) => t("upgrades.right_is_lava.tooltip", {lvl}),
- fullHelp: t("upgrades.right_is_lava.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 400,
- id: "top_is_lava",
- gift: true,
-
- max: 1,
- name: t("upgrades.top_is_lava.name"),
- help: (lvl: number) => t("upgrades.top_is_lava.tooltip", {lvl}),
- fullHelp: t("upgrades.top_is_lava.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 500,
- id: "telekinesis",
- gift: true,
-
- max: 1,
- name: t("upgrades.telekinesis.name"),
- help: (lvl: number) =>
- lvl == 1
- ? t("upgrades.telekinesis.tooltip")
- : t("upgrades.telekinesis.help_plural"),
- fullHelp: t("upgrades.telekinesis.verbose_description"),
- },
- {
- requires: "",
- threshold: 700,
- gift: false,
-
- id: "coin_magnet",
- max: 3,
- name: t("upgrades.coin_magnet.name"),
- help: (lvl: number) =>
- lvl == 1
- ? t("upgrades.coin_magnet.tooltip")
- : t("upgrades.coin_magnet.help_plural"),
- fullHelp: t("upgrades.coin_magnet.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 800,
- id: "multiball",
- gift: true,
-
- max: 6,
- name: t("upgrades.multiball.name"),
- help: (lvl: number) => t("upgrades.multiball.tooltip", {count: lvl + 1}),
- fullHelp: t("upgrades.multiball.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 1000,
- gift: false,
-
- id: "smaller_puck",
- max: 2,
- name: t("upgrades.smaller_puck.name"),
- help: (lvl: number) =>
- lvl == 1
- ? t("upgrades.smaller_puck.tooltip")
- : t("upgrades.smaller_puck.help_plural"),
- fullHelp: t("upgrades.smaller_puck.verbose_description"),
- },
- {
- requires: "",
- threshold: 1500,
- id: "pierce",
- gift: false,
-
- max: 3,
- name: t("upgrades.pierce.name"),
- help: (lvl: number) => t("upgrades.pierce.tooltip", {count: 3 * lvl}),
- fullHelp: t("upgrades.pierce.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 2000,
- id: "picky_eater",
- gift: true,
-
- max: 1,
- name: t("upgrades.picky_eater.name"),
- help: (lvl: number) => t("upgrades.picky_eater.tooltip", {lvl}),
- fullHelp: t("upgrades.picky_eater.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 2500,
- gift: false,
-
- id: "metamorphosis",
- max: 1,
- name: t("upgrades.metamorphosis.name"),
- help: (lvl: number) => t("upgrades.metamorphosis.tooltip", {lvl}),
- fullHelp: t("upgrades.metamorphosis.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 3000,
- id: "compound_interest",
- gift: true,
-
- max: 1,
- name: t("upgrades.compound_interest.name"),
- help: (lvl: number) => t("upgrades.compound_interest.tooltip", {lvl}),
- fullHelp: t("upgrades.compound_interest.verbose_description"),
- },
- {
- requires: "",
- threshold: 4000,
- id: "hot_start",
- gift: true,
-
- max: 3,
- name: t("upgrades.hot_start.name"),
- help: (lvl: number) =>
- t("upgrades.hot_start.tooltip", {
- start: lvl * 30 + 1,
- loss: lvl,
- }),
- fullHelp: t("upgrades.hot_start.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 6000,
- id: "sapper",
- gift: false,
-
- max: 7,
- name: t("upgrades.sapper.name"),
- help: (lvl: number) =>
- lvl == 1
- ? t("upgrades.sapper.tooltip")
- : t("upgrades.sapper.help_plural", {lvl}),
- fullHelp: t("upgrades.sapper.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 9000,
- id: "bigger_explosions",
- gift: false,
-
- max: 1,
- name: t("upgrades.bigger_explosions.name"),
- help: (lvl: number) => t("upgrades.bigger_explosions.tooltip"),
- fullHelp: t("upgrades.bigger_explosions.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 13000,
- gift: false,
-
- adventure: false,
- id: "extra_levels",
- max: 3,
- name: t("upgrades.extra_levels.name"),
- help: (lvl: number) =>
- t("upgrades.extra_levels.tooltip", {count: lvl + 7}),
- fullHelp: t("upgrades.extra_levels.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 15000,
- gift: false,
-
- id: "pierce_color",
- max: 4,
- name: t("upgrades.pierce_color.name"),
- help: (lvl: number) => t("upgrades.pierce_color.tooltip", {lvl}),
- fullHelp: t("upgrades.pierce_color.verbose_description"),
- },
- {
- requires: "",
- threshold: 18000,
- gift: false,
-
- id: "soft_reset",
- max: 3,
- name: t("upgrades.soft_reset.name"),
- help: (lvl: number) =>
- t("upgrades.soft_reset.tooltip", {
- percent: Math.round(comboKeepingRate(lvl) * 100),
- }),
- fullHelp: t("upgrades.soft_reset.verbose_description"),
- },
- {
- requires: "multiball",
- threshold: 21000,
- gift: false,
-
- id: "ball_repulse_ball",
- max: 3,
- name: t("upgrades.ball_repulse_ball.name"),
- help: (lvl: number) =>
- lvl == 1
- ? t("upgrades.ball_repulse_ball.tooltip")
- : t("upgrades.ball_repulse_ball.help_plural"),
- fullHelp: t("upgrades.ball_repulse_ball.verbose_description"),
- },
- {
- requires: "multiball",
- threshold: 25000,
- gift: false,
-
- id: "ball_attract_ball",
- max: 3,
- name: t("upgrades.ball_attract_ball.name"),
- help: (lvl: number) =>
- lvl == 1
- ? t("upgrades.ball_attract_ball.tooltip")
- : t("upgrades.ball_attract_ball.help_plural"),
- fullHelp: t("upgrades.ball_attract_ball.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 30000,
- gift: false,
-
- id: "puck_repulse_ball",
- max: 2,
- name: t("upgrades.puck_repulse_ball.name"),
- help: (lvl: number) =>
- lvl == 1
- ? t("upgrades.puck_repulse_ball.tooltip")
- : t("upgrades.puck_repulse_ball.help_plural"),
- fullHelp: t("upgrades.puck_repulse_ball.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 35000,
- gift: false,
-
- id: "wind",
- max: 3,
- name: t("upgrades.wind.name"),
- help: (lvl: number) =>
- lvl == 1 ? t("upgrades.wind.tooltip") : t("upgrades.wind.help_plural"),
- fullHelp: t("upgrades.wind.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 40000,
- gift: false,
-
- id: "sturdy_bricks",
- max: 4,
- name: t("upgrades.sturdy_bricks.name"),
- help: (lvl: number) =>
- // lvl == 1
- t("upgrades.sturdy_bricks.tooltip", {lvl, percent: lvl * 50}),
- // ?
- // : t("upgrades.sturdy_bricks.help_plural"),
- fullHelp: t("upgrades.sturdy_bricks.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 45000,
- gift: false,
-
- id: "respawn",
- max: 4,
- name: t("upgrades.respawn.name"),
- help: (lvl: number) =>
- t("upgrades.respawn.tooltip", {
- percent: Math.floor(100 * comboKeepingRate(lvl)),
- delay: (3 / lvl).toFixed(2),
- }),
- fullHelp: t("upgrades.respawn.verbose_description"),
- },
- {
- requires: "",
- threshold: 50000,
- gift: false,
-
- id: "one_more_choice",
- max: 3,
- name: t("upgrades.one_more_choice.name"),
- help: (lvl: number) => t("upgrades.one_more_choice.tooltip", {lvl}),
- fullHelp: t("upgrades.one_more_choice.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 55000,
- gift: false,
-
- id: "instant_upgrade",
- max: 2,
- adventure: false,
- name: t("upgrades.instant_upgrade.name"),
- help: (lvl: number) => t("upgrades.instant_upgrade.tooltip", {lvl}),
- fullHelp: t("upgrades.instant_upgrade.verbose_description"),
- },
- {
- requires: "",
- threshold: 60000,
- gift: false,
-
- id: "concave_puck",
- max: 1,
- name: t("upgrades.concave_puck.name"),
- help: (lvl: number) => t("upgrades.concave_puck.tooltip"),
- fullHelp: t("upgrades.concave_puck.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 65000,
- gift: false,
-
- id: "helium",
- max: 1,
- name: t("upgrades.helium.name"),
- help: (lvl: number) => t("upgrades.helium.tooltip"),
- fullHelp: t("upgrades.helium.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 70000,
- gift: true,
-
- id: "asceticism",
- max: 1,
- name: t("upgrades.asceticism.name"),
- help: (lvl: number) => t("upgrades.asceticism.tooltip", {combo: lvl * 3}),
- fullHelp: t("upgrades.asceticism.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 75000,
- gift: false,
-
- id: "unbounded",
- max: 3,
- name: t("upgrades.unbounded.name"),
- help: (lvl: number) => t("upgrades.unbounded.tooltip", {lvl}),
- fullHelp: t("upgrades.unbounded.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 80000,
- gift: false,
-
- id: "shunt",
- max: 3,
- name: t("upgrades.shunt.name"),
- help: (lvl: number) =>
- t("upgrades.shunt.tooltip", {
- percent: Math.round(comboKeepingRate(lvl) * 100),
- }),
- fullHelp: t("upgrades.shunt.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 85000,
- gift: false,
-
- id: "yoyo",
- max: 1,
- name: t("upgrades.yoyo.name"),
- help: (lvl: number) => t("upgrades.yoyo.tooltip"),
- fullHelp: t("upgrades.yoyo.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 90000,
- gift: true,
-
- id: "nbricks",
- max: 3,
- name: t("upgrades.nbricks.name"),
- help: (lvl: number) => t("upgrades.nbricks.tooltip", {lvl}),
- fullHelp: t("upgrades.nbricks.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 95000,
- gift: false,
-
- id: "etherealcoins",
- max: 1,
- name: t("upgrades.etherealcoins.name"),
- help: (lvl: number) => t("upgrades.etherealcoins.tooltip"),
- fullHelp: t("upgrades.etherealcoins.verbose_description"),
- },
- {
- requires: "multiball",
- threshold: 100000,
- gift: false,
-
- id: "shocks",
- max: 1,
- name: t("upgrades.shocks.name"),
- help: (lvl: number) => t("upgrades.shocks.tooltip"),
- fullHelp: t("upgrades.shocks.verbose_description"),
- },
- {
- requires: "",
- threshold: 105000,
- gift: true,
-
- id: "zen",
- max: 1,
- name: t("upgrades.zen.name"),
- help: (lvl: number) => t("upgrades.zen.tooltip", {lvl}),
- fullHelp: t("upgrades.zen.verbose_description"),
- },
- {
- requires: "extra_life",
- threshold: 110000,
- gift: false,
-
- id: "sacrifice",
- max: 1,
- name: t("upgrades.sacrifice.name"),
- help: (lvl: number) =>
- lvl == 1
- ? t("upgrades.sacrifice.help_l1")
- : t("upgrades.sacrifice.help_over", {lvl}),
- fullHelp: t("upgrades.sacrifice.verbose_description"),
- },
-
- {
- requires: "",
- threshold: 115000,
- gift: true,
-
- id: "trampoline",
- max: 1,
- name: t("upgrades.trampoline.name"),
- help: (lvl: number) => t("upgrades.trampoline.tooltip", {lvl}),
- fullHelp: t("upgrades.trampoline.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 120000,
- gift: false,
-
- id: "ghost_coins",
- max: 3,
- name: t("upgrades.ghost_coins.name"),
- help: (lvl: number) => t("upgrades.ghost_coins.tooltip", {lvl}),
- fullHelp: t("upgrades.ghost_coins.verbose_description"),
- },
- {
- requires: "",
- threshold: 125000,
- gift: false,
-
- id: "forgiving",
- max: 1,
- name: t("upgrades.forgiving.name"),
- help: (lvl: number) => t("upgrades.forgiving.tooltip"),
- fullHelp: t("upgrades.forgiving.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 130000,
- gift: false,
-
- id: "ball_attracts_coins",
- max: 3,
- name: t("upgrades.ball_attracts_coins.name"),
- help: (lvl: number) => t("upgrades.ball_attracts_coins.tooltip"),
- fullHelp: t("upgrades.ball_attracts_coins.verbose_description"),
- },
- {
- requires: "",
- threshold: 135000,
- // a bit too hard when starting up
- gift: false,
-
- id: "reach",
- max: 1,
- name: t("upgrades.reach.name"),
- help: (lvl: number) => t("upgrades.reach.tooltip", {lvl}),
- fullHelp: t("upgrades.reach.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 140000,
- gift: true,
-
- id: "passive_income",
- max: 4,
- name: t("upgrades.passive_income.name"),
- help: (lvl: number) =>
- t("upgrades.passive_income.tooltip", {time: lvl * 0.25, lvl}),
- fullHelp: t("upgrades.passive_income.verbose_description"),
- },
- {
- requires: "",
- threshold: 145000,
- gift: false,
-
- id: "clairvoyant",
- max: 1,
- name: t("upgrades.clairvoyant.name"),
- help: (lvl: number) => t("upgrades.clairvoyant.tooltip"),
- fullHelp: t("upgrades.clairvoyant.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 150000,
- gift: true,
-
- id: "side_kick",
- max: 3,
- name: t("upgrades.side_kick.name"),
- help: (lvl: number) =>
- t("upgrades.side_kick.tooltip", {lvl, loss: lvl * 2}),
- fullHelp: t("upgrades.side_kick.verbose_description"),
- },
- {
- requires: "",
-
- threshold: 150000,
- gift: true,
-
- id: "side_flip",
- max: 3,
- name: t("upgrades.side_flip.name"),
- help: (lvl: number) =>
- t("upgrades.side_flip.tooltip", {lvl, loss: lvl * 2}),
- fullHelp: t("upgrades.side_flip.verbose_description"),
- },
- {
- requires: "",
- threshold: 155000,
- gift: false,
-
- id: "implosions",
- max: 1,
- name: t("upgrades.implosions.name"),
- help: (lvl: number) => t("upgrades.implosions.tooltip"),
- fullHelp: t("upgrades.implosions.verbose_description"),
- },
- {
- requires: "",
- threshold: 160000,
- gift: false,
-
- id: "corner_shot",
- max: 1,
- name: t("upgrades.corner_shot.name"),
- help: (lvl: number) => t("upgrades.corner_shot.tooltip"),
- fullHelp: t("upgrades.corner_shot.verbose_description"),
- },
- {
- requires: "",
- threshold: 165000,
- gift: false,
-
- id: "addiction",
- max: 7,
- name: t("upgrades.addiction.name"),
- help: (lvl: number) =>
- t("upgrades.addiction.tooltip", {lvl, delay: (5 / lvl).toFixed(2)}),
- fullHelp: t("upgrades.addiction.verbose_description"),
- },
- {
- requires: "",
- threshold: 170000,
- gift: false,
-
- id: "fountain_toss",
- max: 7,
- name: t("upgrades.fountain_toss.name"),
- help: (lvl: number) =>
- t("upgrades.fountain_toss.tooltip", {lvl, max: lvl * 30}),
- fullHelp: t("upgrades.fountain_toss.verbose_description"),
- },
- {
- requires: "",
- threshold: 175000,
- gift: false,
-
- id: "limitless",
- max: 1,
- name: t("upgrades.limitless.name"),
- help: (lvl: number) => t("upgrades.limitless.tooltip", {lvl}),
- fullHelp: t("upgrades.limitless.verbose_description"),
- },
- {
- requires: "",
- threshold: 180000,
- gift: false,
-
- id: "minefield",
- max: 3,
- name: t("upgrades.minefield.name"),
- help: (lvl: number) => t("upgrades.minefield.tooltip", {lvl}),
- fullHelp: t("upgrades.minefield.verbose_description"),
- },
- {
- requires: "",
- threshold: 185000,
- gift: false,
-
- id: "trickledown",
- max: 1,
- name: t("upgrades.trickledown.name"),
- help: (lvl: number) => t("upgrades.trickledown.tooltip", {lvl}),
- fullHelp: t("upgrades.trickledown.verbose_description"),
- },
- {
- requires: "",
- threshold: 190000,
- gift: false,
-
- id: "transparency",
- max: 3,
- name: t("upgrades.transparency.name"),
- help: (lvl: number) => t("upgrades.transparency.tooltip", {lvl}),
- fullHelp: t("upgrades.transparency.verbose_description"),
- },
- {
- requires: "",
- threshold: 195000,
- gift: false,
-
- id: "superhot",
- max: 3,
- name: t("upgrades.superhot.name"),
- help: (lvl: number) => t("upgrades.superhot.tooltip", {lvl}),
- fullHelp: t("upgrades.superhot.verbose_description"),
- },
- {
- requires: "",
- threshold: 200000,
- gift: false,
-
- id: "bricks_attract_coins",
- max: 3,
- name: t("upgrades.bricks_attract_coins.name"),
- help: (lvl: number) => t("upgrades.bricks_attract_coins.tooltip", {lvl}),
- fullHelp: t("upgrades.bricks_attract_coins.verbose_description"),
- },
- {
- requires: "",
- threshold: 205000,
- gift: false,
-
- id: "rainbow",
- max: 7,
- name: t("upgrades.rainbow.name"),
- help: (lvl: number) => t("upgrades.rainbow.tooltip", {lvl}),
- fullHelp: t("upgrades.rainbow.verbose_description"),
- },
- {
- requires: "metamorphosis",
- threshold: 210000,
- gift: false,
-
- id: "hypnosis",
- max: 1,
- name: t("upgrades.hypnosis.name"),
- help: (lvl: number) => t("upgrades.hypnosis.tooltip", {lvl}),
- fullHelp: t("upgrades.hypnosis.verbose_description"),
- },
- {
- requires: "",
- threshold: 215000,
- gift: false,
- id: "bricks_attract_ball",
- max: 3,
- name: t("upgrades.bricks_attract_ball.name"),
- help: (lvl: number) => t("upgrades.bricks_attract_ball.tooltip", {count:lvl*3}),
- fullHelp: t("upgrades.bricks_attract_ball.verbose_description"),
- },
+ {
+ requires: "",
+ threshold: 0,
+ gift: false,
+
+ id: "extra_life",
+ max: 7,
+ name: t("upgrades.extra_life.name"),
+ help: (lvl: number) =>
+ lvl === 1
+ ? t("upgrades.extra_life.tooltip")
+ : t("upgrades.extra_life.help_plural", { lvl }),
+ fullHelp: t("upgrades.extra_life.verbose_description"),
+ },
+
+ {
+ requires: "",
+ threshold: 0,
+ id: "base_combo",
+ gift: true,
+
+ max: 7,
+ name: t("upgrades.base_combo.name"),
+ help: (lvl: number) =>
+ t("upgrades.base_combo.tooltip", { coins: 1 + lvl * 3 }),
+ fullHelp: t("upgrades.base_combo.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 0,
+ gift: false,
+
+ id: "slow_down",
+ max: 2,
+ name: t("upgrades.slow_down.name"),
+ help: (lvl: number) => t("upgrades.slow_down.tooltip", { lvl }),
+ fullHelp: t("upgrades.slow_down.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 0,
+ gift: false,
+
+ id: "bigger_puck",
+ max: 2,
+ name: t("upgrades.bigger_puck.name"),
+ help: () => t("upgrades.bigger_puck.tooltip"),
+ fullHelp: t("upgrades.bigger_puck.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 0,
+ gift: false,
+
+ id: "viscosity",
+ max: 3,
+
+ name: t("upgrades.viscosity.name"),
+ help: () => t("upgrades.viscosity.tooltip"),
+ fullHelp: t("upgrades.viscosity.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 50,
+ gift: false,
+
+ id: "skip_last",
+ max: 7,
+ name: t("upgrades.skip_last.name"),
+ help: (lvl: number) =>
+ lvl == 1
+ ? t("upgrades.skip_last.tooltip")
+ : t("upgrades.skip_last.help_plural", { lvl }),
+ fullHelp: t("upgrades.skip_last.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 100,
+ id: "streak_shots",
+ gift: true,
+
+ max: 1,
+ name: t("upgrades.streak_shots.name"),
+ help: (lvl: number) => t("upgrades.streak_shots.tooltip", { lvl }),
+ fullHelp: t("upgrades.streak_shots.verbose_description"),
+ },
+
+ {
+ requires: "",
+
+ threshold: 200,
+ id: "left_is_lava",
+ gift: true,
+
+ max: 1,
+
+ name: t("upgrades.left_is_lava.name"),
+ help: (lvl: number) => t("upgrades.left_is_lava.tooltip", { lvl }),
+ fullHelp: t("upgrades.left_is_lava.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 300,
+ id: "right_is_lava",
+ gift: true,
+
+ max: 1,
+ name: t("upgrades.right_is_lava.name"),
+ help: (lvl: number) => t("upgrades.right_is_lava.tooltip", { lvl }),
+ fullHelp: t("upgrades.right_is_lava.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 400,
+ id: "top_is_lava",
+ gift: true,
+
+ max: 1,
+ name: t("upgrades.top_is_lava.name"),
+ help: (lvl: number) => t("upgrades.top_is_lava.tooltip", { lvl }),
+ fullHelp: t("upgrades.top_is_lava.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 500,
+ id: "telekinesis",
+ gift: true,
+
+ max: 1,
+ name: t("upgrades.telekinesis.name"),
+ help: (lvl: number) =>
+ lvl == 1
+ ? t("upgrades.telekinesis.tooltip")
+ : t("upgrades.telekinesis.help_plural"),
+ fullHelp: t("upgrades.telekinesis.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 700,
+ gift: false,
+
+ id: "coin_magnet",
+ max: 3,
+ name: t("upgrades.coin_magnet.name"),
+ help: (lvl: number) =>
+ lvl == 1
+ ? t("upgrades.coin_magnet.tooltip")
+ : t("upgrades.coin_magnet.help_plural"),
+ fullHelp: t("upgrades.coin_magnet.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 800,
+ id: "multiball",
+ gift: true,
+
+ max: 6,
+ name: t("upgrades.multiball.name"),
+ help: (lvl: number) => t("upgrades.multiball.tooltip", { count: lvl + 1 }),
+ fullHelp: t("upgrades.multiball.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 1000,
+ gift: false,
+
+ id: "smaller_puck",
+ max: 2,
+ name: t("upgrades.smaller_puck.name"),
+ help: (lvl: number) =>
+ lvl == 1
+ ? t("upgrades.smaller_puck.tooltip")
+ : t("upgrades.smaller_puck.help_plural"),
+ fullHelp: t("upgrades.smaller_puck.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 1500,
+ id: "pierce",
+ gift: false,
+
+ max: 3,
+ name: t("upgrades.pierce.name"),
+ help: (lvl: number) => t("upgrades.pierce.tooltip", { count: 3 * lvl }),
+ fullHelp: t("upgrades.pierce.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 2000,
+ id: "picky_eater",
+ gift: true,
+
+ max: 1,
+ name: t("upgrades.picky_eater.name"),
+ help: (lvl: number) => t("upgrades.picky_eater.tooltip", { lvl }),
+ fullHelp: t("upgrades.picky_eater.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 2500,
+ gift: false,
+
+ id: "metamorphosis",
+ max: 1,
+ name: t("upgrades.metamorphosis.name"),
+ help: (lvl: number) => t("upgrades.metamorphosis.tooltip", { lvl }),
+ fullHelp: t("upgrades.metamorphosis.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 3000,
+ id: "compound_interest",
+ gift: true,
+
+ max: 1,
+ name: t("upgrades.compound_interest.name"),
+ help: (lvl: number) => t("upgrades.compound_interest.tooltip", { lvl }),
+ fullHelp: t("upgrades.compound_interest.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 4000,
+ id: "hot_start",
+ gift: true,
+
+ max: 3,
+ name: t("upgrades.hot_start.name"),
+ help: (lvl: number) =>
+ t("upgrades.hot_start.tooltip", {
+ start: lvl * 30 + 1,
+ loss: lvl,
+ }),
+ fullHelp: t("upgrades.hot_start.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 6000,
+ id: "sapper",
+ gift: false,
+
+ max: 7,
+ name: t("upgrades.sapper.name"),
+ help: (lvl: number) =>
+ lvl == 1
+ ? t("upgrades.sapper.tooltip")
+ : t("upgrades.sapper.help_plural", { lvl }),
+ fullHelp: t("upgrades.sapper.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 9000,
+ id: "bigger_explosions",
+ gift: false,
+
+ max: 1,
+ name: t("upgrades.bigger_explosions.name"),
+ help: (lvl: number) => t("upgrades.bigger_explosions.tooltip"),
+ fullHelp: t("upgrades.bigger_explosions.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 13000,
+ gift: false,
+
+ adventure: false,
+ id: "extra_levels",
+ max: 3,
+ name: t("upgrades.extra_levels.name"),
+ help: (lvl: number) =>
+ t("upgrades.extra_levels.tooltip", { count: lvl + 7 }),
+ fullHelp: t("upgrades.extra_levels.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 15000,
+ gift: false,
+
+ id: "pierce_color",
+ max: 4,
+ name: t("upgrades.pierce_color.name"),
+ help: (lvl: number) => t("upgrades.pierce_color.tooltip", { lvl }),
+ fullHelp: t("upgrades.pierce_color.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 18000,
+ gift: false,
+
+ id: "soft_reset",
+ max: 3,
+ name: t("upgrades.soft_reset.name"),
+ help: (lvl: number) =>
+ t("upgrades.soft_reset.tooltip", {
+ percent: Math.round(comboKeepingRate(lvl) * 100),
+ }),
+ fullHelp: t("upgrades.soft_reset.verbose_description"),
+ },
+ {
+ requires: "multiball",
+ threshold: 21000,
+ gift: false,
+
+ id: "ball_repulse_ball",
+ max: 3,
+ name: t("upgrades.ball_repulse_ball.name"),
+ help: (lvl: number) =>
+ lvl == 1
+ ? t("upgrades.ball_repulse_ball.tooltip")
+ : t("upgrades.ball_repulse_ball.help_plural"),
+ fullHelp: t("upgrades.ball_repulse_ball.verbose_description"),
+ },
+ {
+ requires: "multiball",
+ threshold: 25000,
+ gift: false,
+
+ id: "ball_attract_ball",
+ max: 3,
+ name: t("upgrades.ball_attract_ball.name"),
+ help: (lvl: number) =>
+ lvl == 1
+ ? t("upgrades.ball_attract_ball.tooltip")
+ : t("upgrades.ball_attract_ball.help_plural"),
+ fullHelp: t("upgrades.ball_attract_ball.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 30000,
+ gift: false,
+
+ id: "puck_repulse_ball",
+ max: 2,
+ name: t("upgrades.puck_repulse_ball.name"),
+ help: (lvl: number) =>
+ lvl == 1
+ ? t("upgrades.puck_repulse_ball.tooltip")
+ : t("upgrades.puck_repulse_ball.help_plural"),
+ fullHelp: t("upgrades.puck_repulse_ball.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 35000,
+ gift: false,
+
+ id: "wind",
+ max: 3,
+ name: t("upgrades.wind.name"),
+ help: (lvl: number) =>
+ lvl == 1 ? t("upgrades.wind.tooltip") : t("upgrades.wind.help_plural"),
+ fullHelp: t("upgrades.wind.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 40000,
+ gift: false,
+
+ id: "sturdy_bricks",
+ max: 4,
+ name: t("upgrades.sturdy_bricks.name"),
+ help: (lvl: number) =>
+ // lvl == 1
+ t("upgrades.sturdy_bricks.tooltip", { lvl, percent: lvl * 50 }),
+ // ?
+ // : t("upgrades.sturdy_bricks.help_plural"),
+ fullHelp: t("upgrades.sturdy_bricks.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 45000,
+ gift: false,
+
+ id: "respawn",
+ max: 4,
+ name: t("upgrades.respawn.name"),
+ help: (lvl: number) =>
+ t("upgrades.respawn.tooltip", {
+ percent: Math.floor(100 * comboKeepingRate(lvl)),
+ delay: (3 / lvl).toFixed(2),
+ }),
+ fullHelp: t("upgrades.respawn.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 50000,
+ gift: false,
+
+ id: "one_more_choice",
+ max: 3,
+ name: t("upgrades.one_more_choice.name"),
+ help: (lvl: number) => t("upgrades.one_more_choice.tooltip", { lvl }),
+ fullHelp: t("upgrades.one_more_choice.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 55000,
+ gift: false,
+
+ id: "instant_upgrade",
+ max: 2,
+ adventure: false,
+ name: t("upgrades.instant_upgrade.name"),
+ help: (lvl: number) => t("upgrades.instant_upgrade.tooltip", { lvl }),
+ fullHelp: t("upgrades.instant_upgrade.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 60000,
+ gift: false,
+
+ id: "concave_puck",
+ max: 1,
+ name: t("upgrades.concave_puck.name"),
+ help: (lvl: number) => t("upgrades.concave_puck.tooltip"),
+ fullHelp: t("upgrades.concave_puck.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 65000,
+ gift: false,
+
+ id: "helium",
+ max: 1,
+ name: t("upgrades.helium.name"),
+ help: (lvl: number) => t("upgrades.helium.tooltip"),
+ fullHelp: t("upgrades.helium.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 70000,
+ gift: true,
+
+ id: "asceticism",
+ max: 1,
+ name: t("upgrades.asceticism.name"),
+ help: (lvl: number) => t("upgrades.asceticism.tooltip", { combo: lvl * 3 }),
+ fullHelp: t("upgrades.asceticism.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 75000,
+ gift: false,
+
+ id: "unbounded",
+ max: 3,
+ name: t("upgrades.unbounded.name"),
+ help: (lvl: number) => t("upgrades.unbounded.tooltip", { lvl }),
+ fullHelp: t("upgrades.unbounded.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 80000,
+ gift: false,
+
+ id: "shunt",
+ max: 3,
+ name: t("upgrades.shunt.name"),
+ help: (lvl: number) =>
+ t("upgrades.shunt.tooltip", {
+ percent: Math.round(comboKeepingRate(lvl) * 100),
+ }),
+ fullHelp: t("upgrades.shunt.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 85000,
+ gift: false,
+
+ id: "yoyo",
+ max: 1,
+ name: t("upgrades.yoyo.name"),
+ help: (lvl: number) => t("upgrades.yoyo.tooltip"),
+ fullHelp: t("upgrades.yoyo.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 90000,
+ gift: true,
+
+ id: "nbricks",
+ max: 3,
+ name: t("upgrades.nbricks.name"),
+ help: (lvl: number) => t("upgrades.nbricks.tooltip", { lvl }),
+ fullHelp: t("upgrades.nbricks.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 95000,
+ gift: false,
+
+ id: "etherealcoins",
+ max: 1,
+ name: t("upgrades.etherealcoins.name"),
+ help: (lvl: number) => t("upgrades.etherealcoins.tooltip"),
+ fullHelp: t("upgrades.etherealcoins.verbose_description"),
+ },
+ {
+ requires: "multiball",
+ threshold: 100000,
+ gift: false,
+
+ id: "shocks",
+ max: 1,
+ name: t("upgrades.shocks.name"),
+ help: (lvl: number) => t("upgrades.shocks.tooltip"),
+ fullHelp: t("upgrades.shocks.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 105000,
+ gift: true,
+
+ id: "zen",
+ max: 1,
+ name: t("upgrades.zen.name"),
+ help: (lvl: number) => t("upgrades.zen.tooltip", { lvl }),
+ fullHelp: t("upgrades.zen.verbose_description"),
+ },
+ {
+ requires: "extra_life",
+ threshold: 110000,
+ gift: false,
+
+ id: "sacrifice",
+ max: 1,
+ name: t("upgrades.sacrifice.name"),
+ help: (lvl: number) =>
+ lvl == 1
+ ? t("upgrades.sacrifice.help_l1")
+ : t("upgrades.sacrifice.help_over", { lvl }),
+ fullHelp: t("upgrades.sacrifice.verbose_description"),
+ },
+
+ {
+ requires: "",
+ threshold: 115000,
+ gift: true,
+
+ id: "trampoline",
+ max: 1,
+ name: t("upgrades.trampoline.name"),
+ help: (lvl: number) => t("upgrades.trampoline.tooltip", { lvl }),
+ fullHelp: t("upgrades.trampoline.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 120000,
+ gift: false,
+
+ id: "ghost_coins",
+ max: 3,
+ name: t("upgrades.ghost_coins.name"),
+ help: (lvl: number) => t("upgrades.ghost_coins.tooltip", { lvl }),
+ fullHelp: t("upgrades.ghost_coins.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 125000,
+ gift: false,
+
+ id: "forgiving",
+ max: 1,
+ name: t("upgrades.forgiving.name"),
+ help: (lvl: number) => t("upgrades.forgiving.tooltip"),
+ fullHelp: t("upgrades.forgiving.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 130000,
+ gift: false,
+
+ id: "ball_attracts_coins",
+ max: 3,
+ name: t("upgrades.ball_attracts_coins.name"),
+ help: (lvl: number) => t("upgrades.ball_attracts_coins.tooltip"),
+ fullHelp: t("upgrades.ball_attracts_coins.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 135000,
+ // a bit too hard when starting up
+ gift: false,
+
+ id: "reach",
+ max: 1,
+ name: t("upgrades.reach.name"),
+ help: (lvl: number) => t("upgrades.reach.tooltip", { lvl }),
+ fullHelp: t("upgrades.reach.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 140000,
+ gift: true,
+
+ id: "passive_income",
+ max: 4,
+ name: t("upgrades.passive_income.name"),
+ help: (lvl: number) =>
+ t("upgrades.passive_income.tooltip", { time: lvl * 0.25, lvl }),
+ fullHelp: t("upgrades.passive_income.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 145000,
+ gift: false,
+
+ id: "clairvoyant",
+ max: 1,
+ name: t("upgrades.clairvoyant.name"),
+ help: (lvl: number) => t("upgrades.clairvoyant.tooltip"),
+ fullHelp: t("upgrades.clairvoyant.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 150000,
+ gift: true,
+
+ id: "side_kick",
+ max: 3,
+ name: t("upgrades.side_kick.name"),
+ help: (lvl: number) =>
+ t("upgrades.side_kick.tooltip", { lvl, loss: lvl * 2 }),
+ fullHelp: t("upgrades.side_kick.verbose_description"),
+ },
+ {
+ requires: "",
+
+ threshold: 150000,
+ gift: true,
+
+ id: "side_flip",
+ max: 3,
+ name: t("upgrades.side_flip.name"),
+ help: (lvl: number) =>
+ t("upgrades.side_flip.tooltip", { lvl, loss: lvl * 2 }),
+ fullHelp: t("upgrades.side_flip.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 155000,
+ gift: false,
+
+ id: "implosions",
+ max: 1,
+ name: t("upgrades.implosions.name"),
+ help: (lvl: number) => t("upgrades.implosions.tooltip"),
+ fullHelp: t("upgrades.implosions.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 160000,
+ gift: false,
+
+ id: "corner_shot",
+ max: 1,
+ name: t("upgrades.corner_shot.name"),
+ help: (lvl: number) => t("upgrades.corner_shot.tooltip"),
+ fullHelp: t("upgrades.corner_shot.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 165000,
+ gift: false,
+
+ id: "addiction",
+ max: 7,
+ name: t("upgrades.addiction.name"),
+ help: (lvl: number) =>
+ t("upgrades.addiction.tooltip", { lvl, delay: (5 / lvl).toFixed(2) }),
+ fullHelp: t("upgrades.addiction.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 170000,
+ gift: false,
+
+ id: "fountain_toss",
+ max: 7,
+ name: t("upgrades.fountain_toss.name"),
+ help: (lvl: number) =>
+ t("upgrades.fountain_toss.tooltip", { lvl, max: lvl * 30 }),
+ fullHelp: t("upgrades.fountain_toss.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 175000,
+ gift: false,
+
+ id: "limitless",
+ max: 1,
+ name: t("upgrades.limitless.name"),
+ help: (lvl: number) => t("upgrades.limitless.tooltip", { lvl }),
+ fullHelp: t("upgrades.limitless.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 180000,
+ gift: false,
+
+ id: "minefield",
+ max: 3,
+ name: t("upgrades.minefield.name"),
+ help: (lvl: number) => t("upgrades.minefield.tooltip", { lvl }),
+ fullHelp: t("upgrades.minefield.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 185000,
+ gift: false,
+
+ id: "trickledown",
+ max: 1,
+ name: t("upgrades.trickledown.name"),
+ help: (lvl: number) => t("upgrades.trickledown.tooltip", { lvl }),
+ fullHelp: t("upgrades.trickledown.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 190000,
+ gift: false,
+
+ id: "transparency",
+ max: 3,
+ name: t("upgrades.transparency.name"),
+ help: (lvl: number) => t("upgrades.transparency.tooltip", { lvl }),
+ fullHelp: t("upgrades.transparency.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 195000,
+ gift: false,
+
+ id: "superhot",
+ max: 3,
+ name: t("upgrades.superhot.name"),
+ help: (lvl: number) => t("upgrades.superhot.tooltip", { lvl }),
+ fullHelp: t("upgrades.superhot.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 200000,
+ gift: false,
+
+ id: "bricks_attract_coins",
+ max: 3,
+ name: t("upgrades.bricks_attract_coins.name"),
+ help: (lvl: number) => t("upgrades.bricks_attract_coins.tooltip", { lvl }),
+ fullHelp: t("upgrades.bricks_attract_coins.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 205000,
+ gift: false,
+
+ id: "rainbow",
+ max: 7,
+ name: t("upgrades.rainbow.name"),
+ help: (lvl: number) => t("upgrades.rainbow.tooltip", { lvl }),
+ fullHelp: t("upgrades.rainbow.verbose_description"),
+ },
+ {
+ requires: "metamorphosis",
+ threshold: 210000,
+ gift: false,
+
+ id: "hypnosis",
+ max: 1,
+ name: t("upgrades.hypnosis.name"),
+ help: (lvl: number) => t("upgrades.hypnosis.tooltip", { lvl }),
+ fullHelp: t("upgrades.hypnosis.verbose_description"),
+ },
+ {
+ requires: "",
+ threshold: 215000,
+ gift: false,
+ id: "bricks_attract_ball",
+ max: 3,
+ name: t("upgrades.bricks_attract_ball.name"),
+ help: (lvl: number) =>
+ t("upgrades.bricks_attract_ball.tooltip", { count: lvl * 3 }),
+ fullHelp: t("upgrades.bricks_attract_ball.verbose_description"),
+ },
] as const;