An open API service indexing awesome lists of open source software.

https://github.com/jjteoh-thewebdev/html-canvas-snake

Nokia classic Snake game built with HTML Canvas
https://github.com/jjteoh-thewebdev/html-canvas-snake

functional-programming html-canvas javascript

Last synced: 10 months ago
JSON representation

Nokia classic Snake game built with HTML Canvas

Awesome Lists containing this project

README

          

# Classic Snake Game 🐍

A modern implementation of the classic Nokia Snake game using HTML Canvas and JavaScript. Play it right in your browser!

![Snake Game Screenshot](preview.gif)

[Live Preview](https://jjteoh-thewebdev.github.io/html-canvas-snake/)

## Features 🎮

- đŸŽ¯ 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

## How to Play đŸ•šī¸

1. Use arrow keys (↑, ↓, ←, →) or WASD to move the snake
2. Eat the red food squares to grow longer
3. Avoid hitting yourself
4. The snake wraps around when hitting walls
5. Game speed increases(slither faster) as you eat more food

## Getting Started 🚀

1. Clone the repository:
```bash
git clone https://github.com/yourusername/html-canvas-snake.git
```

2. Open `index.html` in your browser or run `npx serve` if you have node.js installed locally.

3. Start playing!

## Project Structure 📁

```
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
```

## Technical Details đŸ’ģ

- Built with vanilla JavaScript
- Uses HTML5 Canvas for rendering
- Implements with functional programming style
- Game loop using `setInterval`
- Responsive design using CSS Flexbox

## Key concepts? 🤔

This project demonstrates:
- HTML Canvas basics
- Game loop implementation
- Collision detection
- Controls with JS events
- Responsive design
- Modern JavaScript features

## License 📄

This project is open source and available under the [MIT License](LICENSE).

## Credits 🙏

- Inspired by the classic Nokia Snake game
- Food eaten sound effect by [Ribhav Agrawal](https://pixabay.com/users/ribhavagrawal-39286533/)

- Game over sound effect by [FoxBoyTails](https://pixabay.com/users/foxboytails-49447089)

- Easter Egg video by [CuriosityShorts](https://www.youtube.com/watch?v=WAHoqt2y77k)

*Enjoy the game? Star the repository and share it with your friends! ⭐*