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.
- 🎮 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
-
Language: Java
-
GUI Framework: Java Swing
-
Concepts Used:
- Object-Oriented Programming (OOP)
- Event Handling
- Game Loop Logic
- 2D Graphics Rendering
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
-
Open the project in any Java-supported IDE (IntelliJ IDEA / Eclipse / VS Code)
-
Compile and run the main file:
javac SnakeGame.java java SnakeGame
- 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
- 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
- 🔊 Add sound effects
- 🎚️ Difficulty levels
- 🏆 High-score saving feature
- 🎨 Enhanced UI and animations
Contributions are welcome! Feel free to fork this repository, raise issues, or submit pull requests.
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!