A simple Snake Game implemented in Python. The game features a snake that grows longer as it consumes food, and the objective is to maximize the score without colliding with the game boundaries, enemies, or the snake's own body.
-
Clone or download the repository to your local machine:
git clone https://github.com/grantwilson38/basic-snake-game.git
-
Ensure you have Python and the required libraries installed. You can install the necessary libraries using:
pip install pygame
-
Run the game by executing the Python script:
python main.py
- Use the arrow keys (Up, Down, Left, Right) to control the snake's direction.
- The snake starts with a single segment.
- Eating food (the small colored dots) increases the snake's length and score.
- Golden powerups make you temporarily invincible. Blue powerups make you longer. White powerups increase your score.
- You lose a life every time the snake collides with its own body, the game boundaries, or an enemy.
- Enemies die when they collide with each other or with your body.
You can customize certain aspects of the game by modifying the constants defined at the beginning of the script:
SCREEN_WIDTH
andSCREEN_HEIGHT
define the dimensions of the game window.SNAKE_SIZE
andFOOD_SIZE
determine the size of the snake segments and food items.- Color constants (
BLACK
,WHITE
,RED
,GREEN
,BLUE
) can be adjusted to change the appearance of the game elements.
Feel free to explore and modify the code to add new features or enhance existing ones.
- Python 3.x
- Pygame library
This game is inspired by classic Snake games and was created for educational purposes. It serves as a simple example of game development using Python.
This Snake Game is licensed under the MIT License. Feel free to use, modify, and distribute the code for your projects.# basicSnakeGame