# ๐ŸŽฎ PokรฉSQL โ€” Learn T-SQL A Pokรฉmon-style Game Boy Advance browser game for learning **Microsoft T-SQL**! Play it on your phone, tablet, or PC โ€” progress is saved automatically to your browser. ## ๐Ÿš€ Play It Live ๐Ÿ‘‰ [Launch PokรฉSQL](https://justinoros.github.io/pokesql) --- ## ๐Ÿ—‚๏ธ Files ``` pokesql/ โ”œโ”€โ”€ index.html โ† Game screens & structure โ”œโ”€โ”€ style.css โ† GBA Pokรฉmon aesthetic, fully responsive โ”œโ”€โ”€ game.js โ† Game engine, controller, walking, save system โ”œโ”€โ”€ config.js โ† Game-specific config (name, text, badges, milestones) โ”œโ”€โ”€ questions.json โ† 100 T-SQL questions & answers โ”œโ”€โ”€ player.png โ† Player sprite sheet (24 frames, 16ร—32px) โ”œโ”€โ”€ oak.png โ† Professor Oak NPC sprite โ”œโ”€โ”€ gary.png โ† Rival Gary NPC sprite โ”œโ”€โ”€ joy.png โ† Nurse Joy NPC sprite โ”œโ”€โ”€ jenny.png โ† Officer Jenny NPC sprite โ”œโ”€โ”€ music.mp3 โ† Background music (overworld) โ”œโ”€โ”€ music-rival.mp3 โ† Background music (rival/battle) โ”œโ”€โ”€ favicon.ico โ† Browser tab icon โ””โ”€โ”€ README.md ``` --- ## ๐Ÿ•น๏ธ Host on GitHub Pages (free) 1. Create a GitHub repo named **`pokesql`** 2. Upload all files listed above 3. Go to **Settings โ†’ Pages โ†’ Source: `main` branch, `/ (root)` folder** 4. Hit **Save** โ€” live in ~60 seconds at `https://justinoros.github.io/pokesql` No server, no database, no cost. --- ## ๐ŸŽฎ GBA Controller Overlay On mobile, a semi-transparent Game Boy Advance-style controller overlays the bottom of the screen: | Control | Action | |---|---| | **D-pad** | Walk the player around the map | | **A button** (red) | Talk to NPC ยท Confirm answer ยท Advance dialog | | **B button** (blue) | Talk to NPC ยท Advance dialog | | **SELECT / START** | Decorative | The controller is hidden on desktop (โ‰ฅ900px wide) โ€” use the keyboard instead. --- ## ๐Ÿ•น๏ธ Xbox / Gamepad Support Plug in any Xbox, PlayStation, or USB gamepad and it works automatically: | Input | Action | |---|---| | **Left stick / D-pad** | Walk on map | | **A button** | Talk to NPC ยท Confirm answer ยท Advance dialog | | **B button** | Talk to NPC ยท Advance dialog | | **Start** | Confirm / advance on all screens | | **X / Y / LB / RB** | Quick-pick answers 1/2/3/4 in battle | --- ## โŒจ๏ธ PC Keyboard Controls | Key | Action | |---|---| | **WASD / Arrow keys** | Walk player on map | | **E / Enter** | Talk to NPC ยท Confirm answer ยท Advance dialog | | **X** | Talk to NPC ยท Advance dialog | | **1 / 2 / 3 / 4** | Quick-pick answer directly | | **Space** | Advance dialog | --- ## ๐Ÿ—บ๏ธ Map & Walking - The player sprite walks freely around the overworld map using the D-pad, WASD, arrow keys, or Xbox controller - Walking animations use the `player.png` sprite sheet with directional frames - A blinking `โ–ถ` arrow on the right edge points toward the next NPC - A `...` speech bubble appears above the player if you press talk before reaching the NPC - Press **A**, **B**, **E**, or **Enter** when near the NPC to start the question - Tapping the NPC sprite directly also triggers the conversation --- ## ๐Ÿ’พ Save System Progress is stored in the player's browser (`localStorage`) automatically: - **Auto-saves** after every answered question and on map return - **Shuffled question order** is saved so continuing a game resumes the exact same sequence - **Continue screen** appears on next visit showing trainer name, progress %, and score - **New Game** option always available โ€” prompts confirmation before erasing save - Save clears automatically on completion so the next run starts fresh --- ## ๐ŸŽต Music - Background music plays automatically on the map (`music.mp3`) - Music pauses during questions and resumes on return to the map - **๐ŸŽต / ๐Ÿ”‡ toggle** in the map header to mute/unmute - Music resumes correctly after switching browser tabs on mobile --- ## ๐ŸŽฏ Features | Feature | Detail | |---|---| | GBA controller overlay | D-pad + A/B buttons, semi-transparent, mobile only | | Xbox / gamepad support | Full navigation on all screens including name entry | | Walking player | Pixel sprite sheet, directional walk animations | | Mobile-first design | Full-screen on phones with safe-area support, framed on desktop | | localStorage save | Auto-save with shuffled order preserved on continue | | 100 T-SQL questions | Randomised order every new game, shuffled answer slots | | Numbered answers | Options labelled 1/2/3/4 โ€” no A/B/C/D pattern to exploit | | PNG NPC sprites | NPCs can use image files or emoji | | Name entry | On-screen pixel keyboard navigable by gamepad | | Typewriter text | Authentic dialog effect, tap/press/gamepad to skip | | `...` proximity bubble | Shows above player when pressing talk too far from NPC | | Background music | Loops on map, pauses during questions, mute toggle | | Streak bonuses | 3ร— correct = +150 pts ๐Ÿ”ฅ, 5ร—+ = +200 pts ๐Ÿ”ฅ | | Milestone badges | Earned at Q25, Q50, Q75, Q100 | | Correct answer reveal | Wrong answers show the right answer + full explanation | | Scanline overlay | Authentic CRT/GBA screen effect | --- ## ๐Ÿ“š Topics Covered | Questions | Topics | |---|---| | 1โ€“15 | SELECT, FROM, WHERE, ORDER BY, TOP, BETWEEN, LIKE, IN, NULL | | 16โ€“25 | COUNT, SUM, AVG, MIN, MAX, GROUP BY, HAVING, DISTINCT | | 26โ€“35 | Aliases, JOINs (INNER, LEFT, RIGHT, FULL OUTER), Keys | | 36โ€“50 | Data types, GETDATE(), INSERT, UPDATE, DELETE, TRUNCATE, Views, Stored Procedures | | 51โ€“65 | Transactions, Variables, @@ROWCOUNT, ISNULL, COALESCE, CAST, String functions, Date functions | | 66โ€“80 | CTEs, Subqueries, ROUND, CASE WHEN, Indexes, UNION, INTERSECT, EXCEPT, Triggers, Schemas | | 81โ€“100 | Temp tables, Table variables, TRYโ€ฆCATCH, @@ERROR, SSMS, Execution plans, NOLOCK, Deadlocks, Window functions, PIVOT, IDENTITY, Normalization | --- ## โž• Adding Questions Edit `questions.json`, add to the `questions` array inside `levels[0]`: ```json { "id": 101, "npc": "Professor Oak", "text": "Your question here?", "options": ["Option A", "Option B", "Option C", "Option D"], "answer": 0, "explanation": "Why Option A is correct." } ``` `answer` is the **0-based index** of the correct option (0 = first, 1 = second, etc.). The game shuffles display order randomly at runtime. --- ## ๐Ÿง‘ Adding NPCs In `game.js`, add to the `NPC` object: ```js const NPC = { 'Your NPC Name': 'npc.png', // PNG sprite file in repo root 'Another NPC': '๐Ÿง‘', // or an emoji }; ``` Then reference `"npc": "Your NPC Name"` in `questions.json`. PNG files are auto-prefixed with `./` so just use the filename. --- ## โš™๏ธ Customising the Game All game-specific text lives in **`config.js`** โ€” the only file that differs between PokรฉSQL and its sister game PokรฉAzure. Edit it to change the game name, town name, intro dialog, badge names, battle move names, and more without touching `game.js` or `index.html`. --- ## ๐Ÿ“ฑ Mobile Tips - Add to Home Screen on iOS/Android for a full-screen app-like experience - The game uses `100dvh` and `env(safe-area-inset-bottom)` for notched phones (iPhone X+) - Tap anywhere on the dialog box during the intro to skip the typewriter and advance - Tap the NPC sprite directly on the map as an alternative to pressing A/B