Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Snake Game

A classic Snake Game built using HTML, CSS, and JavaScript, featuring smooth movement, sound effects, and score tracking.


🎮 Features

  • Real-time snake movement using keyboard controls
  • 🍎 Food spawning at random positions
  • 🔊 Sound effects for movement, eating, and game over
  • 🧠 Collision detection (self + walls)
  • 🏆 High score saved using browser local storage
  • ⚡ Adjustable game speed

🕹️ Controls

Use the arrow keys to control the snake:

  • ⬆️ Up Arrow → Move Up
  • ⬇️ Down Arrow → Move Down
  • ⬅️ Left Arrow → Move Left
  • ➡️ Right Arrow → Move Right

🚀 How to Run

  1. Clone the repository:
git clone https://github.com/your-username/snake-game.git
  1. Open the project folder

  2. Run the game:

  • Open index.html in your browser

🧩 Project Structure

Snake Game/
│── index.html
│── Snake.js
│── Snake.css
│── Audio/
│   ├── Bite.wav
│   ├── Die.wav
│   ├── Move.wav
│   └── Music.wav

⚙️ How It Works

  • The game loop runs using requestAnimationFrame

  • The snake position is stored as an array of coordinates

  • Each frame:

    • Movement updates based on user input
    • Collision detection is checked
    • Food consumption increases score and length
  • High score is stored in localStorage


🎯 Gameplay Logic Highlights

  • Snake grows when it eats food
  • Game resets on collision
  • Speed controls how fast the game updates
  • Food appears randomly within the grid

🛠️ Tech Used

  • HTML5
  • CSS3 (Grid-based layout)
  • JavaScript (Game logic & DOM manipulation)

⭐ If you like this project, consider starring the repo!

About

A clock made using HTML, CSS and Js

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages