Skip to content
Back to skills

Structure A Game

ASecurity

BLIT386 draws pixels, reads input, and plays sound. It does NOT include physics, collision, enemies, or a scene system - you write that game logic yourself. This skill shows the shape to put it in.

  • 17 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added November 7, 2026
developmentaws

Works with

  • cli

Security analysis

A100/100

Scanned November 24, 2026

npx -y skills add blit386/blit386 --skill structure-a-game --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Structure A Game?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Structure A Game
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/blit386-structure-a-game/badge)](https://www.skillsdirectory.com/skills/blit386-structure-a-game)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: structure-a-game
description:
  Show the shape of a BLIT386 game (configure, init, update, render) and set the expectation that the engine draws,
  reads input, and plays sound while you write physics, collision, enemies, and scenes yourself. Use when starting a new
  game or when the user asks how to add a player, collision, or enemies and might expect built-in systems.
---

# Structure a game

BLIT386 draws pixels, reads input, and plays sound. It does NOT include physics, collision, enemies, or a scene system -
you write that game logic yourself. This skill shows the shape to put it in.

## The shape of a game

```js
import { bootstrap, BT, Color32, Rect2i, Vector2i } from 'blit386';

class Game {
  // configure() {}            // optional; omit for a 320x240 screen at 60 FPS
  async init() {
    // load assets and set up colors once; return true on success
    this.player = new Rect2i(150, 110, 16, 16);
    return true;
  }
  update() {
    // YOUR logic: read input, move things, check collisions, change state
  }
  render() {
    // draw the current state; do not change logic here
  }
}

bootstrap(Game);
```

## You build these yourself

- Movement: change your own numbers in `update()`. The engine never moves anything for you.
- Collision: there is no physics. Test overlap yourself with `Rect2i.isIntersecting(other)`.
- Restart: reset your own variables. `BT.ticksReset()` zeroes the frame counter if you time things off `BT.ticks`.

```js
if (this.player.isIntersecting(this.coin)) {
  this.score += 1;
}
```

## The engine does provide these

- Drawing: shapes, sprites, text, and the palette.
- Input: keyboard, pointer, and gamepad.
- Sound: a bus mixer, loadable clips, looping music, and a synth that builds retro sounds from nothing (see the
  play-a-sound skill).

## Notes

- `update()` decides; `render()` draws. Keep them apart (see `docs/basics.md`).
- The engine runs on WebGPU and falls back to plain Canvas 2D, so a game always renders. Only fullscreen post-process
  effects need WebGPU (see the add-crt-effect skill); sound works on both.
- Optional `onHotReload(context)` can restore fields after an `init()` edit while the Vite plugin keeps the session
  alive - see the use-hot-reload skill and `docs/hot-reload.md`.

See `docs/basics.md`.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in development →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.