How beelzebubcode/snake-game works
LexiSnake is a browser word game: the player starts or resumes a run, steers a snake to collect letters and chests, then enters a portal to form an English word and see its Thai meaning. The React app coordinates the game engine, Phaser board, tutorial, settings, and journal; the engine applies game rules and consults vocabulary data. Browser storage retains settings and learning progress. Major documented features include bilingual UI, multiple maps and skins, audio, touch and keyboard controls, and a seven-step tutorial. Some wiring is supported only by the source index or README, so uncertain links are omitted.
Main entry points: App.tsx App coordinator · messages.ts Translation lookup · engine.ts Game rules engine · JournalBook.tsx Word journal
Components 23
Game experience
- App coordinator
Web/src/App.tsx - Settings panel
Web/src/components/SettingsPanel.tsx - Word journal
Web/src/components/JournalBook.tsx - Tutorial lessons
Web/src/components/TutorialLesson.tsx - Tutorial review
Web/src/components/TutorialReview.tsx - Modal UI
Web/src/components/Modal.tsx - Game artwork
Web/src/components/Art.tsx
Game runtime
- Game rules engine
Web/src/game/engine.ts - Phaser board
Web/src/game/PhaserBoard.tsx - Maps and skins
Web/src/game/appearance.ts - Control mapping
Web/src/game/input.ts - Game state types
Web/src/game/types.ts - Tutorial flow
Web/src/game/tutorial.ts
Word learning
- Vocabulary lookup
Web/src/data/vocabulary.ts - Vocabulary data
Web/public/data/vocabulary.json
Localization
- Language provider
Web/src/i18n/index.tsx - Translation lookup
Web/src/i18n/messages.ts - English catalog
Web/src/i18n/en.ts - Thai catalog
Web/src/i18n/th.ts
Browser services
- Save storage
Web/src/services/storage.ts - Audio service
Web/src/services/audio.ts
Other components
- Player
- Browser
Connections 29
- Player → App coordinator: starts play
README.md - App coordinator → Game rules engine: coordinates
Web/src/App.tsx - App coordinator → Phaser board: renders
Web/src/App.tsx - App coordinator → Settings panel: opens
Web/src/App.tsx - App coordinator → Word journal: opens
Web/src/App.tsx - App coordinator → Tutorial lessons: shows
Web/src/App.tsx - App coordinator → Tutorial review: shows
Web/src/App.tsx - App coordinator → Modal UI: renders
Web/src/App.tsx - App coordinator → Game artwork: renders
Web/src/App.tsx - App coordinator → Control mapping: handles controls
Web/src/App.tsx - App coordinator → Language provider: provides language
Web/src/App.tsx - App coordinator → Save storage: loads and saves
Web/src/App.tsx - App coordinator → Audio service: controls audio
Web/src/App.tsx - App coordinator → Vocabulary lookup: loads dictionary
Web/src/App.tsx - Game rules engine → Vocabulary lookup: checks words
Web/src/game/engine.ts - Game rules engine → Translation lookup: translates prompts
Web/src/game/engine.ts - Phaser board → Game rules engine: reads game state
Web/src/game/PhaserBoard.tsx - Phaser board → Maps and skins: draws appearance
Web/src/game/PhaserBoard.tsx - Settings panel → Maps and skins: uses map options
Web/src/components/SettingsPanel.tsx - Tutorial lessons → Tutorial flow: renders lessons
Web/src/components/TutorialLesson.tsx - Tutorial lessons → Modal UI: uses modal
Web/src/components/TutorialLesson.tsx - Word journal → Save storage: reads saved words
Web/src/components/JournalBook.tsx - Word journal → Audio service: plays sounds
Web/src/components/JournalBook.tsx - Vocabulary lookup → Vocabulary data: fetches data
Web/src/data/vocabulary.ts - Save storage → Browser: uses local storage
Web/src/services/storage.ts - Language provider → Translation lookup: creates translator
Web/src/i18n/index.tsx - Translation lookup → English catalog: reads catalog
Web/src/i18n/messages.ts - Translation lookup → Thai catalog: reads catalog
Web/src/i18n/messages.ts - Game state types → Translation lookup: types message keys
Web/src/game/types.ts