Skip to content

Latest commit

 

History

History
53 lines (35 loc) · 1.92 KB

README.md

File metadata and controls

53 lines (35 loc) · 1.92 KB

Sanke_Game

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.

Features

  • 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.

Getting Started

Prerequisites Java Development Kit (JDK) installed on your system. Running the Game

Clone the repository:

https://github.com/kumar-rakshith/Sanke_Game.git cd SANKE_GAME

Compile the Java files:

javac gamepanel.java sankemain.java gameframe.java

Run the game:

java SnakeGame

Files

  • 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.

How to Play

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.

Screenshots

Screenshot (165) Screenshot (164)

Contributing

Feel free to fork this repository and submit pull requests. Contributions are welcome!

License

This project is licensed under the MIT License. See the LICENSE file for details.