This is a simple Snake Game implemented in Java using Swing for the graphical user interface. The game allows the player to control a snake that moves around the game board, eating food and growing longer. The game ends when the snake collides with itself or the boundaries of the game board.
- Snake grows longer each time it eats food.
- Game over when the snake collides with itself or the boundaries of the game board.
- Score is displayed on the screen.
- Player can control the snake's direction using arrow keys.
- Ensure you have Java Development Kit (JDK) installed on your system.
- Compile the source code files (
Game.java
) usingjavac
command: - Run the compiled program using
java
command: - The game window will open, and you can start playing by using the arrow keys to control the snake's direction.
- Use the up, down, left, and right arrow keys to control the snake's movement.
- Press any other key to pause or resume the game.
- The snake starts with a single segment.
- The snake moves continuously in the direction it is facing.
- The player must maneuver the snake to eat food items that appear randomly on the board.
- Each time the snake eats food, it grows longer by one segment.
- The game ends if the snake collides with itself or hits the boundaries of the game board.
- The score is displayed on the screen, representing the length of the snake.
Game.java
: Contains the main game logic, including the game board, snake movement, collision detection, and scoring.
- Java Development Kit (JDK) installed on your system.
This game was implemented by Paaras Sharma.
Enjoy playing the Snake Game!