Skip to content
/ Snake Public

๐Ÿ A classic arcade experience re-engineered with Python. Showcasing modular OOP architecture, custom collision logic, and strategic level design. Clean code meets retro gaming.

License

Notifications You must be signed in to change notification settings

SebaB29/Snake

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

80 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

๐Ÿ Snake Game

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.

๐Ÿ“ธ Demo

Snake Gameplay Game Over Screen

๐Ÿ“ Table of Contents

๐Ÿ“ Description

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.

๐Ÿงฉ Key Features

  • 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.

๐Ÿงฑ Project Structure

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

๐Ÿ› ๏ธ Technologies

  • Python 3.x
  • Gamelib: A lightweight thread-based rendering library for Python interfaces.

๐Ÿš€ Getting Started

๐Ÿ“‹ Prerequisites

  • Python 3.10 or higher installed on your system.

โš™๏ธ Installation

  1. Clone the repository:
    git clone git@github.com:SebaB29/Snake.git
    cd Snake
  2. (Optional) Create a virtual environment:
    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate

๐Ÿ’ก Usage

To start the game, simply run the main script:

python main.py

๐ŸŽฎ Controls

Key Action
Arrow Up Move Up
Arrow Down Move Down
Arrow Left Move Left
Arrow Right Move Right
P Pause / Resume

๐Ÿค Contributing

  1. Fork the project.
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature).
  3. Commit your changes (git commit -m 'Add some AmazingFeature').
  4. Push to the Branch (git push origin feature/AmazingFeature).
  5. Open a Pull Request.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

About

๐Ÿ A classic arcade experience re-engineered with Python. Showcasing modular OOP architecture, custom collision logic, and strategic level design. Clean code meets retro gaming.

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Contributors

Languages