Skip to content
Make the player visible with a procedural 3D humanoid132be7c
JavaScript42 lines1.6 KB
// Level definitions for Shadow Fight. Pure data, shared by client, bot and worker. function level(def) {  return Object.freeze({ ...def, arena: Object.freeze(def.arena), theme: Object.freeze(def.theme) });} export const LEVELS = Object.freeze([  level({    id: 'dojo', name: 'Moonlit Dojo', index: 0,    arena: { width: 960, height: 540, floorY: 460, padding: 40 },    theme: { sky: '#1a1f3a', ground: '#2b2341', accent: '#f6c667', fog: 0.15 },    botDifficulty: 0.25, gravity: 1.0, roundsToWin: 2, roundTime: 60  }),  level({    id: 'bamboo', name: 'Bamboo Grove', index: 1,    arena: { width: 1040, height: 540, floorY: 460, padding: 40 },    theme: { sky: '#0f2a1f', ground: '#15361f', accent: '#9be36d', fog: 0.3 },    botDifficulty: 0.5, gravity: 1.0, roundsToWin: 2, roundTime: 60  }),  level({    id: 'rooftop', name: 'Storm Rooftop', index: 2,    arena: { width: 880, height: 540, floorY: 460, padding: 30 },    theme: { sky: '#2a1a2e', ground: '#3b2a44', accent: '#ff6b9d', fog: 0.45 },    botDifficulty: 0.75, gravity: 1.15, roundsToWin: 2, roundTime: 45  }),  level({    id: 'void', name: 'Shadow Void', index: 3,    arena: { width: 1100, height: 540, floorY: 460, padding: 50 },    theme: { sky: '#05050a', ground: '#101018', accent: '#7f5cff', fog: 0.6 },    botDifficulty: 1.0, gravity: 0.8, roundsToWin: 3, roundTime: 45  })]); export function getLevel(idOrIndex) {  if (typeof idOrIndex === 'number') return LEVELS[idOrIndex] ?? null;  return LEVELS.find((l) => l.id === idOrIndex) ?? null;} export function listLevels() {  return LEVELS.map(({ id, name, index, botDifficulty }) => ({ id, name, index, botDifficulty }));}