# adautobenevides/game_retro architecture

> Architecture diagram of the GitHub repository adautobenevides/game_retro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/adautobenevides/game_retro
- Repository: https://github.com/adautobenevides/game_retro

## Overview

This is a 2D top-down adventure game. The player starts from the menu, chooses a character, enters a house or outdoor world, and plays through movement, combat, pickups, and health/ammo tracking. Game owns the update/render loop and coordinates the menu, player, entities, world transitions, and presentation. The map loader, collision, enemies, shooting, and UI are supported by sampled source; the file tree also shows pickups, weapons, and audio, but their detailed runtime wiring was not sampled.

Main entry points: [`src/com/daugames/world/World.java`](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/World.java) (World loader), [`src/com/daugames/main/Game.java`](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/main/Game.java) (Game loop), [`src/com/daugames/entities/Player.java`](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/Player.java) (Player), [`src/com/daugames/main/Menu.java`](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/main/Menu.java) (Menu and selection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game flow"]
  node_menu["Menu and selection<br/>[Menu.java]"]
  node_game_loop["Game loop<br/>[Game.java]"]
  node_game_state["Game states<br/>[GameState.java]"]
end

subgraph group_world["World and collision"]
  node_world_loader["World loader<br/>[World.java]"]
  node_house["House and doors<br/>[House.java]"]
  node_tiles["Tiles and props<br/>[Tile.java]"]
  node_camera["Camera<br/>[Camera.java]"]
end

subgraph group_actors["Actors and combat"]
  node_player["Player<br/>[Player.java]"]
  node_enemy["Enemies<br/>[Enemy.java]"]
  node_dog["Dog companion<br/>[Dog.java]"]
  node_projectiles["Projectiles<br/>[BulletShoot.java]"]
  node_pickups["Pickups and weapons<br/>[LifePack.java]"]
  node_entity_base["Entity base<br/>[Entity.java]"]
end

subgraph group_presentation["Presentation"]
  node_ui["HUD<br/>[UI.java]"]
  node_spritesheet["Sprite assets<br/>[Spritesheet.java]"]
  node_sound["Audio<br/>[Sound.java]"]
end

node_game_user(("Player"))

node_game_user -->|"chooses character"| node_menu
node_menu -->|"starts game"| node_game_loop
node_menu -->|"creates player"| node_player
node_menu -->|"loads house"| node_world_loader
node_game_loop -->|"checks state"| node_game_state
node_game_loop -->|"updates menu"| node_menu
node_game_loop -->|"updates entity"| node_player
node_game_loop -->|"renders world"| node_world_loader
node_game_loop -->|"renders HUD"| node_ui
node_game_loop -->|"sets game over"| node_game_state
node_player -->|"checks collision"| node_world_loader
node_player -->|"checks overlap"| node_enemy
node_player -->|"fires"| node_projectiles
node_player -->|"centers view"| node_camera
node_player -->|"sets game over"| node_game_state
node_world_loader -->|"builds map"| node_tiles
node_world_loader -->|"loads houses"| node_house
node_world_loader -->|"spawns enemies"| node_enemy
node_world_loader -->|"spawns items"| node_pickups
node_world_loader -.->|"spawns dog"| node_dog
node_world_loader -->|"checks door"| node_house
node_world_loader -->|"renders using"| node_camera
node_enemy -->|"checks collision"| node_world_loader
node_enemy -->|"detects hits"| node_projectiles
node_enemy -->|"removes self"| node_game_loop
node_dog -->|"checks collision"| node_world_loader
node_projectiles -->|"extends"| node_entity_base
node_player -->|"extends"| node_entity_base
node_enemy -->|"extends"| node_entity_base
node_dog -->|"extends"| node_entity_base
node_tiles -->|"gets sprites"| node_spritesheet
node_player -->|"gets sprites"| node_spritesheet
node_menu -->|"gets sprites"| node_spritesheet
node_game_loop -.->|"plays audio"| node_sound
node_game_loop -->|"supplies game state"| node_ui

click node_player "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/Player.java"
click node_menu "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/main/Menu.java"
click node_game_loop "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/main/Game.java"
click node_game_state "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/GameState.java"
click node_world_loader "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/World.java"
click node_house "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/House.java"
click node_tiles "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/Tile.java"
click node_camera "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/Camera.java"
click node_enemy "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/Enemy.java"
click node_dog "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/Dog.java"
click node_projectiles "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/BulletShoot.java"
click node_pickups "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/LifePack.java"
click node_entity_base "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/Entity.java"
click node_ui "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/graficos/UI.java"
click node_spritesheet "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/graficos/Spritesheet.java"
click node_sound "https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/main/Sound.java"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_menu,node_game_loop,node_game_state toneBlue
class node_world_loader,node_house,node_tiles,node_camera toneAmber
class node_player,node_enemy,node_dog,node_projectiles,node_pickups,node_entity_base toneMint
class node_ui,node_spritesheet,node_sound toneRose
class node_game_user toneIndigo
```

## Components

### Game flow

- [Menu and selection](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/main/Menu.java): `src/com/daugames/main/Menu.java`
- [Game loop](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/main/Game.java): `src/com/daugames/main/Game.java`
- [Game states](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/GameState.java): `src/com/daugames/world/GameState.java`

### World and collision

- [World loader](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/World.java): `src/com/daugames/world/World.java`
- [House and doors](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/House.java): `src/com/daugames/world/House.java`
- [Tiles and props](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/Tile.java): `src/com/daugames/world/Tile.java`
- [Camera](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/world/Camera.java): `src/com/daugames/world/Camera.java`

### Actors and combat

- [Player](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/Player.java): `src/com/daugames/entities/Player.java`
- [Enemies](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/Enemy.java): `src/com/daugames/entities/Enemy.java`
- [Dog companion](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/Dog.java): `src/com/daugames/entities/Dog.java`
- [Projectiles](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/BulletShoot.java): `src/com/daugames/entities/BulletShoot.java`
- [Pickups and weapons](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/LifePack.java): `src/com/daugames/entities/LifePack.java`
- [Entity base](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/entities/Entity.java): `src/com/daugames/entities/Entity.java`

### Presentation

- [HUD](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/graficos/UI.java): `src/com/daugames/graficos/UI.java`
- [Sprite assets](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/graficos/Spritesheet.java): `src/com/daugames/graficos/Spritesheet.java`
- [Audio](https://github.com/adautobenevides/game_retro/blob/main/src/com/daugames/main/Sound.java): `src/com/daugames/main/Sound.java`

### Other components

- **Player**

## Connections

- Player → Menu and selection: chooses character
- Menu and selection → Game loop: starts game
- Menu and selection → Player: creates player
- Menu and selection → World loader: loads house
- Game loop → Game states: checks state
- Game loop → Menu and selection: updates menu
- Game loop → Player: updates entity
- Game loop → World loader: renders world
- Game loop → HUD: renders HUD
- Game loop → Game states: sets game over
- Player → World loader: checks collision
- Player → Enemies: checks overlap
- Player → Projectiles: fires
- Player → Camera: centers view
- Player → Game states: sets game over
- World loader → Tiles and props: builds map
- World loader → House and doors: loads houses
- World loader → Enemies: spawns enemies
- World loader → Pickups and weapons: spawns items
- World loader → Dog companion: spawns dog
- World loader → House and doors: checks door
- World loader → Camera: renders using
- Enemies → World loader: checks collision
- Enemies → Projectiles: detects hits
- Enemies → Game loop: removes self
- Dog companion → World loader: checks collision
- Projectiles → Entity base: extends
- Player → Entity base: extends
- Enemies → Entity base: extends
- Dog companion → Entity base: extends
- Tiles and props → Sprite assets: gets sprites
- Player → Sprite assets: gets sprites
- Menu and selection → Sprite assets: gets sprites
- Game loop → Audio: plays audio
- Game loop → HUD: supplies game state
