This is a simple and fun version of the classic Snake game developed using Java Swing. The game is controlled with arrow keys and includes a basic scoring system.
The game screen displays the snake, food (apples), and current score at the top.
- Java JDK 8 or later
- Any Java IDE (e.g., IntelliJ IDEA, Eclipse, VS Code) or terminal
javacandjavamust be available in your system PATH
javac -d bin src/SnakePackage/*.javajava -cp bin SnakePackage.SnakeGameYou can run the game directly on Windows using the included Snake.exe file.
Use Snake_Setup.exe (created with Inno Setup) to install the game.
- You start as a snake with 6 body parts.
- Red circles represent apples.
- Every time you eat an apple:
- The snake grows longer
- Your score increases
- The game ends if you hit the wall or collide with your own body.
- After a game over, press
Enterto restart.
| Key | Action |
|---|---|
| โฌ ๏ธ Left | Move left |
| โก๏ธ Right | Move right |
| โฌ๏ธ Up | Move up |
| โฌ๏ธ Down | Move down |
| โ Enter | Restart the game |
SnakeProject/
โโโ src/
โ โโโ SnakePackage/
โ โโโ SnakeGame.java
โ โโโ GameFrame.java
โ โโโ GamePanel.java
โโโ bin/ # Compiled classes (via javac -d)
โโโ screenshot.png # Game screenshot (optional)
โโโ Snake.exe # Executable file (from Inno Setup)
โโโ Snake_Setup.exe # Installer (optional)
โโโ README.md
- Java 8+
- Java Swing (for GUI)
- Inno Setup (for Windows installer)
This project is licensed under the MIT License โ see the LICENSE file for details.
Enjoy the game! ๐น๏ธ


