A classic Snake game built with Python and Pygame featuring multiple food variations and smooth gameplay.
- Classic Snake Gameplay: Control the snake using arrow keys
- Multiple Food Types: 6 different food images that appear randomly
- Score Tracking: Keep track of your current score
- Game Over Detection: Collision detection with walls and snake body
- Smooth Animation: 60 FPS gameplay with responsive controls
- Sound Effects: Eating and collision sounds (optional)
- Python 3.x
- Pygame library
-
Clone this repository:
git clone https://github.com/rakshanda33/Snake-Game.git cd Snake-Game -
Install required dependencies:
pip install pygame
-
Run the game:
python snakeNew.py
- Use Arrow Keys to control the snake direction
- Eat food to grow longer and increase your score
- Avoid hitting the walls or your own body
- Press any key to restart after game over
- ↑ Arrow Key: Move Up
- ↓ Arrow Key: Move Down
- ← Arrow Key: Move Left
- → Arrow Key: Move Right
- Any Key: Restart game after game over
SnakeGame/
├── snakeNew.py # Main game file
├── snake.py # Alternative version
├── food.png # Food image 1
├── food1.png # Food image 2
├── food2.png # Food image 3
├── food3.png # Food image 4
├── food4.png # Food image 5
├── food5.png # Food image 6
├── requirements.txt # Python dependencies
├── Sounds/ # Sound effects folder (optional)
│ ├── eat.mp3 # Eating sound
│ └── wall.mp3 # Collision sound
└── README.md # This file
- Game Window: 600x600 pixels
- Grid Size: 20x20 cells
- Cell Size: 25x25 pixels
- Frame Rate: 60 FPS
- Snake Speed: Updates every 200ms
You can easily customize the game by modifying these variables in snakeNew.py:
cell_size: Size of each grid cellnumber_of_cells: Number of cells in the gridOFFSET: Border around the game areaGREENandDARK_GREEN: Game colors
- Fork the repository
- Create a new branch (
git checkout -b feature/improvement) - Make your changes
- Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/improvement) - Create a Pull Request
This project is open source and available under the MIT License.
Rakshanda Noor - GitHub Profile
- Built with Python and Pygame
- Inspired by the classic Snake game
- Thanks to the Pygame community for excellent documentation
Enjoy playing! 🎮
