markdown
A modern 2D Snake game built using pygame, featuring a vibrant gradient background, a gradient snake, and gradient food. The objective is to collect food to grow the snake while avoiding collisions with the wall and the snake's own body. The game gets progressively harder as the snake's speed increases with each food item eaten.
- Gradient Background: Smooth vertical gradient from Light Sky Blue to Midnight Blue.
- Gradient Snake: Snake represented by spheres with a radial gradient effect.
- Gradient Food: Food appears as a circle with a gradient color, respawning after being eaten.
- Score System: The score increases as the snake eats food.
- Increasing Difficulty: Snake's velocity increases after eating food.
- Game Over Screen: Displays "Game Over" when the snake collides with the wall or itself.
- Congratulations Screen: Displayed upon reaching a score of 100.
- Python 3.x
- Pygame library
Follow these steps to get the game running:
First, clone the repository to your local machine by running the following command in your terminal:
git clone https://github.com/<username>/sphere-snake-game.gitThis command creates a local copy of the project on your computer.
Once cloned, change into the project directory with the following command:
cd sphere-snake-gameThis will move you into the project folder, where all the game files are stored.
Ensure that you have Python 3.x installed on your system. You can download it from the official Python website.
Next, install the required pygame library by running the following command:
pip install pygameThis will install the Pygame library, which is essential for rendering the graphics, handling game loops, and managing user inputs.
-
Run the Game:
Execute the
main.pyfile to start the game:python main.py
-
Controls:
- Use the arrow keys:
- Up Arrow: Move the snake up
- Down Arrow: Move the snake down
- Left Arrow: Move the snake left
- Right Arrow: Move the snake right
- Use the arrow keys:
-
Objective:
- Collect food to grow the snake.
- Avoid colliding with the walls or the snake's own body.
- The game ends when the snake collides with itself or the walls.
-
Score Milestone:
- Reach a score of 100 to see a congratulatory message!
-
Game Over:
- The game ends when the snake collides with the wall or itself, and your final score will be displayed.
- Obstacles: Adding obstacles that the snake must avoid for extra difficulty.
- Sound Effects: Incorporating sounds for actions like eating food, movement, and game over scenarios.
- High Score Tracking: Keeping track of the highest score achieved during gameplay.
- Developers:
- @Norah-G (Norah Kimathi)
- @Radula254 (Joshua Radula)
- @FatmaAgil (Fatma Agil)
- @NjokiBless (Njoki Bless)
Enjoy the game, and feel free to contribute or improve upon it!
This project is licensed under the MIT License - see the LICENSE file for details.