Skip to content

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🐍 Snake Game

A simple browser-based Snake Game built using HTML5 Canvas and JavaScript. The project focuses on implementing game logic, keyboard controls, collision detection, scoring, and dynamic game speed using JavaScript.

🎮 About the Project

This project is a classic Snake Game where the player controls a snake using the arrow keys to collect food and increase the score.

The game was built to practice JavaScript fundamentals, DOM manipulation, event handling, Canvas API, game loops, and logical problem-solving.

✨ Features

  • 🎮 Arrow-key controls
  • 🍎 Randomly positioned food
  • 📈 Score tracking
  • ⚡ Increasing game speed as the score increases
  • 💥 Wall collision detection
  • 🐍 Self-collision detection
  • 🔄 Game reset after Game Over
  • ▶️ Start button to begin the game
  • 🎨 HTML5 Canvas-based game board

🛠️ Technologies Used

  • HTML5
  • JavaScript
  • HTML5 Canvas API

📂 Project Structure

Snake-Project/
│
├── index.html
├── script.js
└── README.md

🚀 Getting Started

1. Clone the repository

git clone https://github.com/debojitdey037/Snake-Project.git

2. Navigate to the project

cd Snake-Project

3. Run the game

Open index.html in your web browser.

No additional installation or dependencies are required.

🕹️ How to Play

  1. Open the game in your browser.
  2. Click the Start button.
  3. Use the Arrow Keys to control the snake.
  4. Collect the food to increase your score.
  5. Avoid hitting the walls or the snake's own body.
  6. The game ends when a collision occurs.

🧠 Key Concepts Practiced

  • JavaScript variables and functions
  • Arrays and objects
  • DOM event handling
  • Keyboard event listeners
  • HTML5 Canvas drawing
  • Game loops and timing
  • Collision detection
  • Random number generation
  • Game state management

🔮 Future Improvements

  • Add a high-score system
  • Add pause/resume functionality
  • Add difficulty levels
  • Improve the visual design
  • Add sound effects
  • Make the game responsive for mobile devices
  • Add a restart button
  • Add a game start screen

👨‍💻 Author

Debojit Dey

B.Tech Computer Science & Engineering (AI & ML) Student

Interested in Web Development, Software Development, and AI/ML.

Connect with me


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

About

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages