# ruirocha1991/projetofinal-phaser architecture

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

- Interactive diagram: https://gitdiagram.com/ruirocha1991/projetofinal-phaser
- Repository: https://github.com/ruirocha1991/projetofinal-phaser

## Overview

This is a Phaser game whose workflow runs from initialization and asset loading through an animated introduction, menu, arcade gameplay, and a results screen; replay returns to gameplay. Gameplay covers the player, map, hazards, coin collection, scoring, and hit counts. The excerpts show state transitions and selected gameplay calls, but not the browser entry point or the full update loop, so those links are omitted.

Main entry points: [`js/oJogo.js`](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js) (Gameplay state), [`js/preload.js`](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/preload.js) (Asset preload), [`js/init.js`](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/init.js) (Initialize), [`js/apre.js`](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/apre.js) (Introduction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and assets"]
  node_init["Initialize<br/>[init.js]"]
  node_preload["Asset preload<br/>[preload.js]"]
  node_assets["Game assets"]
end

subgraph group_screens["Game screens"]
  node_intro["Introduction<br/>[apre.js]"]
  node_menu["Main menu<br/>[menu.js]"]
  node_results["Results screen<br/>[end.js]"]
end

subgraph group_runtime["Gameplay runtime"]
  node_gameplay["Gameplay state<br/>[oJogo.js]"]
  node_world["World setup<br/>[oJogo.js]"]
  node_player_control["Player control<br/>[oJogo.js]"]
  node_hazards["Hazard firing<br/>[oJogo.js]"]
  node_collection["Coin scoring<br/>[oJogo.js]"]
end

node_player(("Player"))
node_phaser["Phaser engine"]

node_player -->|"starts"| node_init
node_init -->|"starts"| node_preload
node_preload -->|"loads"| node_assets
node_preload -->|"starts"| node_intro
node_intro -->|"starts"| node_menu
node_menu -->|"starts"| node_gameplay
node_results -->|"restarts"| node_gameplay
node_gameplay -->|"sends score"| node_results
node_gameplay -->|"calls setup"| node_world
node_gameplay -->|"calls setup"| node_player_control
node_gameplay -->|"dispatches fire"| node_hazards
node_player_control -.->|"collects coins"| node_collection
node_gameplay -->|"uses engine"| node_phaser

click node_init "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/init.js"
click node_preload "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/preload.js"
click node_assets "https://github.com/ruirocha1991/projetofinal-phaser/tree/master/assets"
click node_intro "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/apre.js"
click node_menu "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/menu.js"
click node_gameplay "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js"
click node_world "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js"
click node_player_control "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js"
click node_hazards "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js"
click node_collection "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js"
click node_results "https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/end.js"

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_init,node_preload,node_assets toneBlue
class node_intro,node_menu,node_results toneAmber
class node_gameplay,node_world,node_player_control,node_hazards,node_collection toneMint
class node_player,node_phaser toneIndigo
```

## Components

### Startup and assets

- [Initialize](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/init.js): `js/init.js`
- [Asset preload](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/preload.js): `js/preload.js`
- [Game assets](https://github.com/ruirocha1991/projetofinal-phaser/tree/master/assets): `assets`

### Game screens

- [Introduction](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/apre.js): `js/apre.js`
- [Main menu](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/menu.js): `js/menu.js`
- [Results screen](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/end.js): `js/end.js`

### Gameplay runtime

- [Gameplay state](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js): `js/oJogo.js`
- [World setup](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js): `js/oJogo.js`
- [Player control](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js): `js/oJogo.js`
- [Hazard firing](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js): `js/oJogo.js`
- [Coin scoring](https://github.com/ruirocha1991/projetofinal-phaser/blob/master/js/oJogo.js): `js/oJogo.js`

### Other components

- **Player**
- **Phaser engine**

## Connections

- Player → Initialize: starts (evidence: `js/init.js`)
- Initialize → Asset preload: starts (evidence: `js/init.js`)
- Asset preload → Game assets: loads (evidence: `js/preload.js`)
- Asset preload → Introduction: starts (evidence: `js/preload.js`)
- Introduction → Main menu: starts (evidence: `js/apre.js`)
- Main menu → Gameplay state: starts (evidence: `js/menu.js`)
- Results screen → Gameplay state: restarts (evidence: `js/end.js`)
- Gameplay state → Results screen: sends score (evidence: `js/oJogo.js`)
- Gameplay state → World setup: calls setup (evidence: `js/oJogo.js`)
- Gameplay state → Player control: calls setup (evidence: `js/oJogo.js`)
- Gameplay state → Hazard firing: dispatches fire (evidence: `js/oJogo.js`)
- Player control → Coin scoring: collects coins (evidence: `js/oJogo.js`)
- Gameplay state → Phaser engine: uses engine (evidence: `js/oJogo.js`)
