feat: add SynthQuest game mode with World 1 (Waves) — 8 puzzle levels

Gamified synth learning inspired by Turing Complete. Progressive puzzle
system teaches oscillators, waveforms, frequency, and mixing through
hands-on module patching. Includes world map, level progression with
3-star rating, target audio playback, solution validation, and
localStorage persistence. Sandbox mode still accessible via button.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jose Luis
2026-03-21 02:04:26 +01:00
parent d0755413f3
commit 08206e996e
10 changed files with 1500 additions and 3 deletions

54
src/game/GameApp.jsx Normal file
View File

@@ -0,0 +1,54 @@
import React, { useState, useCallback } from 'react';
import WorldMap from './WorldMap.jsx';
import PuzzleView from './PuzzleView.jsx';
import { WORLD_1 } from './levels/world1.js';
export default function GameApp({ onSwitchToSandbox }) {
const [view, setView] = useState('map'); // 'map' | 'puzzle'
const [currentLevel, setCurrentLevel] = useState(null);
const [currentLevelIndex, setCurrentLevelIndex] = useState(0);
const worldLevels = WORLD_1.levels;
const handleSelectLevel = useCallback((level) => {
const idx = worldLevels.findIndex(l => l.id === level.id);
setCurrentLevel(level);
setCurrentLevelIndex(idx);
setView('puzzle');
}, [worldLevels]);
const handleBack = useCallback(() => {
setView('map');
setCurrentLevel(null);
}, []);
const handleNextLevel = useCallback(() => {
const nextIdx = currentLevelIndex + 1;
if (nextIdx < worldLevels.length) {
setCurrentLevel(worldLevels[nextIdx]);
setCurrentLevelIndex(nextIdx);
} else {
setView('map');
}
}, [currentLevelIndex, worldLevels]);
if (view === 'puzzle' && currentLevel) {
return (
<PuzzleView
key={currentLevel.id}
level={currentLevel}
levelIndex={currentLevelIndex}
worldLevels={worldLevels}
onBack={handleBack}
onNextLevel={handleNextLevel}
/>
);
}
return (
<WorldMap
onSelectLevel={handleSelectLevel}
onSandbox={onSwitchToSandbox}
/>
);
}