Pixel Learning Game (general)
Build offline, single-file learning games with pixel-art assets.
Designed to share with friends who use Hermes / Claude / Cursor — no school names, no private paths.
When to Use
- Friend/learner wants a pixel-art study game (match, quiz, collect, shop loop…)
- Need a reproducible art → game pipeline (not one-shot AI photos)
- Single HTML file for classroom / share link / GitHub Pages
Don't use for: photoreal/Ghibli scenes; complex multiplayer; pure photo→pixel (pixel-art skill).
Stack (locked simple)
| Layer | Choice |
|---|---|
| Game | One index.html (HTML+CSS+JS). Zero npm for runtime. |
| Art | pxl-pixel-art → .px.js → PNG / sheet / base64 |
| Host | Local double-click or GitHub Pages |
| Audio | Optional WebAudio beeps / speechSynthesis |
Requires: Node ≥ 22.18 only when building sprites. Players need a browser only.
Pedagogy loop (always)
Cover → Choose task → Act → Feedback → Retry / Next → Certificate(optional)
| Rule | Why |
|---|---|
| One learning goal per mode | Split “math skill” vs “value/behavior” if both exist |
| Big hit targets | Buttons ≥ ~48px; prefer tap over tiny drag |
| Few words | Icons + 1 short line; TTS optional |
| Wrong ≠ shame | Neutral teach copy; avoid red punish titles |
| Stars only for the real goal | Don’t auto-star every click |
| No cross-session student data | Avoid localStorage if shared devices (or clear on cover) |
| Delay spoilers | Don’t flash correct before the learner answers |
Project layout
my-game/
index.html # game (ship this)
art.px.js # pixel source (edit this)
out/ # pxl build output (gitignore OK)
assets/ # optional exported PNGs
README.md
Start from templates/ in this skill.
Workflow
1) Copy template
SKILL="$HOME/.hermes/skills/creative/pixel-learning-game"
mkdir -p ~/games/my-pixel-quiz && cd ~/games/my-pixel-quiz
cp "$SKILL/templates/index.html" .
cp "$SKILL/templates/art.px.js" .
cp "$SKILL/templates/README.md" .
2) Draw sprites (pxl)
PXL="$HOME/.hermes/skills/creative/pxl-pixel-art/bin/pxl.js"
node "$PXL" build art.px.js --out ./out
node "$PXL" ascii art.px.js slime # geometry check; don't rely on vision
Rules of thumb:
- Silhouette first (
mx+outline), glow last - 1 signature feature per character so upscaled cards stay distinct
- Rebuild with
--only namewhile iterating; full build before ship - In-game: CSS
image-rendering: pixelated— upscale display, keep source small
3) Wire art into HTML
A. External PNG (multi-file OK offline if same folder):
<img class="px" src="out/sprites/slime.png" alt="slime" />
.px { image-rendering: pixelated; width: 96px; height: auto; }
B. Single-file Pages (recommended for share): embed base64 after build.
python3 - <<'PY'
import base64, pathlib
p = pathlib.Path("out/sprites/slime.png")
b64 = base64.b64encode(p.read_bytes()).decode()
print(f"const SPR = {{ slime: 'data:image/png;base64,{b64}' }};")
PY
Paste into index.html. Every art change → rebuild → re-embed.
4) Implement the loop in HTML
Minimum screens:
cover— title + Startplay— question / pick / actresult— short feedback- optional
cert— name + stars + print
Use a tiny state machine:
const state = { screen: "cover", score: 0, index: 0 };
function go(name) {
state.screen = name;
document.querySelectorAll("[data-screen]").forEach((el) => {
el.hidden = el.dataset.screen !== name;
});
}
5) Ship
# local
open index.html
# GitHub Pages (friend can copy)
git init -b main
echo out/ >> .gitignore
git add index.html art.px.js README.md assets 2>/dev/null
git commit -m "feat: pixel learning game v1"
# gh repo create my-pixel-quiz --public --source=. --remote=origin --push
# enable Pages: branch main / root
Done when: double-click works offline; sprites readable at game size; one full loop playable; wrong path teaches without shame.
Starter content ideas
| Mode | Learner does | Pixel need |
|---|---|---|
| Match | Pick same item as card | item sprites × N |
| Shape shop | Take only listed shapes | shape props + player |
| Quiz STG | Answer to shoot theme enemy | 3 enemies + FX |
| Collect | Gather N coins, avoid junk | hero + coin + junk |
Keep one mode working before adding a second.
Pair skills
| Skill | Role |
|---|---|
pxl-pixel-art | Author sprites as code (required) |
pixel-art | Photo → retro (optional mood art only) |
gamedev-feel | Light juice (shake ≤4–8px, hit-stop, SFX) — never hide answers |
single-file-canvas-game | If you go full Canvas FSM / bullets |
Common pitfalls
- AI photo as main gameplay icon — style drift + uneditable. Prefer pxl.
- Shame feedback — “你好蠢/錯晒” kills learning games.
- Star spam — stars must mean the goal behavior.
localStorageon shared tablets — next student inherits progress.- Updated PNG, stale base64 — always re-embed for single-file.
- Tiny text, tiny hitboxes — fail on touch devices.
- Confusing
pixel-artvspxl-pixel-art— former converts photos; latter authors.px.js. - Glow before silhouette — unreadable blobs.
- npm runtime deps — breaks offline classroom share.
Verification checklist
-
node $PXL build art.px.js --out ./outexits 0 -
out/sprites/*.pngexist; silhouette OK inascii -
index.htmlfull loop: start → act → feedback → retry - Offline: open file:// or local static server works
- Touch targets large; no essential hover-only UI
- Wrong answer shows teach line, not only red X
- If single-file: base64 matches latest build
Templates in this skill
templates/index.html— minimal match quiz shell + pixel CSStemplates/art.px.js— slime / coin / heart starter packtemplates/README.md— friend-facing short guidereferences/pedagogy.md— deeper learning rulesreferences/canvas-pixel.md— canvas/DOM pixel tips
Install (friend)
See root INSTALL.md of the shared pack repo, or:
# if they use Hermes
mkdir -p ~/.hermes/skills/creative
# copy pixel-learning-game/ and pxl-pixel-art/ into that folder
# new chat session → skill_view name=pixel-learning-game
Without Hermes: open SKILL.md + templates/ and follow Workflow manually (any AI agent can read the markdown).