Skip to content

Commit fa7ac80

Browse files
committed
feat(snake): add Snake mini-game tab with pause, bonus food, and skin palettes
- New Snake game as 4th tab with canvas rendering and game loop - Snake engine: pure functions for grid movement, collision, scoring - Bonus food: gold diamonds spawn randomly for +25pts +2 growth - Pause overlay: shows PAUSED + score when leaving tab mid-game - Skin palettes: 6 retro color schemes (Auto/Green/Olive/Amber/Grey/Rose) cycle with P key, persisted in localStorage, Auto reads CSS theme var - High score persistence across sessions, speed ramp as score increases - Directional eyes on snake head, food chime, game-over sound - Footer hides on Snake tab to maximize game area - D-pad controls snake; Left/Right do NOT switch tabs while playing - Power switch disabled on Snake tab to avoid P key conflict - 24 unit tests (engine) + 4 e2e tests (Chromium/Firefox/WebKit) - 48/48 e2e passing, 51/51 unit tests passing
1 parent 915dd89 commit fa7ac80

10 files changed

Lines changed: 1149 additions & 12 deletions

File tree

src/components/GameBoy.astro

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import TurnButton from './gameboy/TurnButton.astro';
88
import LinksTab from './gameboy/tabs/LinksTab.astro';
99
import AboutTab from './gameboy/tabs/AboutTab.astro';
1010
import HelpTab from './gameboy/tabs/HelpTab.astro';
11+
import SnakeTab from './gameboy/tabs/SnakeTab.astro';
1112
import '../styles/hit-areas.css';
1213
import '../styles/console-layout.css';
1314
import '../styles/view-transitions.css';
@@ -62,6 +63,9 @@ const aboutText = aboutEntry && aboutEntry.body ? aboutEntry.body.trim() : '';
6263
<div class="tab-content" id="tab-2" role="tabpanel" aria-labelledby="tab-ind-2" hidden>
6364
<HelpTab />
6465
</div>
66+
<div class="tab-content" id="tab-3" role="tabpanel" aria-labelledby="tab-ind-3" hidden>
67+
<SnakeTab />
68+
</div>
6569
</div>
6670

6771
<footer class="footer">

src/components/gameboy/TabsHeader.astro

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
<button type="button" class="tab-indicator active" id="tab-ind-0" role="tab" aria-selected="true" aria-controls="tab-0">LINKS</button>
33
<button type="button" class="tab-indicator" id="tab-ind-1" role="tab" aria-selected="false" aria-controls="tab-1">ABOUT</button>
44
<button type="button" class="tab-indicator" id="tab-ind-2" role="tab" aria-selected="false" aria-controls="tab-2">HELP</button>
5+
<button type="button" class="tab-indicator" id="tab-ind-3" role="tab" aria-selected="false" aria-controls="tab-3">SNAKE</button>
56
</div>

0 commit comments

Comments
 (0)