Skip to content

The Snake Game is a classic arcade-style game built in Java. It features a growing snake that must collect apples without running into walls or itself. While MySQL can be used to store high scores, if it's not set up, the game still runs normally but won't record your scores.

Notifications You must be signed in to change notification settings

codingwithnsh/SnakeGame

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Snake Game in Java

A simple Snake Game developed in Java with optional MySQL database support for saving high scores.
If you don't configure MySQL, you can still play the game, but scores won't be recorded.

Features

  • Classic Snake mechanics: the snake grows with each apple eaten.
  • Adjustable speed for various difficulty levels (configured in code).
  • Optional database integration for storing high scores.

Requirements

  • Java 8 or higher.
  • MySQL (optional) for score persistence.

How It Works

  1. The snake starts at a fixed size.
  2. Apple spawns randomly on the board.
  3. Each time the snake eats an apple, it grows in length and your score increases.
  4. Hitting a wall or colliding with your own snake ends the game.
  5. If MySQL is configured, the final score is saved in the database.

License

This project is under the MIT License. Feel free to use or modify it as you wish.

About

The Snake Game is a classic arcade-style game built in Java. It features a growing snake that must collect apples without running into walls or itself. While MySQL can be used to store high scores, if it's not set up, the game still runs normally but won't record your scores.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages