mrpquest/tools/gen_items.py
type-two 3241b6f14d MORPQUEST: Record Store Day — a Beyond Morp graphical adaptation
Fourteen EGA screens for MRPGI: nano banana backgrounds squeezed into the
engine's 160x168 double-wide-pixel frame, hand-pixelled item sprites, the
full RSD flag chain (poster frenzy -> yard door secret -> roof -> side door
-> clerk favours -> back-room seam -> payment -> notice -> BeckyWall
dispersal), the five-word true ending, and two scripted test paths (golden
win + gate locks), both green.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-05 14:56:30 +10:00

124 lines
2.0 KiB
Python

#!/usr/bin/env python3
"""Tiny takeable-item sprites, hand-placed pixels -> sprites/*.png.
Deterministic and free; nano banana is for backgrounds and people.
Letters index the EGA palette (hex 0-F), '.' = transparent."""
import os
from PIL import Image
EGA = [(0,0,0),(0,0,170),(0,170,0),(0,170,170),(170,0,0),(170,0,170),
(170,85,0),(170,170,170),(85,85,85),(85,85,255),(85,255,85),
(85,255,255),(255,85,85),(255,85,255),(255,255,85),(255,255,255)]
SPRITES = {
'paperclip': """
.77777.
7.....7
7.777.7
7.7...7
.77777.
""",
'keys': """
.777.....
7...7....
7...7EEEE
7...7E.EE
.777..EE.
""",
'wallet': """
6666666666
6888888886
6666666666
6666666666
6666666686
6666666666
""",
'adapter': """
.EEEEE.
EE...EE
E..7..E
E.777.E
E..7..E
EE...EE
.EEEEE.
""",
'elastic': """
.666666.
6......6
6......6
.666666.
""",
'lollipop': """
.CCC.
CCCCC
CCCCC
.CCC.
..F..
..F..
..F..
""",
'sleeve': """
7777777777
7FFFFFFFF7
7FFF77FFF7
7FF7..7FF7
7FF7..7FF7
7FFF77FFF7
7FFFFFFFF7
7777777777
""",
'notice': """
FFFFFFFF
F777777F
FFFFFFFF
F777777F
FFFFFFFF
F77CC77F
FFFCC7FF
FFFFFFFF
F777777F
FFFFFFFF
""",
'whitelabel': """
..000000..
.00000000.
0000000000
000FFFF000
000FFFF000
0000000000
.00000000.
..000000..
""",
'tote': """
..3...3..
.3.3.3.3.
..33333..
.3333333.
.3333333.
.3333333.
.3333333.
..33333..
""",
'disc': """
..000000..
.00000000.
000CCCC000
000CCCC000
.00000000.
..000000..
""",
}
out_dir = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), 'sprites')
os.makedirs(out_dir, exist_ok=True)
for name, grid in SPRITES.items():
rows = [r for r in grid.strip().splitlines()]
w, h = max(len(r) for r in rows), len(rows)
img = Image.new('RGBA', (w, h), (0, 0, 0, 0))
px = img.load()
for y, row in enumerate(rows):
for x, ch in enumerate(row):
if ch != '.':
px[x, y] = EGA[int(ch, 16)] + (255,)
img.save(os.path.join(out_dir, f'{name}.png'))
print(name, f'{w}x{h}')