I'll build a polished, juicy Snake game with all the features you requested. Let me start by examining the project structure, then create the game.
Now I have a clear picture of the project. Let me build the Snake game with all the juicy features. I'll create several files for a clean architecture.
Let me start by creating the types and particle system:
Now the main game engine hook — the heart of the game:
Let me fix the unused variable and then create the main App component:
Now let me create the polished App component with all the UI overlays:
Now let me update the HTML title and CSS:
Let me build the project to check for any issues:
The build passes. Let me improve the game with some refinements — fixing a potential animation frame leak and adding a death animation delay so players can see the explosion before the game over screen appears:
Now let me make key improvements — fix the animation frame handling, add a death animation delay, and add cleanup:
Now add unmount cleanup. Let me find the end of the hook:
Now update the GameOverScreen delay so players see the death animation before the overlay appears:
Now let me also make the food visible during the start screen by adjusting the render condition, and add a subtle idle animation. Let me also enhance the canvas border and add a vignette effect:
Let me also make the game loop run during START state for the idle food animation:
Now let me build and verify everything works:
Let me fix a potential sizing inconsistency between the container and canvas:
Let me do a final build to confirm everything is working:
The game builds successfully. Here's a summary of what was built:
🐍 Snake Game — Feature Summary
Core Gameplay
- 20×20 grid with progressive difficulty — speed increases by 2.5ms per food eaten (130ms → 55ms minimum)
- 10 points per food eaten, with increasing challenge
Juicy Feedback
- Screen shake — 5px intensity on eating food, 12px intensity on death
- Particle explosions — 16 colorful burst particles + 6 white sparkles on eat, 4 per snake segment on death
- Score popups — floating "+10" text that drifts upward and fades
- Snake eyes — cute eyes on the head that follow the movement direction
- Food pulse — the apple gently pulses with a glow and sparkle effect
- Death animation — 600ms delay before game over screen so you see the explosion
Controls
- Keyboard — Arrow keys or WASD to move, Space/Escape to pause, Enter to start/restart
- Touch swipe — swipe on the canvas to change direction
- D-Pad — on-screen directional buttons for mobile tapping
Game States
- Start Screen — animated snake emoji, gradient title, controls reference, PLAY button
- Playing — score HUD at top, full game canvas, D-pad below
- Paused — frosted glass overlay with RESUME button
- Game Over — score display, medal-ranked high scores table, instant restart
Technical
- Canvas rendering with
requestAnimationFrame for smooth 60fps
- Fixed timestep game logic for consistent snake speed
- High DPI support — scales for Retina displays
- localStorage persistence for top 5 high scores
- Responsive — auto-sizes from mobile to desktop
Files built: src/game/types.ts, src/game/particles.ts, src/game/useSnakeGame.ts, src/App.tsx, index.html, src/index.css