${sentence.original_language}
${sentence.user_language}
${sentence.pronunciation ? `π£οΈ ${sentence.pronunciation}
` : ''}// === MODULE ADVENTURE READER (ZELDA-STYLE) === class AdventureReaderGame { constructor(options) { this.container = options.container; this.content = options.content; this.onScoreUpdate = options.onScoreUpdate || (() => {}); this.onGameEnd = options.onGameEnd || (() => {}); // Game state this.score = 0; this.currentSentenceIndex = 0; this.currentVocabIndex = 0; this.potsDestroyed = 0; this.enemiesDefeated = 0; this.isGamePaused = false; // Game objects this.pots = []; this.enemies = []; this.player = { x: 0, y: 0 }; // Will be set when map is created this.isPlayerMoving = false; this.isPlayerInvulnerable = false; this.invulnerabilityTimeout = null; // TTS settings this.autoPlayTTS = true; this.ttsEnabled = true; // Expose content globally for SettingsManager TTS language detection window.currentGameContent = this.content; // Content extraction this.vocabulary = this.extractVocabulary(this.content); this.sentences = this.extractSentences(this.content); this.stories = this.extractStories(this.content); this.dialogues = this.extractDialogues(this.content); this.init(); } init() { const hasVocabulary = this.vocabulary && this.vocabulary.length > 0; const hasSentences = this.sentences && this.sentences.length > 0; const hasStories = this.stories && this.stories.length > 0; const hasDialogues = this.dialogues && this.dialogues.length > 0; if (!hasVocabulary && !hasSentences && !hasStories && !hasDialogues) { logSh('No compatible content found for Adventure Reader', 'ERROR'); this.showInitError(); return; } logSh(`Adventure Reader initialized with: ${this.vocabulary.length} vocab, ${this.sentences.length} sentences, ${this.stories.length} stories, ${this.dialogues.length} dialogues`, 'INFO'); this.createGameInterface(); this.initializePlayer(); this.setupEventListeners(); this.updateContentInfo(); this.generateGameObjects(); this.generateDecorations(); this.startGameLoop(); } showInitError() { this.container.innerHTML = `
This content module needs adventure-compatible content:
Add adventure content to enable this game mode.
${sentence.original_language}
${sentence.user_language}
${sentence.pronunciation ? `π£οΈ ${sentence.pronunciation}
` : ''}