# tomas-dorado/tarea architecture

> Architecture diagram of the GitHub repository tomas-dorado/tarea, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tomas-dorado/tarea
- Repository: https://github.com/tomas-dorado/tarea

## Overview

##### Project Type and Purpose
- This is a game developed using Python and Pygame. The game involves a player that can move and shoot, multiple enemies (opponents), and a final boss. The README clearly specifies that it’s a shooting game with features like lives, score accumulation, and different enemy types.
- The purpose is to provide an arcade-style shooter where the player must avoid enemy collisions and eliminate opponents, culminating in a challenging boss fight.

##### Main Components
- Game Engine / Main Loop: Represented by main.py and Game.py, which likely handle game initialization, the main game loop, and orchestrating events.
- Entities and Characters: Classes like Entity.py, Character.py, Player.py, Opponent.py, and Boss.py indicate a class hierarchy. Typically, Entity could be a base class, Character might derive from it to add common behavior for moving characters, and then Player, Opponent, and Boss add their specific traits.
- Projectiles: Shot.py manages the projectile logic for when the player fires.
- Auxiliary: The __pycache__ directory and others are not significant for the design but indicate compiled bytecode storage.

##### Relationships and Interactions
- The main game loop (main.py / Game.py) coordinates the game state and updates all active entities during each cycle.
- Opponent and Boss classes represent enemy behavior and are likely controlled by the Game module, handling collisions and interactions with shots.
- Entity/Character serves as a common interface or base for all movable game objects, ensuring shared properties (like position, rendering, and update routines).

##### Architectural Patterns and Design Principles
- Object-Oriented Design: Classes are arranged in an inheritance hierarchy allowing code reuse and abstraction.
- Separation of Concerns: The game logic (Game.py and main.py) is clearly separated from entity definitions (e.g., Player, Opponent, Boss) and projectile behavior (Shot.py).
- Event-Driven / Real-Time Loop: The main loop captures input, updates game state, and renders to screen in a cyclical fashion.

- User interface components (if applicable later)
- Game objects (Player, Opponent, Boss) versus utility logic (Shot, main game loop)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Game Engine / Main Loop Layer
    subgraph "Game Engine / Main Loop"
        GE1["main.py"]:::engine
        GE2["Game.py"]:::engine
    end

    %% Entity Layer
    subgraph "Entity Layer"
        EB["Entity Base"]:::entity
        CB["Character Base"]:::entity
        PL["Player"]:::entity
        OP["Opponent"]:::entity
        BS["Boss"]:::entity
    end

    %% Projectile Layer
    subgraph "Projectile Layer"
        ST["Shot"]:::projectile
    end

    %% Inheritance Relationships
    EB -->|"inherits"| CB
    CB -->|"extends"| PL
    CB -->|"extends"| OP
    CB -->|"extends"| BS

    %% Game Engine Update Flow
    GE1 -->|"update"| CB
    GE2 -->|"update"| CB
    GE1 -->|"update"| ST
    GE2 -->|"update"| ST

    %% Player interaction with Projectile
    PL -->|"shoots"| ST

    %% Projectile collision detection
    ST -->|"collides"| OP
    ST -->|"collides"| BS

    %% Styling Definitions
    classDef engine fill:#FFCCCC,stroke:#CC0000,stroke-width:2px;
    classDef entity fill:#CCFFCC,stroke:#006600,stroke-width:2px;
    classDef projectile fill:#CCCCFF,stroke:#0000FF,stroke-width:2px;

    %% Click Events
    click GE1 "https://github.com/tomas-dorado/tarea/blob/main/main.py"
    click GE2 "https://github.com/tomas-dorado/tarea/blob/main/Game.py"
    click EB "https://github.com/tomas-dorado/tarea/blob/main/Entity.py"
    click CB "https://github.com/tomas-dorado/tarea/blob/main/Character.py"
    click PL "https://github.com/tomas-dorado/tarea/blob/main/Player.py"
    click OP "https://github.com/tomas-dorado/tarea/blob/main/Opponent.py"
    click BS "https://github.com/tomas-dorado/tarea/blob/main/Boss.py"
    click ST "https://github.com/tomas-dorado/tarea/blob/main/Shot.py"
```
