Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Snake Game

HTML5 CSS3 JavaScript Snake Game License

A classic Snake Game built using HTML, CSS, and JavaScript.
The game uses grid-based rendering, event-driven input handling, and dynamic speed scaling to provide a smooth and challenging gameplay experience.

Move the snake around the board, eat food to grow longer, and try to beat your high score!



🎮 Features

  • ✅ Smooth real-time movement system using a JavaScript game loop (setInterval)
  • ✅ Supports Arrow keys and WASD for flexible player controls
  • ✅ Progressive difficulty – snake speed dynamically increases as it eats food
  • ✅ Collision detection for walls and self-body (game over handling)
  • ✅ High Score persistence with localStorage across sessions
  • ✅ Dynamic rendering of snake and food using DOM manipulation on a 20×20 grid
  • ✅ Event-driven input handling for instant and responsive controls
  • ✅ Algorithmic complexity in movement, growth, collision logic, and adaptive speed scaling
  • ✅ Retro-themed pixel-style design with layered borders


🚀 How to Play

  1. Press Spacebar to start the game.
  2. Use Arrow keys or WASD to move the snake:
    • ⬆️ / W → Up
    • ⬇️ / S → Down
    • ⬅️ / A → Left
    • ➡️ / D → Right
  3. Eat food ⬜ to grow longer.
  4. Avoid colliding with walls or yourself.
  5. Try to beat your High Score!


🎬Demo

Game Demo

Check out the live Snake Game here 👉 Play Snake Game



⚡ Getting Started

# Clone the repository:
git clone https://github.com/your-username/snake-game.git

# Open index.html in your browser.

Enjoy the game! 🎉



🛠️ Tech Stack

  • HTML5 – Game structure
  • CSS3 – Styling and layout
  • JavaScript – Game logic, rendering and interactions

⭐ Feel free to contribute, fork, or open issues to improve this project.

About

Eat. Grow. Survive. A retro-style Snake Game using HTML, CSS, and JavaScript — includes real-time movement, progressive difficulty, collision detection, and a clean pixel-inspired design.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages