This is a simple implementation of the classic Snake game using Python and the Pygame library.
- Python 3.x
- Pygame
- Install Python from python.org.
- Install Pygame using pip:
pip install pygame
- Clone the repository or download the
app.pyfile. - Navigate to the directory containing
app.py. - Run the script:
python app.py
- Use the arrow keys to control the direction of the snake.
- The objective is to eat the white fruit to grow the snake and increase your score.
- The game ends if the snake collides with the walls or itself.
- The game initializes the Pygame library and sets up the game window.
- The snake and fruit are drawn on the screen using rectangles.
- The snake's movement is controlled by the arrow keys.
- The game checks for collisions with the walls and the snake's own body to determine if the game is over.
- The score is displayed on the screen and updated as the snake eats the fruit.
show_score(choice, color, font, size): Displays the current score on the screen.game_over(): Displays the final score and ends the game.
This project is licensed under the MIT License.