/pixel-world
┌──────────────────────┐
│ ☁ ☀ ☁ │ 像素天空、山脉、草地和泥土
│ ┌──────────┐ │
│ │ 嗨教授! │ │ 位图字体中的对话气泡
│ └─▾────────┘ │
│ ▛▜ ▛▜ 🌳 │ 带描边的大方块角色
│ ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ │
│ 如果…… │ 1-2 个字幕
└──────────────────────┘
一个侧视角的 2D 世界,由大方块像素构成,灵感来自方块建造沙盒游戏。角色和外观均为原创,不复制任何游戏的美术作品。
首次使用
此技能的文件夹是 Claude Code 加载时显示的“基础目录”。
SKILL_DIR="<此技能的基础目录>"
KIT=$(python3 -c 'import os,sys;print(os.path.realpath(os.path.join(sys.argv[1],"..","..","kit")))' "$SKILL_DIR")
[ -s "$KIT/node_modules/playwright/package.json" ] || bash "$KIT/setup.sh"
需要 ffmpeg、Node 和 Chrome 或 Chromium。如果未安装 Playwright 自带的浏览器,请设置 CHROME=/path/to/chrome。不需要 WebGL:它使用纯 2D Canvas。
步骤
- 创意和角色。询问主题,然后确定其中有谁。每个角色是预设名称或自定义规格(见下文)。
- 脚本。编写
<name>.pixel.json:几个场景,每个 2 到 4 秒,每个场景一个节拍(设置、转折、收尾)。对话简短,每行不超过约 30 个字符。 - 检查外观。
python3 "$SKILL_DIR/build.py" <spec.json> --snap 0.5,3.5在同目录下生成 PNG 静态图像。在渲染之前查看它们。 - 渲染。
python3 "$SKILL_DIR/build.py" <spec.json>生成<name>.pixel.mp4和一张接触印相表<name>.pixel.sheet.jpg(大约实时时间的 1.2 倍)。 - 交付 mp4 路径。
将参考图片转换为角色
当用户发送图片或描述角色时,请将其转换为角色规格,而不是描摹。选择:肤色、hair 样式、发色、outfit、服装颜色、accent 颜色、裤子、鞋子以及最多几个 accessories。保持原创:借鉴理念(厚实身体、大头、简单面孔、大胆配色),绝不使用真实人物的肖像或游戏中的确切角色。
"cast": {
"mika": "mika",
"hero": { "preset": "bolt", "hair": "mohawk", "hairColor": "#38c172", "outfit": "hoodie", "outfitColor": "#6b3fd1",
"accessories": ["glasses", "scarf"], "accColor": "#ffd23f" }
}
- 预设:
mika、prof、ranger、agent、bolt、sage。"preset"复制一个预设并覆盖你提供的字段。 hair:bald、buzz、spiky、bowl、curly、long、mohawk、quiff。outfit:tee、hoodie、coat、suit、vest 以及engine/characters.js中的其他选项。accessories:glasses、sunglasses、cap、headband、beard、earring、scarf。accColor和beardColor为它们着色。- 尚不存在的样式(新帽子、头发、服装)是
engine/characters.js中的一个小函数(HAIR、OUTFIT、ACCESSORY),使用rect(g, colour, x, y, w, h)在像素网格上绘制。
规格
{
"world": { "sky": "day", "ground": 0.68, "props": [ { "type": "tree", "x": 20 }, { "type": "sign", "x": 150, "text": "HELLO" } ] },
"cast": { "mika": "mika", "prof": "prof" },
"scenes": [
{ "dur": 3.2, "scale": 8, "caption": "what if", "cam": { "x": 90 },
"actors": { "mika": { "x": 60, "to": 105, "move": [0.2, 2.2] }, "prof": { "x": 150, "face": -1 } },
"say": [ { "who": "mika", "text": "Hi professor!", "at": 0.3, "until": 2.4 } ] }
]
}
world.sky:day、sunset或night。ground:草线所在的位置(屏幕从上到下的 0 到 1)。props:tree、bush、flower、sign(text)、crate、fence(n)、rock、lamp、house。x是世界坐标;"front": true将其绘制在角色前面。scale:一个图片像素在屏幕上的大小:5、6、8、10 或 12。越大越厚实、越近,因此特写使用 10 或 12,宽镜头使用 6。cam:x是摄像机位置,to在场景中移动它,follow使演员保持在画面中。actors:x起始位置,to结束位置,move[start, end]为行走的秒数,face为 1 或 -1,do为idle、walk、run、wave、dance、jump或hit,at是动作开始的时间。say:对话气泡,who、text、at、可选的until。fx:像素特效(来自 pixelfx,共 171 种)。每个为{ "type": "fire/campfire", "x": 120, "at": 0.5 }:x是类似于道具的世界坐标,y将其提升(负值向上),at是其在场景中开始的时间,until在之后隐藏它,"front": true将其绘制在角色上方,palette(从暗到亮的十六进制颜色列表)为其重新着色。一次性特效(爆炸、击中)播放一次;循环特效(火焰、雨、萤火虫)持续播放。
特效
好的初次选择:fire/campfire、fire/torch、explosions/cartoon-pow、explosions/big-explosion、impacts/hit-spark、lightning/zap-hit、pickups/coin-spin、ui/confetti、ui/level-up、spawn/poof、weather/rain、weather/snow、arcane/portal、water/splash。将击中特效放在与角色 "do": "hit" 相同的 at 处。
- fire:brazier、campfire、candle、fire-breath、fire-tornado、fireball、flame-pillar、flamethrower、meteor、spirit-flame、torch
- explosions:barrel-explosion、big-explosion、cartoon-pow、dirt-explosion、firework-burst、firework-rocket、grenade、implosion、nuke、plasma-explosion、small-explosion、smoke-bomb
- water:bubbles、drip、fountain、geyser、rain-splash、ripples、splash、water-jet、water-orb、waterfall、wave-crash、whirlpool
- ice:blizzard-vortex、frost-breath、ice-crystal、ice-lance、ice-shatter、ice-spikes、icicle-fall、snowflake-burst
- lightning:ball-lightning、lightning-strike、plasma-ball、spark-arc、storm-cloud、tesla-coil、zap-hit
- scifi:emp-blast、energy-core、hologram、jetpack、laser-grid、teleporter-pad、tractor-beam
- impacts:blunt-hit、bullet-impact、crit-hit、ground-slam、hit-spark、impact-frame、parry、ricochet
- projectiles:arrow、bullet-tracer、cannonball、energy-disc、flare、homing-missile、laser-bolt、magic-missile、muzzle-pistol、muzzle-shotgun、muzzle-smg、plasma-shot、rocket
- spawn:coin-drop、egg-hatch、poof、spawn-portal、summon-rise
- arcane:arcane-orb、magic-circle-cast、mana-burst、portal、rune-circle、star-fall、time-stop
- holy:feather-burst、heal-aoe、holy-pillar、smite、sunburst
- shadow:black-hole、dark-explosion、eclipse、grasping-hands、hex-sigil、necro-skulls、shadow-flames、shadow-tendrils、soul-drain、void-orb
- nature:acid-splash、boulder、earth-spike、healing-bloom、poison-cloud、quake、spore-burst、thorns、tornado、toxic-puddle、vine-whip
- weather:aurora、blizzard、cherry-blossoms、clouds、falling-leaves、fireflies、fog、god-rays、rain、shooting-stars、snow、storm
- ui:achievement、coin-collect、combo-counter、confetti、countdown、crit-number、damage-number、health-bar-hit、heart-lost、quest-complete
- pickups:chest-open、coin-spin、collect-burst、crystal-shard、gem-spin、heart-pickup、key-glint、loot-beam、potion、power-star、xp-orb
- transitions:blinds、burn-away、crt-off、diamond-wipe、glitch-wipe、iris、pixel-dissolve、shatter-wipe、slash-wipe、star-iris
- critters:bat、bird、butterfly、eyeball、fish-school、flying-skull、frog、ghost、jellyfish、slime、snake、wisp
带来自有战士的特效(moves/ 集合以及一些近战、投射和击中特效)被排除,因为演员扮演角色。某些天气特效(fog、fireflies、god-rays、aurora)会为天空的一部分着色;请检查静态图像。
transition:"pixel"以块状溶解到下一个场景。- 场景的
caption是一或两个小写单词。 完整的示例位于examples/demo.pixel.json。
其他屏幕尺寸
每个技能渲染 9:16,然后可以将视频适配到任何画面中。添加到规格:
size:"16:9"、"1:1"、"4:5"、"4:3"、"21:9"或任何"WIDTHxHEIGHT",例如"1920x1080"。fill(可选):"blur"(默认,视频的模糊副本填充两侧)或一种颜色,如"#101010"。zoom(可选,默认为 1):大于 1 会放大图片并裁剪顶部和底部的安静边缘;在横向模式下,最高约 1.25 是安全的。检查顶部或底部的重要部分是否被裁剪。 接触印相表由 9:16 渲染生成。对于已有的视频:python3 "$KIT/resize.py" <video.mp4> --size 1920x1080 [--fill blur] [--zoom 1.2]。
品味
- 大头、每个角色颜色少、强烈的描边。让像素保持厚实。
- 每个场景一个想法、每个节拍一个气泡、仅在重大转折时使用像素转场。
- 保持文本简短,能在两秒内读完。