This Simple Snake Game is a basic implementation of the classic Snake game using Python and Pygame. The player controls a snake, which moves around the game area, eating food to grow longer. The game ends if the snake runs into the game area walls or into itself.
- Basic snake movement and growth mechanics
- Collision detection with food, walls, and the snake's body
- Score tracking based on the length of the snake
- Customizable game area and snake speed
- Graphical display using Pygame, including images for snake's head, food, and background
- Python 3.x
- Pygame library
- Ensure Python 3.x is installed on your system.
- Install Pygame:
pip install pygame
- Download the game source code and the required image files:
snake-head.png
: https://cdn-icons-png.flaticon.com/512/2469/2469814.png ,food.png
: https://i.pinimg.com/originals/f8/2f/8f/f82f8f24633a76f5893ebbbf79f3c5ae.png ,background.png
: https://img.freepik.com/free-photo/studio-background-concept-abstract-empty-light-gradient-purple-studio-room-background-product_1258-54675.jpg).
- Run the script:
python snake_game.py
- Use the arrow keys to control the movement of the snake.
- Eat the food to grow longer.
- Avoid hitting the walls or the snake's body.
- The game ends when the snake collides with the wall or itself. Press
R
to restart orQ
to quit.
- Arrow keys: Move the snake (Up, Down, Left, Right)
Q
: Quit the gameR
: Restart the game
- Change
snake_speed
to adjust the speed of the snake. - Modify
width
andheight
to change the size of the game area. - Replace image files to customize the appearance.
Contributions to the game are welcome. Please feel free to fork the repository, make improvements, and open a pull request.
- Pygame Community for the excellent game development library
- Original creators of the Snake game for inspiration