Welcome to Snake, a classic arcade game implementation in Python. Navigate the snake, eat fruits to grow, and avoid obstacles in this project built with Object-Oriented Programming (OOP) principles.
This project was developed as a university assignment to demonstrate the use of classes, inheritance, and modular logic in Python. It uses a custom library for graphical rendering and event handling.
- Levels & Difficulty: Multiple levels with increasing speed and strategic obstacles.
- Classic Mechanics: Growing tail system and random fruit spawning.
- Collision Logic: Advanced detection for walls, obstacles, and self-collision.
- Pause System: Ability to pause the game at any moment.
Snake/
โโโ graphics/ # Rendering libraries (gamelib & custom)
โโโ img/ # Demo screenshots
โโโ resources/ # Configuration files (obstacles.txt)
โโโ src/ # Core game logic (OOP classes)
โ โโโ snake.py
โ โโโ fruit.py
โ โโโ game.py
โโโ main.py # Entry point
- Python 3.x
- Gamelib: A lightweight thread-based rendering library for Python interfaces.
- Python 3.10 or higher installed on your system.
- Clone the repository:
git clone git@github.com:SebaB29/Snake.git cd Snake - (Optional) Create a virtual environment:
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
To start the game, simply run the main script:
python main.py| Key | Action |
|---|---|
| Arrow Up | Move Up |
| Arrow Down | Move Down |
| Arrow Left | Move Left |
| Arrow Right | Move Right |
| P | Pause / Resume |
- Fork the project.
- Create your 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.

