# yaroslav-ua02/el-pollo-loco architecture

> Architecture diagram of the GitHub repository yaroslav-ua02/el-pollo-loco, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-16). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/yaroslav-ua02/el-pollo-loco
- Repository: https://github.com/yaroslav-ua02/el-pollo-loco

## Overview

El Pollo Loco is a browser-based canvas platform game: the player starts a round, moves Pepe through a desert level, collects coins and bottles, fights chickens and the endboss, and reaches a win/loss screen. The graph covers level content, gameplay and rendering, browser controls, and audio. Edges are limited to relationships shown in excerpts or documented in the README; several wiring details in unsampled source are omitted or marked unverified.

Main entry points: [`classes/world.class.js`](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/world.class.js) (Game world), [`script.js`](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/script.js) (Controls and session), [`levels/level1.js`](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/levels/level1.js) (Level layout), [`classes/movable-object.class.js`](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/movable-object.class.js) (Movement and collision)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browser["Browser experience"]
  node_page["Game page<br/>[index.html]"]
  node_controls["Controls and session<br/>[script.js]"]
  node_end_screen["End screen"]
  node_game_state["Pause state"]
  node_keyboard["Keyboard state<br/>[keyboard.class.js]"]
end

subgraph group_gameplay["Gameplay"]
  node_level["Level layout<br/>[level1.js]"]
  node_character["Pepe<br/>[character.class.js]"]
  node_enemies["Enemies and boss<br/>[endboss.class.js]"]
  node_small_chicken["Small chickens"]
  node_collectibles["Coins and bottles<br/>[level1.js]"]
  node_thrown_bottle["Thrown bottle"]
  node_physics["Movement and collision"]
end

subgraph group_world["World and rendering"]
  node_world["Game world<br/>[world.class.js]"]
  node_canvas_objects["Canvas objects"]
  node_status["Status bars"]
  node_background["Background and clouds"]
end

subgraph group_assets["Audio and visuals"]
  node_sound["Sound board"]
end

node_player(("Player"))

node_player -->|"plays"| node_page
node_page -.->|"starts session"| node_controls
node_controls -.->|"creates world"| node_world
node_controls -->|"starts music"| node_sound
node_controls -->|"renders result"| node_end_screen
node_controls -->|"resets or pauses"| node_game_state
node_controls -->|"updates controls"| node_keyboard
node_world -->|"creates level"| node_level
node_world -->|"owns character"| node_character
node_world -->|"creates bars"| node_status
node_world -->|"creates bottle"| node_thrown_bottle
node_world -->|"checks collisions"| node_enemies
node_world -->|"draws objects"| node_canvas_objects
node_world -->|"plays throw sound"| node_sound
node_level -->|"creates enemies"| node_enemies
node_level -->|"creates small chickens"| node_small_chicken
node_level -->|"places collectibles"| node_collectibles
node_character -->|"inherits movement"| node_physics
node_small_chicken -->|"uses movement"| node_physics
node_enemies -->|"inherits collision"| node_physics
node_thrown_bottle -->|"inherits gravity"| node_physics
node_thrown_bottle -->|"plays splash sound"| node_sound
node_canvas_objects -.->|"provides draw base"| node_background
node_world -.->|"draws scenery"| node_background
node_world -.->|"renders level items"| node_collectibles

click node_page "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/index.html"
click node_controls "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/script.js"
click node_end_screen "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/templates/screens.template.js"
click node_sound "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/sound-board.class.js"
click node_world "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/world.class.js"
click node_level "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/levels/level1.js"
click node_character "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/character.class.js"
click node_enemies "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/endboss.class.js"
click node_small_chicken "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/small-chicken.class.js"
click node_collectibles "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/levels/level1.js"
click node_thrown_bottle "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/throwable-object.class.js"
click node_physics "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/movable-object.class.js"
click node_canvas_objects "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/drawable-object.class.js"
click node_status "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/status-bar.class.js"
click node_background "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/background-object.class.js"
click node_game_state "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/game-state.class.js"
click node_keyboard "https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/keyboard.class.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_page,node_controls,node_end_screen,node_game_state,node_keyboard toneBlue
class node_level,node_character,node_enemies,node_small_chicken,node_collectibles,node_thrown_bottle,node_physics toneAmber
class node_world,node_canvas_objects,node_status,node_background toneMint
class node_sound toneRose
class node_player toneIndigo
```

## Components

### Browser experience

- [Game page](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/index.html): `index.html`
- [Controls and session](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/script.js): `script.js`
- [End screen](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/templates/screens.template.js): `templates/screens.template.js`
- [Pause state](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/game-state.class.js): `classes/game-state.class.js`
- [Keyboard state](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/keyboard.class.js): `classes/keyboard.class.js`

### Gameplay

- [Level layout](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/levels/level1.js): `levels/level1.js`
- [Pepe](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/character.class.js): `classes/character.class.js`
- [Enemies and boss](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/endboss.class.js): `classes/endboss.class.js`
- [Small chickens](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/small-chicken.class.js): `classes/small-chicken.class.js`
- [Coins and bottles](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/levels/level1.js): `levels/level1.js`
- [Thrown bottle](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/throwable-object.class.js): `classes/throwable-object.class.js`
- [Movement and collision](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/movable-object.class.js): `classes/movable-object.class.js`

### World and rendering

- [Game world](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/world.class.js): `classes/world.class.js`
- [Canvas objects](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/drawable-object.class.js): `classes/drawable-object.class.js`
- [Status bars](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/status-bar.class.js): `classes/status-bar.class.js`
- [Background and clouds](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/background-object.class.js): `classes/background-object.class.js`

### Audio and visuals

- [Sound board](https://github.com/yaroslav-ua02/el-pollo-loco/blob/main/classes/sound-board.class.js): `classes/sound-board.class.js`

### Other components

- **Player**

## Connections

- Player → Game page: plays (evidence: `README.md`)
- Game page → Controls and session: starts session
- Controls and session → Game world: creates world
- Controls and session → Sound board: starts music (evidence: `script.js`)
- Controls and session → End screen: renders result (evidence: `script.js`)
- Controls and session → Pause state: resets or pauses (evidence: `script.js`)
- Controls and session → Keyboard state: updates controls (evidence: `script.js`)
- Game world → Level layout: creates level (evidence: `classes/world.class.js`)
- Game world → Pepe: owns character (evidence: `classes/world.class.js`)
- Game world → Status bars: creates bars (evidence: `classes/world.class.js`)
- Game world → Thrown bottle: creates bottle (evidence: `classes/world.class.js`)
- Game world → Enemies and boss: checks collisions (evidence: `classes/world.class.js`)
- Game world → Canvas objects: draws objects (evidence: `classes/world.class.js`)
- Game world → Sound board: plays throw sound (evidence: `classes/world.class.js`)
- Level layout → Enemies and boss: creates enemies (evidence: `levels/level1.js`)
- Level layout → Small chickens: creates small chickens (evidence: `levels/level1.js`)
- Level layout → Coins and bottles: places collectibles (evidence: `levels/level1.js`)
- Pepe → Movement and collision: inherits movement (evidence: `classes/character.class.js`)
- Small chickens → Movement and collision: uses movement (evidence: `classes/small-chicken.class.js`)
- Enemies and boss → Movement and collision: inherits collision (evidence: `classes/endboss.class.js`)
- Thrown bottle → Movement and collision: inherits gravity (evidence: `classes/throwable-object.class.js`)
- Thrown bottle → Sound board: plays splash sound (evidence: `classes/throwable-object.class.js`)
- Canvas objects → Background and clouds: provides draw base
- Game world → Background and clouds: draws scenery
- Game world → Coins and bottles: renders level items
