--- license: mit tags: - game-development - html5 - canvas - tutorial size_categories: - n<1K --- # single-file-html5-games Tiny, dependency-free HTML5 canvas games and a starter template. Every game is one self-contained `.html` file: no build step, no assets, no libraries. Open in a browser and play, or read the source top to bottom in a few minutes. ## Contents | File | What it is | | --- | --- | | `template.html` | Commented starter template: config block, input handling, main loop. Copy it and write your own `update()` / `draw()`. | | `gravity-well.html` | Worked example: a complete 10-level gravity slingshot puzzle game built from the same skeleton. Playable at https://boundbomb.itch.io/gravity-well | ## Why single-file? - Runs anywhere a browser does, including itch.io HTML5 projects (zip the file as `index.html`). - Nothing to install for players or for you. - Easy to fork: one file to read, one file to change. ## Usage 1. Copy `template.html` to `index.html`. 2. Edit the `CONFIG` block, then `update(dt)` and `draw()`. 3. Open the file in a browser. Done. ## License MIT. Do whatever you want; attribution appreciated but not required. --- ## 日本語 依存ゼロ・ビルド不要の単一ファイル HTML5 キャンバスゲーム集です。 `template.html` が解説付きの雛形、`gravity-well.html` がその雛形から作った 完成例(10レベルの重力スリングショット・パズル)です。 ファイルをコピーして `update()` と `draw()` だけ書き換えれば、自分のミニゲームが作れます。 ライセンスは MIT。自由にお使いください。