Skip to content

gitKeshav11/Snake_Game.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🐍 Snake Game (Java)

A classic Snake Game built using Java Swing, designed to demonstrate object-oriented programming, event handling, and basic game development concepts in Java. The game features smooth controls, real-time movement, score tracking, and dynamic gameplay.


📸 Game Screenshot


🚀 Features

  • 🎮 Classic snake gameplay with smooth keyboard controls
  • ⌨️ Control the snake using arrow keys
  • 🍎 Random food generation
  • 📈 Score tracking system
  • 🐍 Snake grows after eating food
  • 💥 Game over detection on wall or self collision
  • 🧠 Clean and modular Object-Oriented Design

🛠️ Tech Stack

  • Language: Java

  • GUI Framework: Java Swing

  • Concepts Used:

    • Object-Oriented Programming (OOP)
    • Event Handling
    • Game Loop Logic
    • 2D Graphics Rendering

📂 Project Structure

SnakeGame/
├── .idea/                 # IntelliJ settings (hidden)
├── out/                   # Compiled class files
├── icons/                 # Game assets (images, icons)
│   ├── snake_head.png
│   └── food.png
├── Gameplay_Screenshot/   # Project demo images
├── Snake_Gamess.java      # Main Frame / Window Class
├── Snakess.java           # Core Game Logic Class
└── README.md              # Project documentation

Snake_Game/ │── src/ │ ├── SnakeGame.java │ ├── GamePanel.java │ └── GameFrame.java │── README.md


---

## ▶️ How to Run the Project
1. Clone the repository:
   ```bash
   git clone https://github.com/gitKeshav11/Snake_Game.git
  1. Open the project in any Java-supported IDE (IntelliJ IDEA / Eclipse / VS Code)

  2. Compile and run the main file:

    javac SnakeGame.java
    java SnakeGame

🎯 Learning Outcomes

  • Understanding Java Swing for GUI development
  • Applying OOP principles in real-world projects
  • Implementing basic game logic and collision detection
  • Improving problem-solving and logical thinking skills

🎮 Gameplay Highlights

  • Smooth real-time snake movement on a grid-based board
  • Minimalist dark UI for better focus on gameplay
  • Clear visual distinction between snake body and food

🌱 Future Improvements

  • 🔊 Add sound effects
  • 🎚️ Difficulty levels
  • 🏆 High-score saving feature
  • 🎨 Enhanced UI and animations

🤝 Contribution

Contributions are welcome! Feel free to fork this repository, raise issues, or submit pull requests.


📌 Author

Keshav Upadhyay Aspiring Java Backend Developer | Open Source Contributor

🔗 GitHub: https://github.com/gitKeshav11


⭐ If you like this project, don’t forget to give it a star!

About

Java Swing based Snake Game with real-time movement, increasing difficulty, score system, and clean object-oriented implementation.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages