Skip to content

Latest commit

ย 

History

History
82 lines (55 loc) ยท 2.2 KB

File metadata and controls

82 lines (55 loc) ยท 2.2 KB

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

Live Preview

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:
git clone https://github.com/yourusername/html-canvas-snake.git
  1. Open index.html in your browser or run npx serve if you have node.js installed locally.

  2. 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.

Credits ๐Ÿ™

Enjoy the game? Star the repository and share it with your friends! โญ