errorlab/src/components/DinoGame/gameConstants.js
2026-04-13 00:16:56 +03:00

40 lines
2.6 KiB
JavaScript

// ─── Canvas & World ───────────────────────────────────────────────────────────
export const CANVAS_W = 800
export const CANVAS_H = 220
export const GROUND_Y = 168 // y of the ground surface
// ─── Physics ──────────────────────────────────────────────────────────────────
export const GRAVITY = 0.58
export const JUMP_VEL = -13.5
export const INITIAL_SPEED = 5.2
export const SPEED_GROWTH = 0.00055 // added per score point (score = frames / 7)
export const MAX_SPEED = 16
// ─── Player ───────────────────────────────────────────────────────────────────
export const PLAYER_X = 82
export const PLAYER_W = 36
export const PLAYER_H = 36
// ─── Obstacle spawning ────────────────────────────────────────────────────────
export const MIN_GAP = 340 // minimum pixel gap between spawns (at game speed 1)
export const MAX_GAP = 680
// ─── Obstacle visual templates ────────────────────────────────────────────────
// Each obstacle has two display lines, a neon colour, and hit-box dimensions.
export const OBSTACLE_TEMPLATES = [
{ lines: ['Crash', 'Loop'], color: '#ff4455', w: 46, h: 52 },
{ lines: ['OOM', 'Killed'], color: '#ff2288', w: 38, h: 60 },
{ lines: ['Image', 'PullErr'], color: '#ff8820', w: 44, h: 46 },
{ lines: ['404'], color: '#00ffff', w: 58, h: 36 },
{ lines: ['Expired', 'Cert'], color: '#ffee22', w: 48, h: 48 },
{ lines: ['Evicted'], color: '#aaaaaa', w: 40, h: 34 },
{ lines: ['Pod', 'Failed'], color: '#ff3366', w: 40, h: 44 },
{ lines: ['Bad', 'Ingress'], color: '#ff6600', w: 50, h: 40 },
{ lines: ['DNS', 'Fail'], color: '#cc44ff', w: 42, h: 50 },
{ lines: ['Pending', '...'], color: '#4499ff', w: 52, h: 32 },
{ lines: ['Timeout'], color: '#ff9944', w: 48, h: 42 },
{ lines: ['502'], color: '#ff4444', w: 52, h: 36 },
{ lines: ['No', 'Route'], color: '#55ff88', w: 46, h: 44 },
{ lines: ['Tunnel', 'Down'], color: '#ff55cc', w: 50, h: 46 },
]