A classic Snake Game implemented in Python using the Pygame library.
- Intuitive controls: Control the snake's movement using the arrow keys (Up, Down, Left, Right) on your keyboard.
- Score system: Earn points by eating food, and keep track of your high scores.
- Top 10 high scores: The game records the top 10 high scores achieved by players.
- Game over conditions: The game ends if the snake collides with a wall or its own body.
- Play again: After each game, you can choose to play again and improve your score.
- Python3
- Pygame library
- Make sure you have Python 3.x installed on your system.
- Install the Pygame library by running the following command: pip install pygame
- Download or clone the repository.
- Navigate to the project directory.
- Run the game by executing the following command: python Snake.py
- Control the snake's movement using the arrow keys (Up, Down, Left, Right).
- Eat the food (red rectangles) to grow the snake and earn points.
- Avoid colliding with the walls or the snake's own body.
- The game ends when the snake hits a wall or its own body.
- If you achieve a high score, you will be prompted to enter your name.
- The top 10 high scores will be displayed at the end of each game.
- To play again, enter 'Y' when prompted, otherwise enter 'N' to exit the game.
- Arrow Up: Move the snake up.
- Arrow Down: Move the snake down.
- Arrow Left: Move the snake left.
- Arrow Right: Move the snake right.
The game keeps track of the top 10 high scores achieved by players. The scores are saved in a file named "highscores.txt" in the following format: *Name:Score
If you achieve a high score, you will be prompted to enter your name. The high scores will be displayed at the end of each game.
There is currently an error with the snake colliding with itself. As a temporary workaround, the problematic part of the code has been commented out. Without this modification, the game ends when the snake gets the first piece of food.
This Snake Game is based on the classic game concept and was implemented using the Pygame library.
Enjoy playing the Snake Game!