This Python script implements a classic Snake game using the Pygame library. The player controls a snake that must navigate the game area, collect prizes, and avoid collisions with itself and the boundaries.
- Snake Movement: Use arrow keys to control the direction of the snake (up, down, left, right).
- Prizes: Prizes appear randomly on the screen. The snake grows longer and earns points when it consumes a prize.
- Game Over: The game ends when the snake collides with the boundaries or itself.
- Score Tracking: Keep track of your score as you collect prizes.
-
Install Dependencies:
- Make sure you have Python installed on your machine.
- Install the Pygame library and colour library, using the following commands:
pip install pygame pip install colour
-
Run the Game:
- Execute the script using the following command:
python snake_game.py
- Execute the script using the following command:
-
Game Controls:
- Use the arrow keys to control the snake:
- UP: Move Up
- DOWN: Move Down
- LEFT: Move Left
- RIGHT: Move Right
- Use the arrow keys to control the snake:
-
Game Over and Restart:
- The game ends if the snake collides with the boundaries or itself.
- After a game over, you can restart the game by following the on-screen instructions.
- You can customize various aspects of the game, such as the speed of the snake, appearance of prizes, and more by modifying the
snake_game.py
script.
If you have suggestions or find issues with the game, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License