# facundodlf/6thweek---canvas-game architecture

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

- Interactive diagram: https://gitdiagram.com/facundodlf/6thweek---canvas-game
- Repository: https://github.com/facundodlf/6thweek---canvas-game

## Overview

This repository is a browser-based canvas game. The player uses the keyboard to control a moving character, collect food and bonuses, avoid hazards, and see the score and game state rendered on the canvas. The sampled game.js implements input handling, game rules, timing, and drawing in one runtime module; it also loads the listed audio assets. The HTML entry point and page structure are present in the tree but were not sampled, so their wiring is not shown.

Main entry points: [`game.js`](https://github.com/facundodlf/6thweek---canvas-game/blob/master/game.js) (Game logic and rendering), [`assets/chomp.oga`](https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/chomp.oga) (Food sound), [`assets/dies.oga`](https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/dies.oga) (Death sound), [`assets/bonus.oga`](https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/bonus.oga) (Bonus sound)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_game["Game logic and rendering<br/>[game.js]"]
end

subgraph group_audio["Audio assets"]
  node_eat_sound["Food sound<br/>[chomp.oga]"]
  node_death_sound["Death sound<br/>[dies.oga]"]
  node_bonus_sound["Bonus sound<br/>[bonus.oga]"]
  node_music["Game music<br/>[monkeysong.oga]"]
end

node_player(("Player"))
node_browser["Browser canvas"]

node_player -->|"presses keys"| node_game
node_game -->|"draws canvas"| node_browser
node_game -->|"loads and plays"| node_eat_sound
node_game -->|"loads and plays"| node_death_sound
node_game -->|"loads and plays"| node_bonus_sound
node_game -->|"loads and plays"| node_music

click node_game "https://github.com/facundodlf/6thweek---canvas-game/blob/master/game.js"
click node_eat_sound "https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/chomp.oga"
click node_death_sound "https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/dies.oga"
click node_bonus_sound "https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/bonus.oga"
click node_music "https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/monkeysong.oga"

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_game,node_browser toneBlue
class node_eat_sound,node_death_sound,node_bonus_sound,node_music toneAmber
class node_player toneIndigo
```

## Components

### Game runtime

- [Game logic and rendering](https://github.com/facundodlf/6thweek---canvas-game/blob/master/game.js): `game.js`

### Audio assets

- [Food sound](https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/chomp.oga): `assets/chomp.oga`
- [Death sound](https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/dies.oga): `assets/dies.oga`
- [Bonus sound](https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/bonus.oga): `assets/bonus.oga`
- [Game music](https://github.com/facundodlf/6thweek---canvas-game/blob/master/assets/monkeysong.oga): `assets/monkeysong.oga`

### Other components

- **Player**
- **Browser canvas**

## Connections

- Player → Game logic and rendering: presses keys (evidence: `game.js`)
- Game logic and rendering → Browser canvas: draws canvas (evidence: `game.js`)
- Game logic and rendering → Food sound: loads and plays (evidence: `game.js`)
- Game logic and rendering → Death sound: loads and plays (evidence: `game.js`)
- Game logic and rendering → Bonus sound: loads and plays (evidence: `game.js`)
- Game logic and rendering → Game music: loads and plays (evidence: `game.js`)
