mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-04-24 14:06:16 -04:00
Overcomplicated looping mechanic
This commit is contained in:
parent
5012076039
commit
39b326a15b
18 changed files with 296 additions and 125 deletions
|
@ -1,5 +1,5 @@
|
|||
// The version of the cache.
|
||||
const VERSION = "29053110";
|
||||
const VERSION = "29053158";
|
||||
|
||||
// The name of the cache
|
||||
const CACHE_NAME = `breakout-71-${VERSION}`;
|
||||
|
|
|
@ -82,6 +82,7 @@ export async function asyncAlert<t>({
|
|||
content
|
||||
?.filter((i) => i)
|
||||
.forEach((entry, index) => {
|
||||
if(!entry) return;
|
||||
if (typeof entry == "string") {
|
||||
const p = document.createElement("div");
|
||||
p.innerHTML = entry;
|
||||
|
|
|
@ -1 +1 @@
|
|||
"29053110"
|
||||
"29053158"
|
||||
|
|
|
@ -3,10 +3,16 @@ import { Debuff } from "./types";
|
|||
|
||||
export const debuffs = [
|
||||
{
|
||||
id: "negative_coins",
|
||||
id: "deadly_coins",
|
||||
max: 20,
|
||||
name: (lvl: number) => t("debuffs.negative_coins.help", { lvl }),
|
||||
help: (lvl: number) => t("debuffs.negative_coins.help", { lvl }),
|
||||
name: (lvl: number) => t("debuffs.deadly_coins.help", { lvl }),
|
||||
help: (lvl: number) => t("debuffs.deadly_coins.help", { lvl }),
|
||||
},
|
||||
{
|
||||
id: "frozen_coins",
|
||||
max: 20,
|
||||
name: (lvl: number) => t("debuffs.frozen_coins.help", { lvl }),
|
||||
help: (lvl: number) => t("debuffs.frozen_coins.help", { lvl }),
|
||||
},
|
||||
{
|
||||
id: "more_bombs",
|
||||
|
|
13
src/game.ts
13
src/game.ts
|
@ -466,6 +466,8 @@ async function openScorePanel() {
|
|||
pickedUpgradesHTMl(gameState),
|
||||
levelsListHTMl(gameState),
|
||||
debuffsHTMl(gameState),
|
||||
gameState.rerolls?
|
||||
t('score_panel.rerolls_count', {rerolls:gameState.rerolls}):''
|
||||
],
|
||||
allowClose: true,
|
||||
});
|
||||
|
@ -1008,8 +1010,8 @@ restart(
|
|||
(window.location.search.includes("stressTest") && {
|
||||
level: "Bird",
|
||||
perks: {
|
||||
// sapper: 5,
|
||||
// bigger_explosions: 20,
|
||||
sapper: 5,
|
||||
bigger_explosions: 20,
|
||||
// // unbounded: 1,
|
||||
// // pierce_color: 1,
|
||||
// pierce: 1,
|
||||
|
@ -1022,12 +1024,15 @@ restart(
|
|||
// metamorphosis: 1,
|
||||
// implosions: 1,
|
||||
// sturdy_bricks:5
|
||||
coin_magnet:2,
|
||||
coin_magnet: 2,
|
||||
extra_life: 3,
|
||||
},
|
||||
levelsPerLoop:2,
|
||||
|
||||
debuffs: {
|
||||
// fragility:3
|
||||
negative_coins: 100,
|
||||
// deadly_coins: 20,
|
||||
// frozen_coins: 20,
|
||||
// interference:20,
|
||||
},
|
||||
}) ||
|
||||
|
|
|
@ -61,8 +61,8 @@ import { debuffs } from "./debuffs";
|
|||
import { requiredAsyncAlert } from "./asyncAlert";
|
||||
|
||||
export function setMousePos(gameState: GameState, x: number) {
|
||||
gameState.desiredPuckPosition = x;
|
||||
// Sets the puck position, and updates the ball position if they are supposed to follow it
|
||||
gameState.puckPosition = x;
|
||||
gameState.needsRender = true;
|
||||
}
|
||||
|
||||
|
@ -166,6 +166,11 @@ export function normalizeGameState(gameState: GameState) {
|
|||
gameState.gameZoneWidthRoundedUp -
|
||||
gameState.puckWidth / 2;
|
||||
|
||||
if (gameState.puckFrozenUntil < gameState.levelTime || !gameState.levelTime) {
|
||||
// Frozen, ignore
|
||||
gameState.puckPosition = gameState.desiredPuckPosition;
|
||||
}
|
||||
|
||||
gameState.puckPosition = clamp(gameState.puckPosition, minX, maxX);
|
||||
|
||||
if (gameState.ballStickToPuck) {
|
||||
|
@ -182,7 +187,11 @@ export function normalizeGameState(gameState: GameState) {
|
|||
}
|
||||
|
||||
export function baseCombo(gameState: GameState) {
|
||||
return gameState.baseCombo + gameState.perks.base_combo * 3 + gameState.perks.smaller_puck * 5;
|
||||
return (
|
||||
gameState.baseCombo +
|
||||
gameState.perks.base_combo * 3 +
|
||||
gameState.perks.smaller_puck * 5
|
||||
);
|
||||
}
|
||||
|
||||
export function resetCombo(
|
||||
|
@ -594,13 +603,13 @@ export async function gotoNextLoop(gameState: GameState) {
|
|||
gameState.runLevels = getRunLevels(gameState.totalScoreAtRunStart, {});
|
||||
gameState.upgradesOfferedFor = -1;
|
||||
|
||||
let comboText=''
|
||||
if(gameState.rerolls) {
|
||||
comboText=t('loop.converted_rerolls',{n:gameState.rerolls})
|
||||
gameState.baseCombo += gameState.rerolls
|
||||
gameState.rerolls=0
|
||||
}else{
|
||||
comboText=t('loop.no_rerolls')
|
||||
let comboText = "";
|
||||
if (gameState.rerolls) {
|
||||
comboText = t("loop.converted_rerolls", { n: gameState.rerolls });
|
||||
gameState.baseCombo += gameState.rerolls;
|
||||
gameState.rerolls = 0;
|
||||
} else {
|
||||
comboText = t("loop.no_rerolls");
|
||||
}
|
||||
|
||||
const userPerks = upgrades.filter((u) => gameState.perks[u.id]);
|
||||
|
@ -612,7 +621,7 @@ export async function gotoNextLoop(gameState: GameState) {
|
|||
title: t("loop.title", { loop: gameState.loop }),
|
||||
content: [
|
||||
t("loop.instructions"),
|
||||
comboText,
|
||||
comboText,
|
||||
|
||||
...userPerks.map((u) => {
|
||||
const randomDebuff =
|
||||
|
@ -675,6 +684,7 @@ export async function setLevel(gameState: GameState, l: number) {
|
|||
gameState.levelStartScore = gameState.score;
|
||||
gameState.levelSpawnedCoins = 0;
|
||||
gameState.levelMisses = 0;
|
||||
gameState.puckFrozenUntil = 0;
|
||||
gameState.runStatistics.levelsPlayed++;
|
||||
|
||||
// Reset combo silently
|
||||
|
@ -1049,7 +1059,10 @@ export function gameStateTick(
|
|||
|
||||
const ratio =
|
||||
1 -
|
||||
((coin.color === "crimson" ? 3 : gameState.perks.viscosity) * 0.03 +
|
||||
((coin.color === "crimson" || coin.color === "LightSkyBlue"
|
||||
? 3
|
||||
: gameState.perks.viscosity) *
|
||||
0.03 +
|
||||
0.005) *
|
||||
frames;
|
||||
|
||||
|
@ -1085,19 +1098,19 @@ export function gameStateTick(
|
|||
}
|
||||
}
|
||||
|
||||
if(coin.color === "crimson" && !isOptionOn('basic')){
|
||||
const angle=Math.random()*Math.PI*2
|
||||
makeParticle(
|
||||
gameState,
|
||||
coin.x,
|
||||
coin.y,
|
||||
Math.cos(angle)*gameState.baseSpeed*2,
|
||||
Math.sin(angle)*gameState.baseSpeed*2,
|
||||
'red',
|
||||
true,
|
||||
5,
|
||||
250,
|
||||
);
|
||||
if (coin.color === "crimson" && !isOptionOn("basic")) {
|
||||
const angle = Math.random() * Math.PI * 2;
|
||||
makeParticle(
|
||||
gameState,
|
||||
coin.x,
|
||||
coin.y,
|
||||
Math.cos(angle) * gameState.baseSpeed * 2,
|
||||
Math.sin(angle) * gameState.baseSpeed * 2,
|
||||
"red",
|
||||
true,
|
||||
5,
|
||||
250,
|
||||
);
|
||||
}
|
||||
|
||||
const speed = (Math.abs(coin.vx) + Math.abs(coin.vy)) * 10;
|
||||
|
@ -1112,16 +1125,22 @@ export function gameStateTick(
|
|||
// a bit of margin to be nice , negative in case it's a negative coin
|
||||
gameState.puckHeight * (coin.points ? 1 : -1)
|
||||
) {
|
||||
if (coin.points) {
|
||||
addToScore(gameState, coin);
|
||||
} else if (gameState.perks.extra_life && gameState.balls.length) {
|
||||
justLostALife(gameState, gameState.balls[0], coin.x, coin.y);
|
||||
} else {
|
||||
gameOver(
|
||||
t("gameOver.because_cursed_coin"),
|
||||
t("gameOver.because_cursed_coin_intro"),
|
||||
);
|
||||
if (coin.color === "crimson") {
|
||||
if (gameState.perks.extra_life && gameState.balls.length) {
|
||||
justLostALife(gameState, gameState.balls[0], coin.x, coin.y);
|
||||
} else {
|
||||
gameOver(
|
||||
t("gameOver.because_cursed_coin"),
|
||||
t("gameOver.because_cursed_coin_intro"),
|
||||
);
|
||||
}
|
||||
}
|
||||
if (coin.color === "LightSkyBlue") {
|
||||
gameState.puckFrozenUntil = gameState.levelTime + 500;
|
||||
schedulGameSound(gameState, "freeze", coin.x, 1);
|
||||
}
|
||||
addToScore(gameState, coin);
|
||||
|
||||
destroy(gameState.coins, coinIndex);
|
||||
} else if (coin.y > gameState.canvasHeight + coinRadius) {
|
||||
destroy(gameState.coins, coinIndex);
|
||||
|
@ -1746,12 +1765,21 @@ function makeCoin(
|
|||
color = "gold",
|
||||
points = 1,
|
||||
) {
|
||||
if (y<gameState.gameZoneWidth*2/3 &&
|
||||
gameState.debuffs.negative_coins * points > Math.random() * 10000) {
|
||||
let weight = 0.8 + Math.random() * 0.2 + Math.min(2, points * 0.01);
|
||||
if (
|
||||
y < (gameState.gameZoneWidth * 2) / 3 &&
|
||||
gameState.debuffs.deadly_coins * points > Math.random() * 10000
|
||||
) {
|
||||
points = 0;
|
||||
color = "crimson";
|
||||
vx=0
|
||||
vy=0
|
||||
vx = 0;
|
||||
vy = 0;
|
||||
schedulGameSound(gameState, "void", x, 0.5);
|
||||
weight = 1;
|
||||
} else if (gameState.debuffs.frozen_coins * points > Math.random() * 10000) {
|
||||
color = "LightSkyBlue";
|
||||
schedulGameSound(gameState, "freeze", x, 0.5);
|
||||
weight = 1;
|
||||
}
|
||||
append(gameState.coins, (p: Partial<Coin>) => {
|
||||
p.x = x;
|
||||
|
@ -1767,8 +1795,8 @@ function makeCoin(
|
|||
p.color = color;
|
||||
p.a = Math.random() * Math.PI * 2;
|
||||
p.sa = Math.random() - 0.5;
|
||||
p.weight = 0.8 + Math.random() * 0.2 + Math.min(2, points * 0.01);
|
||||
p.points = points;
|
||||
p.weight = weight;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -15,6 +15,12 @@ export function sample<T>(arr: T[]): T {
|
|||
return arr[Math.floor(arr.length * Math.random())];
|
||||
}
|
||||
|
||||
export function sampleN<T>(arr: T[],n:number): T[] {
|
||||
|
||||
return [...arr].sort(()=>Math.random()-0.5)
|
||||
.slice(0,n)
|
||||
}
|
||||
|
||||
export function sumOfValues(obj: { [key: string]: number } | undefined | null) {
|
||||
if (!obj) return 0;
|
||||
return Object.values(obj)?.reduce((a, b) => a + b, 0) || 0;
|
||||
|
@ -55,7 +61,7 @@ export function getPossibleUpgrades(gameState: GameState) {
|
|||
}
|
||||
|
||||
export function max_levels(gameState: GameState) {
|
||||
return 7 + gameState.perks.extra_levels;
|
||||
return gameState.levelsPerLoop + gameState.perks.extra_levels;
|
||||
}
|
||||
|
||||
export function pickedUpgradesHTMl(gameState: GameState) {
|
||||
|
@ -143,6 +149,7 @@ export function defaultSounds() {
|
|||
coinCatch: { vol: 0, x: 0 },
|
||||
colorChange: { vol: 0, x: 0 },
|
||||
void: { vol: 0, x: 0 },
|
||||
freeze: { vol: 0, x: 0 },
|
||||
},
|
||||
};
|
||||
}
|
||||
|
|
|
@ -122,6 +122,26 @@
|
|||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>deadly_coins</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>help</name>
|
||||
<description/>
|
||||
<comment/>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-FR</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>fragility</name>
|
||||
<children>
|
||||
|
@ -142,6 +162,26 @@
|
|||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>frozen_coins</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>help</name>
|
||||
<description/>
|
||||
<comment/>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-FR</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>interference</name>
|
||||
<children>
|
||||
|
@ -182,26 +222,6 @@
|
|||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>negative_coins</name>
|
||||
<children>
|
||||
<concept_node>
|
||||
<name>help</name>
|
||||
<description/>
|
||||
<comment/>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>true</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-FR</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
</children>
|
||||
</folder_node>
|
||||
<folder_node>
|
||||
<name>sturdiness</name>
|
||||
<children>
|
||||
|
@ -2077,6 +2097,21 @@
|
|||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>rerolls_count</name>
|
||||
<description/>
|
||||
<comment/>
|
||||
<translations>
|
||||
<translation>
|
||||
<language>en-US</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
<translation>
|
||||
<language>fr-FR</language>
|
||||
<approved>false</approved>
|
||||
</translation>
|
||||
</translations>
|
||||
</concept_node>
|
||||
<concept_node>
|
||||
<name>test_run</name>
|
||||
<description/>
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
"confirmRestart.yes": "Restart game",
|
||||
"debuffs.banned.description": "{{lvl}} banned perk(s) : {{banned}}.",
|
||||
"debuffs.banned.help": "{{perk}} is banned for this run.",
|
||||
"debuffs.fragility.help": "Explosions destroy {{percent}} of coins and reset combo.",
|
||||
"debuffs.deadly_coins.help": "{{lvl}} ou of 10 000 coins spawn deadly, blinking red. Game over if you catch them, unless you had an extra life to spare.",
|
||||
"debuffs.fragility.help": "Explosions destroy {{percent}}% of coins and reset combo.",
|
||||
"debuffs.frozen_coins.help": "{{lvl}} coins out of 10000 spawn frozen, and will lock the puck for 0.5s if caught.",
|
||||
"debuffs.interference.help": "Telekinesis and yo-yo glitch for {{lvl}}s every 7s.",
|
||||
"debuffs.more_bombs.help": "{{lvl}} bricks replaced by bombs.",
|
||||
"debuffs.negative_coins.help": "{{lvl}}/10000 of coins spawn cursed, blinking red. Game over if you catch them.",
|
||||
"debuffs.sturdiness.help": "All bricks have +{{lvl}} HP",
|
||||
"gameOver.because_cursed_coin": "Game over",
|
||||
"gameOver.because_cursed_coin_intro": "You cough a cursed coin (bright red coins) and didn't have a extra life to spare. ",
|
||||
|
@ -130,6 +131,7 @@
|
|||
"sandbox.title": "Sandbox mode",
|
||||
"sandbox.unlocks_at": "Unlocks at total score {{score}}",
|
||||
"score_panel.bebuffs_list": "De-buffs :",
|
||||
"score_panel.rerolls_count": "You have accumulated {{rerolls}} rerolls",
|
||||
"score_panel.test_run": "This is a test run, score is not recorded permanently",
|
||||
"score_panel.title": "{{score}} points at level {{level}}/{{max}} ",
|
||||
"score_panel.title_looped": "{{score}} points at level {{level}}/{{max}} of loop {{loop}}",
|
||||
|
|
|
@ -5,10 +5,11 @@
|
|||
"confirmRestart.yes": "Commencer une nouvelle partie",
|
||||
"debuffs.banned.description": "{{lvl}} amélioration(s) bannie(s) : {{banned}}.",
|
||||
"debuffs.banned.help": "{{perk}} est banni pour cette course.",
|
||||
"debuffs.fragility.help": "Les explosions détruisent {{percent}} pièces et réinitialisent le combo.",
|
||||
"debuffs.deadly_coins.help": "{{lvl}} pièces sur 10000 apparaissent maudites et clignotent en rouge. La partie est terminée si vous les attrapez, sauf si vous avez une vie en stock.",
|
||||
"debuffs.fragility.help": "Les explosions détruisent {{percent}}% des pièces et réinitialisent le combo.",
|
||||
"debuffs.frozen_coins.help": "{{lvl}} pièces sur 10000 apparaît gelée, et glace le palet pendant 0.5 si vous l'attrapez. ",
|
||||
"debuffs.interference.help": "Télékinésie et problème de yo-yo pendant {{lvl}}s toutes les 7 s.",
|
||||
"debuffs.more_bombs.help": "{{lvl}} briques remplacées par des bombes.",
|
||||
"debuffs.negative_coins.help": "{{lvl}}/10000 pièces apparaissent maudites et clignotent en rouge. La partie est terminée si vous les attrapez.",
|
||||
"debuffs.sturdiness.help": "Toutes les briques résistent à +{{lvl}} chocs",
|
||||
"gameOver.because_cursed_coin": "Jeu terminé",
|
||||
"gameOver.because_cursed_coin_intro": "Vous avez craché une pièce maudite (pièces rouge vif) et vous n'aviez pas de vie supplémentaire à revendre.",
|
||||
|
@ -48,9 +49,9 @@
|
|||
"level_up.unlocked_level": " (Niveau)",
|
||||
"level_up.unlocked_perk": " (Amélioration)",
|
||||
"level_up.upgrade_perk_to_level": " niveau {{level}}",
|
||||
"loop.converted_rerolls": "",
|
||||
"loop.converted_rerolls": "Vos {{n}} relances restantes ont été converties en +{{n}} combo de base.",
|
||||
"loop.instructions": "Tous vos avantages seront supprimés, sauf un que vous pouvez choisir ci-dessous. Chaque option comporte un danger supplémentaire qui apparaîtra à tous les niveaux.",
|
||||
"loop.no_rerolls": "",
|
||||
"loop.no_rerolls": "Vous n'aviez plus de relances, donc votre combo de base est resté le même.",
|
||||
"loop.title": "Boucle de départ {{loop}}",
|
||||
"main_menu.basic": "Graphismes simplifiés",
|
||||
"main_menu.basic_help": "Meilleures performances.",
|
||||
|
@ -130,6 +131,7 @@
|
|||
"sandbox.title": "Mode bac à sable",
|
||||
"sandbox.unlocks_at": "Déverrouillé à partir d'un score total de {{score}}",
|
||||
"score_panel.bebuffs_list": "Handicapes : ",
|
||||
"score_panel.rerolls_count": "Vous avez accumulé {{rerolls}} rerolls",
|
||||
"score_panel.test_run": "Il s'agit d'une partie d'essai, le score n'est pas enregistré.",
|
||||
"score_panel.title": "{{score}} points au niveau {{level}}/{{max}} ",
|
||||
"score_panel.title_looped": "{{score}} points au niveau {{level}}/{{max}} ",
|
||||
|
|
|
@ -51,6 +51,7 @@ export function newGameState(params: RunParams): GameState {
|
|||
ballStickToPuck: true,
|
||||
puckPosition: 400,
|
||||
lastPuckPosition: 400,
|
||||
desiredPuckPosition: 400,
|
||||
lastPuckMove: 0,
|
||||
pauseTimeout: null,
|
||||
canvasWidth: 0,
|
||||
|
@ -111,6 +112,8 @@ export function newGameState(params: RunParams): GameState {
|
|||
rerolls: 0,
|
||||
loop: 0,
|
||||
baseCombo: 1,
|
||||
puckFrozenUntil: 0,
|
||||
levelsPerLoop: params?.levelsPerLoop ?? 7,
|
||||
};
|
||||
resetBalls(gameState);
|
||||
|
||||
|
|
|
@ -200,27 +200,49 @@ export function render(gameState: GameState) {
|
|||
);
|
||||
});
|
||||
|
||||
if (gameState.debuffs.negative_coins) {
|
||||
if (gameState.debuffs.deadly_coins || gameState.debuffs.frozen_coins) {
|
||||
// Render crimson coins very bright
|
||||
ctx.globalCompositeOperation = "source-over";
|
||||
ctx.globalAlpha = 0.8;
|
||||
const red = Math.floor(gameState.levelTime / 100) % 2 > 0;
|
||||
forEachLiveOne(gameState.coins, (coin) => {
|
||||
if (coin.color !== "crimson") return;
|
||||
drawBall(ctx, red ? "red" : "black", coin.size * 3, coin.x, coin.y);
|
||||
if (coin.color == "crimson") {
|
||||
drawBall(ctx, red ? "red" : "black", coin.size * 3, coin.x, coin.y);
|
||||
}
|
||||
if (coin.color == "LightSkyBlue") {
|
||||
drawBall(
|
||||
ctx,
|
||||
red ? "LightSkyBlue" : "black",
|
||||
coin.size * 3,
|
||||
coin.x,
|
||||
coin.y,
|
||||
);
|
||||
}
|
||||
});
|
||||
ctx.globalAlpha = 1;
|
||||
forEachLiveOne(gameState.coins, (coin) => {
|
||||
if (coin.color !== "crimson") return;
|
||||
drawCoin(
|
||||
ctx,
|
||||
!red ? "red" : "black",
|
||||
coin.size,
|
||||
coin.x,
|
||||
coin.y,
|
||||
"red",
|
||||
coin.a,
|
||||
);
|
||||
if (coin.color == "crimson") {
|
||||
drawCoin(
|
||||
ctx,
|
||||
!red ? "red" : "black",
|
||||
coin.size,
|
||||
coin.x,
|
||||
coin.y,
|
||||
"red",
|
||||
coin.a,
|
||||
);
|
||||
}
|
||||
if (coin.color == "LightSkyBlue") {
|
||||
drawCoin(
|
||||
ctx,
|
||||
!red ? "LightSkyBlue" : "black",
|
||||
coin.size,
|
||||
coin.x,
|
||||
coin.y,
|
||||
"LightSkyBlue",
|
||||
coin.a,
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -324,7 +346,9 @@ export function render(gameState: GameState) {
|
|||
|
||||
drawPuck(
|
||||
ctx,
|
||||
gameState.puckColor,
|
||||
gameState.puckFrozenUntil > gameState.levelTime
|
||||
? "LightSkyBlue"
|
||||
: gameState.puckColor,
|
||||
gameState.puckWidth,
|
||||
gameState.puckHeight,
|
||||
0,
|
||||
|
|
|
@ -54,6 +54,11 @@ export const sounds = {
|
|||
createSingleBounceSound(1200, pan, volume, 0.5, "sawtooth");
|
||||
createSingleBounceSound(600, pan, volume, 0.3, "sawtooth");
|
||||
},
|
||||
freeze: (volume: number, pan: number) => {
|
||||
if (!isOptionOn("sound")) return;
|
||||
createSingleBounceSound(220, pan, volume, 0.5, "square");
|
||||
createSingleBounceSound(440, pan, volume, 0.5, "square");
|
||||
},
|
||||
explode: (volume: number, pan: number, combo: number) => {
|
||||
if (!isOptionOn("sound")) return;
|
||||
createExplosionSound(pan);
|
||||
|
|
5
src/types.d.ts
vendored
5
src/types.d.ts
vendored
|
@ -285,10 +285,14 @@ export type GameState = {
|
|||
coinCatch: { vol: number; x: number };
|
||||
colorChange: { vol: number; x: number };
|
||||
void: { vol: number; x: number };
|
||||
freeze: { vol: number; x: number };
|
||||
};
|
||||
rerolls: number;
|
||||
loop: number;
|
||||
baseCombo: number;
|
||||
puckFrozenUntil: number;
|
||||
desiredPuckPosition: number;
|
||||
levelsPerLoop:number;
|
||||
};
|
||||
|
||||
export type RunParams = {
|
||||
|
@ -296,6 +300,7 @@ export type RunParams = {
|
|||
levelToAvoid?: string;
|
||||
perks?: Partial<PerksMap>;
|
||||
debuffs?: Partial<DebuffsMap>;
|
||||
levelsPerLoop?:number;
|
||||
};
|
||||
export type OptionDef = {
|
||||
default: boolean;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue