5 colors /level, sound when ball or brick change color

This commit is contained in:
Renan LE CARO 2025-03-14 15:49:04 +01:00
parent b6fe46c9bc
commit 2e3ab3011f
21 changed files with 1379 additions and 598 deletions

View file

@ -1,4 +1,5 @@
import {PerksMap, Upgrade} from "./types";
export function getMajorityValue(arr: string[]): string {
const count: { [k: string]: number } = {};
@ -16,4 +17,10 @@ export function sample<T>(arr: T[]): T {
export function sumOfKeys(obj:{[key:string]:number} | undefined | null){
if(!obj) return 0
return Object.values(obj)?.reduce((a,b)=>a+b,0) ||0
}
}
export const makeEmptyPerksMap = (upgrades:Upgrade[]) => {
const p = {} as any;
upgrades.forEach((u) => (p[u.id] = 0));
return p as PerksMap;
};