Game state now contains a map of sounds to play next, for better perf

This commit is contained in:
Renan LE CARO 2025-03-17 19:47:16 +01:00
parent efa634cd8f
commit 581ee412d4
10 changed files with 1326 additions and 1153 deletions

View file

@ -1,5 +1,5 @@
import { Ball, GameState, PerkId, PerksMap } from "./types";
import { icons, upgrades } from "./loadGameData";
import {Ball, GameState, PerkId, PerksMap} from "./types";
import {icons, upgrades} from "./loadGameData";
export function getMajorityValue(arr: string[]): string {
const count: { [k: string]: number } = {};
@ -99,3 +99,18 @@ export function distanceBetween(
) {
return Math.sqrt(distance2(a, b));
}
export function defaultSounds() {
return {
aboutToPlaySound: {
wallBeep: {vol: 0, x: 0},
comboIncreaseMaybe: {vol: 0, x: 0},
comboDecrease: {vol: 0, x: 0},
coinBounce: {vol: 0, x: 0},
explode: {vol: 0, x: 0},
lifeLost: {vol: 0, x: 0},
coinCatch: {vol: 0, x: 0},
colorChange: {vol: 0, x: 0},
}
}
}