feat(03-01): add palette system to GameConfig and extend GameState

- Add PALETTES object with MAGENTA, CYAN, LIME, WHITE presets
- Add PALETTE_KEYS array for palette cycling
- Change gameState initial value from 'modeSelect' to 'title'
- Add activePalette, soundEnabled, selectedMenu, previousState to GameState
- Initialize GameState.activePalette to MAGENTA preset after GameConfig is defined
This commit is contained in:
Dabit
2026-03-10 21:53:08 +01:00
parent 3710304467
commit 22a5046486

View File

@@ -22,7 +22,15 @@
AI_EASY: { speed: 200, reactionDelay: 0.3, errorMargin: 20 }, AI_EASY: { speed: 200, reactionDelay: 0.3, errorMargin: 20 },
AI_MEDIUM: { speed: 320, reactionDelay: 0.1, errorMargin: 5 }, AI_MEDIUM: { speed: 320, reactionDelay: 0.1, errorMargin: 5 },
AI_HARD: { speed: 400, reactionDelay: 0.05, errorMargin: 2 } AI_HARD: { speed: 400, reactionDelay: 0.05, errorMargin: 2 },
PALETTES: {
MAGENTA: { accent: '#ff00cc', glow: 'rgba(255,0,204,0.6)', name: 'Magenta' },
CYAN: { accent: '#00ffff', glow: 'rgba(0,255,255,0.6)', name: 'Cyan' },
LIME: { accent: '#00ff00', glow: 'rgba(0,255,0,0.6)', name: 'Lime' },
WHITE: { accent: '#ffffff', glow: 'rgba(255,255,255,0.6)', name: 'White' }
},
PALETTE_KEYS: ['MAGENTA', 'CYAN', 'LIME', 'WHITE']
}; };
const Renderer = { const Renderer = {
@@ -116,10 +124,16 @@
score2: 0, score2: 0,
mode: null, // null = mode select screen; 'ai' = Solo vs AI; '2p' = 2-Player local mode: null, // null = mode select screen; 'ai' = Solo vs AI; '2p' = 2-Player local
difficulty: 'medium', // 'easy', 'medium', 'hard' difficulty: 'medium', // 'easy', 'medium', 'hard'
gameState: 'modeSelect',// 'modeSelect', 'diffSelect', 'playing', 'scored', 'gameover' gameState: 'title', // 'title', 'settings', 'modeSelect', 'diffSelect', 'playing', 'scored', 'gameover'
winner: null // null, 'player1', 'player2', 'ai' winner: null, // null, 'player1', 'player2', 'ai'
activePalette: null, // Set after GameConfig defined — see init sequence
soundEnabled: true,
selectedMenu: 0,
previousState: null
}; };
GameState.activePalette = GameConfig.PALETTES.MAGENTA;
const Input = { const Input = {
keys: { w: false, s: false, arrowUp: false, arrowDown: false }, keys: { w: false, s: false, arrowUp: false, arrowDown: false },
_handleKeyDown: null, _handleKeyDown: null,