A classic Snake game built with Pygame featuring multiple speed levels, high score tracking, and both mouse and keyboard controls.
- Multiple Speed Levels: Choose from Very Slow, Slow, Medium, Fast, and Very Fast
- High Score System: Tracks your top 5 scores across sessions
- Dual Control Options: Play with keyboard arrows or mouse controls
- Modern UI: Glass-style buttons with hover effects
- Custom Graphics: Striped snake design with 3D-style apple
- Wraparound Gameplay: Snake wraps around screen edges
- Persistent Storage: High scores saved to local file
- Python 3.7 or higher
- Pygame library
- Clone the repository:
git clone https://github.com/lesleyshiri/mr-snake-game.git
cd mr-snake-game- Install dependencies:
pip install pygame- Update the background image path in the code:
IMAGE_PATH = r"path/to/your/background/image.png"- Run the game:
python snake_game.py-
Main Menu Options:
- NEW GAME (1 or Enter): Start a new game
- HIGH SCORE (2): View top 5 high scores
- SPEED: Click to cycle through speed presets
- END GAME (3 or ESC): Exit the game
-
Game Controls:
- Arrow Keys: Control snake direction (Up, Down, Left, Right)
- Mouse: Click and hold to steer snake toward cursor
- ESC or Menu Button: Return to main menu
-
Game Over Options:
- R: Replay game at current speed
- M or ESC: Return to main menu
- Snake grows by one segment each time it eats food
- Game ends when snake collides with itself
- Snake wraps around screen edges (no wall collision)
- Score increases by 1 for each food item eaten
- High scores are automatically saved
You can customize the game by modifying these constants in the code:
WIDTH, HEIGHT = 600, 500 # Window dimensions
CELL_SIZE = 20 # Grid cell size
SPEED_PRESETS = [ # Speed options (label, FPS)
("Very Slow", 1),
("Slow", 3),
("Medium", 5),
("Fast", 10),
("Very Fast", 15),
]mr-snake-game/
│
├── snake_game.py # Main game file
├── highscore.txt # High scores (auto-generated)
├── background.png # Background image (not included)
├── README.md # This file
└── LICENSE # MIT License
- Built with: Python 3.x and Pygame
- Graphics: Custom-rendered shapes with transparency effects
- Data Persistence: Text file storage for high scores
- UI Design: Bootstrap-inspired color scheme with glass morphism
- Performance: Configurable FPS from 1 to 15
pygame>=2.0.0
- Background image path must be manually configured
- Game requires valid image file at specified path to run
- Add sound effects and background music
- Implement power-ups and obstacles
- Add multiplayer support
- Create level progression system
- Add more snake skin options
- Include sample background images
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
Lesley Shiri
- GitHub: @lesleyshiri
- MBA Candidate at Clarkson University
- Built as a Python mini-project
- Inspired by the classic Nokia Snake game
- Uses Pygame community resources and documentation
Enjoy the game! 🎮🐍