consolidate single color sprites into one master file

This commit is contained in:
Your Name 2026-08-22 11:44:51 -04:00
parent 7d84f595e4
commit fe5a11112f
16 changed files with 90 additions and 53 deletions

View file

@ -51,10 +51,10 @@ The player is not one entity — it is **up to three simultaneous colored copies
## Art pipeline
Sprites are authored in full color, then split into per-channel `_r`/`_g`/`_b` PNGs so each color copy draws its own layer. The `art/*.sh` scripts drive this with ImageMagick `convert`:
- `reduce_colors.sh <file>` — remap to `art/palette`/`palette.png`.
- `extract.sh <file>` — split one image into R/G/B channel PNGs.
- `reduce_and_extract.sh` — both steps over every PNG in the cwd (run from inside an `art/` subfolder).
**One full-color master PNG per sprite.** The RGB channels are split at *load time*, not stored as separate files: `getAllAssets` (`level_editor/object_attributes.lua`) points all three of `sprites.{red,green,blue}` at the same master, and `Entity:draw(channel)` tints it through `gColor[channel]` — so `master × (1,0,0)` renders the red gun, and the additive `"screen"` blend recombines overlapping copies into the original color. Per-channel collision shapes come from `getChannelCells` (`_helpers.lua`), which inspects each channel of the master's ImageData. Adding a sprite (or a new sprite *state*) is now one file, not three.
- `getAllAssets` treats every master PNG in a non-`_`-prefixed content folder as a placeable color asset, except the names in its `NON_ASSET_SPRITES` set (the palette swatch and sprites owned by dedicated classes like `player_*`, `door_unlocked`, `switch_pressed`).
- The `_r`/`_g`/`_b` channel-splitting step is gone (older revisions had an `extract.sh`; the pre-split channel PNGs live in git history if ever needed).
- `reduce_colors.sh <file>` / `reduce_and_extract.sh` — optional palette remap to `art/palette.png` (authoring step only; produces a master, no split).
## Bundled libraries (`libs/`, do not edit)