Skip to content

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Snake Game — JavaScript

A simple and interactive Snake Game built using HTML, CSS, and Vanilla JavaScript. The project demonstrates DOM manipulation, keyboard event handling, game loops, collision detection, and dynamic rendering.

🎮 Features

  • 🐍 Classic Snake gameplay
  • ⌨️ Arrow-key controls
  • 🍎 Random food generation
  • 📈 Snake grows after eating food
  • 💥 Wall collision detection
  • ▶️ Start game functionality
  • 🎨 Dynamic game-board rendering
  • ⚡ Built using Vanilla JavaScript — no external libraries

🛠️ Technologies Used

  • HTML5
  • CSS3
  • JavaScript (ES6+)

🎯 Controls

Key Action
⬆️ Arrow Up Move Up
⬇️ Arrow Down Move Down
⬅️ Arrow Left Move Left
➡️ Arrow Right Move Right

📂 Project Structure

Snake_Game_JavaScript/
│
├── index.html
├── style.css
├── script.js
└── README.md

🚀 How to Run

1. Clone the repository

git clone https://github.com/AKASH4213A/Snake_Game_JavaScript.git

2. Open the project

Navigate into the project folder:

cd Snake_Game_JavaScript

3. Run the game

Open index.html in your browser.

You can also use the Live Server extension in VS Code for a better development experience.

🧠 Concepts Practiced

This project was created to practice and understand:

  • DOM Manipulation
  • JavaScript Event Listeners
  • setInterval()
  • Arrays and Objects
  • Keyboard Events
  • Collision Detection
  • Random Number Generation
  • Dynamic CSS Classes
  • Game Loop Logic
  • Basic Game State Management

Credit goes to Sheriyansh coding school)

🔮 Future Improvements

Some features that can be added in future versions:

  • Score system
  • High-score system
  • Self-collision detection
  • Increasing game speed
  • Pause / Resume functionality
  • Restart button
  • Mobile touch controls
  • Sound effects
  • Difficulty levels
  • Responsive mobile layout

📸 Preview

image image
![Snake Game Preview]

👨‍💻 Author

Akash Ahirwar


⭐ If you like this project, consider giving the repository a star!

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages