Classic Snake game built with JavaScript, HTML5 Canvas, and CSS.
A lightweight, browser-based implementation of the classic Snake game. Built with plain JavaScript and the HTML5 Canvas API for rendering, with minimal CSS for styling. The game features keyboard controls, score tracking, adjustable speed, and a simple restart/high-score experience — ideal as a beginner-friendly project and tutorial for learning DOM, canvas drawing, and game loops.
Open index.html in a modern web browser (Chrome, Firefox, Edge, Safari) to play.
- Classic Snake gameplay
- Keyboard controls (arrow keys / WASD)
- Score tracking
- Adjustable game speed (if available in UI or by editing code)
- Works in desktop browsers
- Arrow keys: Move the snake
- W / A / S / D: Alternative movement keys
- Space / Enter: Pause / Restart (if implemented)
-
Clone the repository:
git clone https://github.com/aditittiwari1234/snakegames.git
-
Open the project folder and open
index.htmlin your browser, or serve it with a simple HTTP server:npx http-server .
-
Play!
- The game uses plain JavaScript (no build step). Edit the JS files to add features or tweak gameplay.
- Update styles in the CSS files to change the UI.
- Add mobile/touch controls
- Add obstacles or multiple levels
- Persist high scores to localStorage
- Add sounds and improved animations
Contributions are welcome. Open an issue to discuss new features or bug fixes, then send a pull request with clear changes and a short description.
Open an issue on this repository if you need help or want to suggest changes.