A modern implementation of the classic Nokia Snake game using HTML Canvas and JavaScript. Play it right in your browser!
- 🎯 Classic Snake gameplay with a modern twist
- 📱 Responsive design that works on all devices
- 🎨 Beautiful color gradient snake
- 🕹️ Both keyboard and touch controls
- ⚡ Smooth performance with optimized game loop
- 🏆 Score tracking and game over screen
- Use arrow keys (↑, ↓, ←, →) or WASD to move the snake
- Eat the red food squares to grow longer
- Avoid hitting yourself
- The snake wraps around when hitting walls
- Game speed increases(slither faster) as you eat more food
- Clone the repository:
git clone https://github.com/yourusername/html-canvas-snake.git
-
Open
index.html
in your browser or runnpx serve
if you have node.js installed locally. -
Start playing!
html-canvas-snake/
├── index.html # Main HTML file
├── style.css # Game styling
├── script.js # Game logic
├── tutorial.md # Guides on building the game
└── README.md # Project documentation
- Built with vanilla JavaScript
- Uses HTML5 Canvas for rendering
- Implements with functional programming style
- Game loop using
setInterval
- Responsive design using CSS Flexbox
This project demonstrates:
- HTML Canvas basics
- Game loop implementation
- Collision detection
- Controls with JS events
- Responsive design
- Modern JavaScript features
This project is open source and available under the MIT License.
-
Inspired by the classic Nokia Snake game
-
Food eaten sound effect by Ribhav Agrawal
-
Game over sound effect by FoxBoyTails
-
Easter Egg video by CuriosityShorts
Enjoy the game? Star the repository and share it with your friends! ⭐