# julianho-gh/godot-balls-game architecture

> Architecture diagram of the GitHub repository julianho-gh/godot-balls-game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/julianho-gh/godot-balls-game
- Repository: https://github.com/julianho-gh/godot-balls-game

## Overview

##### Project type and purpose
- This is a Godot‐engine game project (“Balls Game”) built with GDScript (.gd) and .tscn scene files.
- The goal is to assemble a simple physics/puzzle game with balls, cubes, floors, teleporters, menus, and custom shaders.

##### File structure
- Top‐level Godot files:
- project.godot – the Godot project descriptor
- export_presets.cfg – build/export settings
- addons/GodotGetImage – a custom plugin for image handling
- Scenes (.tscn): main.tscn, bola.tscn, cubo.tscn, piso.tscn, piso_esquina.tscn, teleportador.tscn, etc.
- Scripts (.gd): one per scene (main.gd, bola.gd, cubo.gd, piso.gd, punto_teletransporte.gd, etc.) plus utility scripts (area_2d.gd, objeto.gd, esquina_rampa.gd).
- Asset folders:
- Texturas – PSD source files for textures
- materials – .tres material definitions (resaltado_emision.tres)
- shaders – custom Godot shaders (.gdshader)
- UI scenes: MenuGuardados.tscn + .gd, Image.tscn + GameState.gd

##### Extract additional insights from the README
- Minimal documentation; no architectural overview.
- Implies single‐player, scene-based flow orchestrated by main.gd.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Engine
    Engine["Godot Engine"]:::engine

    %% Resources
    subgraph "Resources"
        Textures["Texturas/"]:::assets
        Materials["materials/resaltado_emision.tres"]:::assets
        Shaders["shaders/resaltado.gdshader"]:::assets
    end

    %% Plugin
    subgraph "Plugin Subsystem"
        PluginCfg["plugin.cfg"]:::plugin
        PluginGd["export_plugin.gd"]:::plugin
    end

    %% Game Scenes
    subgraph "Game Scenes"
        %% Main
        MainScene["main.tscn"]:::scenes
        MainScript["main.gd"]:::scripts
        MainScene -->|uses| MainScript

        %% Ball
        BallScene["bola.tscn"]:::scenes
        BallScript["bola.gd"]:::scripts
        BallScene -->|uses| BallScript

        %% Cube
        CubeScene["cubo.tscn"]:::scenes
        CubeScript["cubo.gd"]:::scripts
        CubeScene -->|uses| CubeScript

        %% Floor
        FloorScene["piso.tscn"]:::scenes
        FloorScript["piso.gd"]:::scripts
        FloorScene -->|uses| FloorScript

        %% Corner Floor
        CornerFloorScene["piso_esquina.tscn"]:::scenes
        CornerFloorScene -->|uses| FloorScript

        %% Corner Ramp Utility
        RampScene["esquina_rampa.tscn"]:::scenes
        RampScript1["esquinarampa.gd"]:::scripts
        RampScript2["esquina.gd"]:::scripts
        RampScene -->|uses| RampScript1
        RampScene -->|uses| RampScript2

        %% Teleporter
        TeleporterScene["teleportador.tscn"]:::scenes
        TeleporterScript["teleportador.gd"]:::scripts
        TeleporterScene -->|uses| TeleporterScript

        %% Teleport Point
        PointScene["PuntoTeletransporteIndividual.tscn"]:::scenes
        PointScript["punto_teletransporte.gd"]:::scripts
        PointScene -->|uses| PointScript

        %% Shared Utils
        Area2D["area_2d.gd"]:::scripts
        ObjectUtil["objeto.gd"]:::scripts
    end

    %% UI
    subgraph "UI"
        MenuScene["MenuGuardados.tscn"]:::scenes
        MenuScript["MenuGuardados.gd"]:::scripts
        MenuScene -->|uses| MenuScript

        ImageScene["Image.tscn"]:::scenes
        GameState["GameState.gd"]:::scripts
    end

    %% Plugin interactions
    PluginCfg -->|configured in| PluginGd
    PluginGd -->|provides images| GameState
    PluginGd -->|provides images| ImageScene

    %% Scene Instantiation
    Engine -->|runs| MainScene
    MainScene -->|instantiates| BallScene
    MainScene -->|instantiates| CubeScene
    MainScene -->|instantiates| FloorScene
    MainScene -->|instantiates| CornerFloorScene
    MainScene -->|instantiates| RampScene
    MainScene -->|instantiates| TeleporterScene
    MainScene -->|instantiates| PointScene
    MainScene -->|instantiates| MenuScene
    MainScene -->|instantiates| ImageScene

    %% Resource Usage
    Textures -->|applied to| BallScene
    Textures -->|applied to| CubeScene
    Textures -->|applied to| FloorScene
    Materials -->|used by| BallScene
    Materials -->|used by| CubeScene
    Shaders -->|effects on| BallScene
    Shaders -->|effects on| CubeScene
    Shaders -->|effects on| FloorScene

    %% Game Loop
    Input["Player Input"]:::external
    Physics["Physics Engine"]:::engine
    Rendering["Rendering"]:::engine

    Input -->|feeds| MainScript
    MainScript -->|updates| Physics
    Physics -->|updates| Rendering
    Rendering -->|shaders| Shaders

    %% Click Events
    click PluginCfg "https://github.com/julianho-gh/godot-balls-game/blob/main/addons/GodotGetImage/plugin.cfg"
    click PluginGd "https://github.com/julianho-gh/godot-balls-game/blob/main/addons/GodotGetImage/export_plugin.gd"
    click MainScene "https://github.com/julianho-gh/godot-balls-game/blob/main/main.tscn"
    click MainScript "https://github.com/julianho-gh/godot-balls-game/blob/main/main.gd"
    click BallScene "https://github.com/julianho-gh/godot-balls-game/blob/main/bola.tscn"
    click BallScript "https://github.com/julianho-gh/godot-balls-game/blob/main/bola.gd"
    click CubeScene "https://github.com/julianho-gh/godot-balls-game/blob/main/cubo.tscn"
    click CubeScript "https://github.com/julianho-gh/godot-balls-game/blob/main/cubo.gd"
    click FloorScene "https://github.com/julianho-gh/godot-balls-game/blob/main/piso.tscn"
    click FloorScript "https://github.com/julianho-gh/godot-balls-game/blob/main/piso.gd"
    click CornerFloorScene "https://github.com/julianho-gh/godot-balls-game/blob/main/piso_esquina.tscn"
    click RampScene "https://github.com/julianho-gh/godot-balls-game/blob/main/esquina_rampa.tscn"
    click RampScript1 "https://github.com/julianho-gh/godot-balls-game/blob/main/esquinarampa.gd"
    click RampScript2 "https://github.com/julianho-gh/godot-balls-game/blob/main/esquina.gd"
    click TeleporterScene "https://github.com/julianho-gh/godot-balls-game/blob/main/teleportador.tscn"
    click TeleporterScript "https://github.com/julianho-gh/godot-balls-game/blob/main/teleportador.gd"
    click PointScene "https://github.com/julianho-gh/godot-balls-game/blob/main/PuntoTeletransporteIndividual.tscn"
    click PointScript "https://github.com/julianho-gh/godot-balls-game/blob/main/punto_teletransporte.gd"
    click MenuScene "https://github.com/julianho-gh/godot-balls-game/blob/main/MenuGuardados.tscn"
    click MenuScript "https://github.com/julianho-gh/godot-balls-game/blob/main/MenuGuardados.gd"
    click GameState "https://github.com/julianho-gh/godot-balls-game/blob/main/GameState.gd"
    click Area2D "https://github.com/julianho-gh/godot-balls-game/blob/main/area_2d.gd"
    click ObjectUtil "https://github.com/julianho-gh/godot-balls-game/blob/main/objeto.gd"
    click Textures "https://github.com/julianho-gh/godot-balls-game/tree/main/Texturas/"
    click Materials "https://github.com/julianho-gh/godot-balls-game/blob/main/materials/resaltado_emision.tres"
    click Shaders "https://github.com/julianho-gh/godot-balls-game/blob/main/shaders/resaltado.gdshader"
    click project_des "https://github.com/julianho-gh/godot-balls-game/blob/main/project.godot"
    click export_cfg "https://github.com/julianho-gh/godot-balls-game/blob/main/export_presets.cfg"

    %% Styles
    classDef scenes fill:#ccf,stroke:#66f,stroke-width:1px
    classDef scripts fill:#ffc,stroke:#fc0,stroke-width:1px
    classDef assets fill:#cfc,stroke:#6c6,stroke-width:1px
    classDef engine fill:#eee,stroke:#999,stroke-width:1px
    classDef plugin fill:#ddd,stroke:#888,stroke-width:1px
    classDef external fill:#fdd,stroke:#f00,stroke-width:1px
```
