/java-snake-game

This is a simple Snake game implemented in Java using Swing for graphical user interface.

Primary LanguageJava

Snake Game

This is a simple Snake game implemented in Java using Swing for graphical user interface.

How to Play

  • Use the arrow keys (UP, DOWN, LEFT, RIGHT) to control the movement of the snake.
  • Press P to pause the game.
  • Press ENTER to start a new game after game over.

Rules

  • The snake starts in the center of the screen.
  • The objective is to eat the cherry to grow the snake.
  • Avoid hitting the walls or the snake itself.
  • The game ends when the snake collides with a wall or itself.

Features

  • Score Display: The current score and best score are displayed on the screen.
  • Cherry Image: A cherry image is displayed instead of a simple shape.
  • Pause Feature: Pause and resume the game anytime during gameplay.
  • Game Over Screen: Displays the "Game Over" message when the game ends.
  • Instructions: Shows instructions on how to start the game when not started.

Technologies Used

  • Java
  • Swing (for GUI)
  • AWT (for graphics)

How to Run

  1. Compile the Java files.
  2. Run the Main class.

Requirements

  • Java Development Kit (JDK)
  • Java Compiler (included in JDK)