mirror of
https://gitlab.com/lecarore/breakout71.git
synced 2025-06-17 03:34:51 -04:00
Graphics change, more light thanks to optimized computations
This commit is contained in:
parent
83c79b6564
commit
ba7e368938
16 changed files with 215 additions and 90 deletions
|
@ -2,14 +2,8 @@ import { RawLevel } from "./types";
|
|||
|
||||
import _backgrounds from "./data/backgrounds.json";
|
||||
const backgrounds = _backgrounds as string[];
|
||||
|
||||
export function getLevelBackground(level: RawLevel) {
|
||||
let svg = level.svg !== null && backgrounds[level.svg % backgrounds.length];
|
||||
|
||||
if (!level.color && !svg) {
|
||||
svg = backgrounds[hashCode(level.name) % backgrounds.length];
|
||||
}
|
||||
return svg;
|
||||
return backgrounds[hashCode(level.name) % backgrounds.length];
|
||||
}
|
||||
|
||||
export function hashCode(string: string) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue