A classic Snake game built with vanilla JavaScript, HTML5 Canvas, and CSS3. Features a modern neon aesthetic, responsive design, and mobile touch controls.
- Score Tracking - Current score and high score saved to localStorage
- Progressive Difficulty - Speed increases as you eat more food
- Pause/Resume - Pause anytime with spacebar or the pause button
- Mobile Support - Swipe gestures and on-screen touch controls
- Responsive Design - Adapts to any screen size
- Modern Visuals - Neon glow effects, smooth animations, and a polished UI
- Accessibility - Respects prefers-reduced-motion setting
| Platform | Action |
|---|---|
| Desktop | Use W A S D or Arrow keys to move |
| Desktop | Press Space to pause/resume |
| Mobile | Swipe in any direction to move |
| Mobile | Use on-screen buttons to move |
| Mobile | Tap the PAUSE button to pause |
- Guide the snake to eat the red food pellets
- Each food eaten increases your score by 10 points
- The snake grows longer with each food eaten
- Avoid hitting the walls or the snake's own body
- The game speeds up as your score increases
snake-game/
├── index.html # Main HTML file
├── css/
│ └── styles.css # All styling and animations
├── js/
│ └── game.js # Game logic and controls
├── README.md # This file
└── .gitignore # Git ignore rules
-
Clone the repository:
git clone https://github.com/oranshabatcohen/snake-game.git
-
Open
index.htmlin your browser, or use a local server:# Using Python python -m http.server 8000 # Using Node.js npx serve
-
Visit
http://localhost:8000
-
Push this repository to GitHub
-
Go to your repository's Settings > Pages
-
Under "Source", select Deploy from a branch
-
Select the
mainbranch and/ (root)folder -
Click Save
-
Your game will be live at
https://oranshabatcohen.github.io/snake-game/
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
- Mobile browsers (iOS Safari, Chrome for Android)
- HTML5 Canvas - Game rendering
- CSS3 - Styling, animations, and responsive design
- Vanilla JavaScript - Game logic with no dependencies
- localStorage - High score persistence
- Google Fonts - Inter font family
MIT License - feel free to use this project for learning or as a base for your own games.