A classic Snake game built with vanilla JavaScript, HTML5 Canvas, and CSS. Features a retro arcade aesthetic with customizable difficulty levels.
- Classic Snake Gameplay - Navigate the snake to eat food and grow longer
- Three Difficulty Levels - Easy, Medium, and Hard speeds
- Retro Design - Green monochrome display reminiscent of classic arcade games
- Responsive Controls - Smooth arrow key navigation with scroll prevention
- Score Tracking - Track your points as you collect food
- Start/Restart Button - Control when to begin or restart the game
- Open
index.htmlin your web browser - Select your difficulty level (Easy, Medium, or Hard)
- Click "Start Game" to begin
- Use arrow keys to control the snake:
- ↑ Arrow Up - Move up
- ↓ Arrow Down - Move down
- ← Arrow Left - Move left
- → Arrow Right - Move right
- Collect red food blocks to grow and increase your score
- Avoid hitting walls or your own tail
- Click "Restart" to play again after game over
- Each food item collected adds 10 points to your score
- The snake grows longer with each food item eaten
- The game ends if you hit a wall or collide with yourself
- You cannot immediately reverse direction (e.g., can't go directly from moving right to left)
- Built with pure vanilla JavaScript - no frameworks or libraries required
- HTML5 Canvas for rendering
- CSS3 for styling and animations
- Fully self-contained in a single HTML file
No installation required! Simply:
- Clone this repository or download the
index.htmlfile - Open
index.htmlin any modern web browser - Start playing!
git clone [your-repo-url]
cd snake
open index.html # On Mac
# OR
start index.html # On Windows
# OR
xdg-open index.html # On LinuxWorks on all modern browsers including:
- Chrome
- Firefox
- Safari
- Edge
This project is open source and available under the MIT License.
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
Potential features for future versions:
- High score tracking with local storage
- Mobile touch controls
- Power-ups and special food items
- Multiple game modes
- Multiplayer support
- Sound effects and background music
The Charmizard
Inspired by the classic Snake game that appeared on Nokia phones in the late 1990s.