This repository contains the source code for a classic Snake game implemented in Java. The game is built using the Java Swing library for the graphical user interface.
- Classic Gameplay: Control the snake to eat apples and grow longer while avoiding collisions with the walls and the snake's own body.
- User Controls: Use the arrow keys to control the direction of the snake.
- Score Tracking: Keep track of the number of apples eaten.
- Restart Button: Restart the game after a game over without restarting the application.
Prerequisites Java Development Kit (JDK) installed on your system. Running the Game
https://github.com/kumar-rakshith/Sanke_Game.git cd SANKE_GAME
javac gamepanel.java sankemain.java gameframe.java
java SnakeGame
- gamePanel.java: Contains the main logic for the Snake game, including game initialization, rendering, and handling user inputs.
- SankGame.java: The entry point for the game, which initializes the game window.
- gameFrame.java: Sets up the main game window and adds the game panel to it.
Use the arrow keys to change the direction of the snake. Eat the apples to grow longer. Avoid running into the walls or the snake's own body. The game ends when the snake collides with a wall or itself. Click the "Restart" button to play again after a game over.
Feel free to fork this repository and submit pull requests. Contributions are welcome!
This project is licensed under the MIT License. See the LICENSE file for details.