This is a classic Snake game implemented in Java. The objective of the game is to control the snake using arrow keys and navigate it to eat apples, which causes the snake to grow longer. The player needs to avoid collisions with the boundaries of the game screen and the snake's own body. The game keeps track of the player's score, which increases with each apple eaten.
- Use the arrow keys to control the snake's movement: up, down, left, and right.
- The snake will automatically move in the current direction.
- Try to eat as many apples as possible to increase your score and snake length.
- Avoid hitting the boundaries or the snake's own body, as it will result in game over.
- Smooth snake movement and control using arrow keys.
- Randomly generated apples for the snake to eat.
- Score tracking and display.
- Game over screen when the snake collides with the boundaries or itself.
- Colorful graphics and appealing visual effects.
- Java
- Swing (for the graphical user interface)
To run the Snake game on your local machine, follow these steps:
- Make sure you have Java Development Kit (JDK) installed on your system.
- Clone this repository to your local machine using Git or download the ZIP file.
- Open the project in your preferred Java IDE (e.g., Eclipse, IntelliJ IDEA).
- Build and run the
GamePanel.java
file to start the game. - Use the arrow keys to control the snake and enjoy playing!
![Screenshot 1] ![Screenshot 2]
This project is licensed under the MIT License.
Feel free to clone, modify, and experiment with this code to enhance the game or learn more about Java game development.