A classic Snake game built with JavaScript, HTML Canvas, and CSS.
- Click Start to begin.
- Use the arrow keys to steer toward the red food.
- Each food adds one point and grows the snake.
- Avoid the walls and your own tail. Click Start to play again.
Your high score is saved in your browser's local storage. Sound effects play when you eat food and when the game ends, subject to browser audio settings.
- A 20 × 20 board rendered on a canvas.
- Keyboard controls and wall/self-collision detection.
- Current score and a persistent local high score.
- Food and game-over audio.
- Restart from the Start button.
No packages or build step are required. With Git and Python 3 installed:
git clone https://github.com/Stackforge-07/SnakeGame.git
cd SnakeGame
python3 -m http.server 8000Open localhost:8000. Stop the server with Ctrl+C.
| File | Purpose |
|---|---|
index.html |
Canvas and Start button |
style.css |
Page styling |
snake.js |
Drawing, movement, scoring, and collisions |
eat.mp3, gameover.mp3 |
Sound effects |
Designed for a keyboard. Touch controls and a shared online leaderboard are not implemented; scores stay in the browser where you play.