From 63e9741816ce3717cfda4cc3354ff3a0860a3ddc Mon Sep 17 00:00:00 2001 From: "Somhairle H. Marisol" Date: Mon, 21 Sep 2026 20:22:25 +0800 Subject: feat(art): 角色六帧动画与水面/炊烟三相循环 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 角色图集每个 (变体,方向) 由 2 帧扩到 6 帧(4 走路 + 2 待机呼吸), cellIndex=(variant*4+direction)*6+frame,图集 3840x48 - 世界图集扩到 25 格 800x32:水面第 3 相 WaterSpriteC(slot 21)、 炊烟三帧 SmokeSpriteA/B/C(slot 22-24) - 帧选择为纯函数:walk=(tick/4)%4、idle=(tick/24)%2、 water=(tick/32)%3、smoke=(tick/40)%3 - 重生成 jiangnan/cc0 图集(脚本可复现,逐字节一致) --- scripts/make-jiangnan-art.py | 146 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 139 insertions(+), 7 deletions(-) (limited to 'scripts/make-jiangnan-art.py') diff --git a/scripts/make-jiangnan-art.py b/scripts/make-jiangnan-art.py index c484d91..2e1dee0 100644 --- a/scripts/make-jiangnan-art.py +++ b/scripts/make-jiangnan-art.py @@ -2,8 +2,8 @@ """Deterministic pixel-art atlases for LivingVillage.Desktop. Generates three RGBA PNGs into src/LivingVillage.Desktop/Assets: - jiangnan-world.png 672x32 (21 ground/prop tiles, 32px each) - jiangnan-characters.png 2560x48 (5 variants x 4 directions x 4 frames, 32x48 cells) + jiangnan-world.png 800x32 (25 ground/prop tiles, 32px each) + jiangnan-characters.png 3840x48 (5 variants x 4 directions x 6 frames, 32x48 cells) jiangnan-interior.png 392x96 (variable-size bottom-aligned interior cells) Cell geometry is mirrored in VillageArt.fs; keep both in sync. @@ -99,7 +99,7 @@ def verify_png(path, expected_w, expected_h): def build_world_atlas(): - c = Canvas(672, 32) + c = Canvas(800, 32) tile = 32 def slot(index): @@ -430,6 +430,50 @@ def build_world_atlas(): c.rect(x0 + 14, 25, 4, 3, lantern_rib) c.outline(x0, 0, 32, 32) + # Third water ripple phase (slot 21): highlights and deeps shifted one row so the + # three frames read as a moving surface when cycled by waterFrameTick. + x0 = slot(21) + c.rect(x0, 0, 32, 32, water) + c.rect(x0 + 8, 5, 2, 24, water_deep) + c.rect(x0 + 23, 2, 2, 28, water_deep) + for y in (7, 18, 27): + for x in range(3, 29): + if (x * 3 + y) % 5 != 0: + c.set(x0 + x, y, water_light) + for y in (12, 23): + for x in range(5, 27): + if (x + y * 2) % 6 == 0: + c.set(x0 + x, y, water_deep) + for sx, sy in ((12, 4), (27, 11), (18, 22), (8, 17)): + c.set(x0 + sx, sy, (214, 231, 238, 255)) + c.set(x0 + sx + 1, sy, (214, 231, 238, 120)) + + # Chimney smoke, three frames (slots 22-24): a puff rising and thinning above the roof. + smoke_puff = (214, 218, 222, 190) + smoke_mid = (190, 196, 202, 150) + smoke_faint = (170, 178, 186, 110) + + def puff(cx, cy, rx, ry, color): + for py in range(cy - ry, cy + ry + 1): + for px in range(cx - rx, cx + rx + 1): + if ((px - cx) * (px - cx)) * 2 + ((py - cy) * (py - cy)) * 3 <= rx * ry * 2: + c.set(px, py, color) + + x0 = slot(22) + puff(x0 + 15, 26, 5, 4, smoke_mid) + puff(x0 + 16, 21, 4, 3, smoke_puff) + puff(x0 + 15, 17, 2, 2, smoke_mid) + + x0 = slot(23) + puff(x0 + 16, 20, 6, 5, smoke_mid) + puff(x0 + 15, 13, 5, 4, smoke_puff) + puff(x0 + 17, 7, 3, 2, smoke_faint) + + x0 = slot(24) + puff(x0 + 17, 13, 6, 5, smoke_faint) + puff(x0 + 15, 6, 5, 4, smoke_mid) + puff(x0 + 18, 2, 3, 2, smoke_faint) + return c @@ -536,14 +580,102 @@ def draw_character_cell(c, ox, variant, direction, frame): c.outline(ox, 0, 32, 48) +def draw_character_idle_cell(c, ox, variant, direction, phase): + # phase: 0 relaxed exhale, 1 inhale (upper body raised 1px). Feet stay planted so the + # two poses read as a quiet breath rather than a step. + robe = variant["robe"] + light = variant["light"] + dark = variant["dark"] + extra = variant.get("extra") + hat = (196, 158, 74, 255) + hat_light = (228, 197, 112, 255) + hat_dark = (168, 132, 58, 255) + lift = 1 if phase else 0 + + c.rect(ox + 8, 44, 16, 1, (23, 31, 34, 110)) + c.rect(ox + 10, 45, 12, 1, (23, 31, 34, 90)) + + c.rect(ox + 10, 36, 4, 7, dark) + c.rect(ox + 9, 42, 6, 3, SHOE) + c.rect(ox + 18, 36, 4, 5, dark) + c.rect(ox + 18, 39, 6, 3, SHOE) + + ty = 22 - lift + c.rect(ox + 7, ty, 18, 14, robe) + c.rect(ox + 23, ty, 2, 14, dark) + c.rect(ox + 7, ty + 9, 18, 3, light) + c.rect(ox + 13, ty, 6, 2, light) + c.rect(ox + 15, ty + 2, 2, 2, light) + + c.rect(ox + 5, 24 - lift, 2, 9, robe) + c.rect(ox + 25, 24 - lift, 2, 9, robe) + if direction != "north": + c.rect(ox + 5, 32 - lift, 2, 2, light) + c.rect(ox + 25, 32 - lift, 2, 2, light) + c.rect(ox + 5, 34 - lift, 2, 3, SKIN) + c.rect(ox + 25, 34 - lift, 2, 3, SKIN) + + hy = 12 - lift + c.rect(ox + 10, hy, 12, 10, SKIN) + c.rect(ox + 9, hy - 4, 14, 4, HAIR) + c.rect(ox + 9, hy, 2, 3, HAIR) + c.rect(ox + 21, hy, 2, 3, HAIR) + + if direction == "north": + c.rect(ox + 10, hy, 12, 5, HAIR) + elif direction == "south": + c.rect(ox + 12, hy + 3, 2, 2, EYE) + c.rect(ox + 18, hy + 3, 2, 2, EYE) + c.rect(ox + 15, hy + 7, 2, 1, (196, 120, 104, 255)) + elif direction == "west": + c.rect(ox + 18, hy, 4, 6, HAIR) + c.rect(ox + 11, hy + 3, 2, 2, EYE) + elif direction == "east": + c.rect(ox + 10, hy, 4, 6, HAIR) + c.rect(ox + 19, hy + 3, 2, 2, EYE) + + if extra == "straw_hat": + c.rect(ox + 11, 3 - lift, 10, 7, hat) + c.rect(ox + 12, 4 - lift, 8, 1, hat_light) + c.rect(ox + 6, 9 - lift, 20, 2, hat) + c.rect(ox + 7, 11 - lift, 18, 1, hat_dark) + elif extra == "kerchief": + c.rect(ox + 8, 7 - lift, 16, 4, (40, 52, 96, 255)) + c.rect(ox + 8, 7 - lift, 16, 1, (68, 84, 138, 255)) + c.rect(ox + 24, 10 - lift, 3, 3, (40, 52, 96, 255)) + c.rect(ox + 24, 12 - lift, 2, 4, (68, 84, 138, 255)) + elif extra == "bun_vest": + c.rect(ox + 14, 4 - lift, 4, 4, HAIR) + c.rect(ox + 15, 3 - lift, 2, 1, HAIR) + c.rect(ox + 10, ty + 1, 12, 9, dark) + c.rect(ox + 10, ty + 1, 12, 1, light) + c.rect(ox + 15, ty + 2, 2, 8, light) + elif extra == "hairpin_scarf": + c.rect(ox + 21, 9 - lift, 5, 1, hat) + c.rect(ox + 24, 8 - lift, 2, 1, hat_light) + c.rect(ox + 9, ty - 1, 14, 2, (150, 62, 58, 255)) + c.rect(ox + 9, ty - 1, 14, 1, (188, 92, 84, 255)) + c.rect(ox + 22, ty, 3, 6, (150, 62, 58, 255)) + elif extra == "round_cap": + c.rect(ox + 9, 5 - lift, 14, 5, (48, 52, 66, 255)) + c.rect(ox + 10, 4 - lift, 12, 2, (48, 52, 66, 255)) + c.rect(ox + 10, 9 - lift, 12, 1, (70, 74, 90, 255)) + c.rect(ox + 15, 3 - lift, 2, 2, hat) + + c.outline(ox, 0, 32, 48) + + def build_character_atlas(): - c = Canvas(2560, 48) + c = Canvas(3840, 48) cell = 0 for variant in VARIANTS: for direction in DIRECTIONS: - for frame in (0, 1): + for frame in range(4): draw_character_cell(c, cell * 32, variant, direction, frame) cell += 1 + for phase in range(2): + draw_character_idle_cell(c, cell * 32, variant, direction, phase) + cell += 1 return c @@ -679,8 +811,8 @@ def build_interior_atlas(): def main(): ASSET_DIR.mkdir(parents=True, exist_ok=True) targets = [ - ("jiangnan-world.png", build_world_atlas(), 672, 32), - ("jiangnan-characters.png", build_character_atlas(), 2560, 48), + ("jiangnan-world.png", build_world_atlas(), 800, 32), + ("jiangnan-characters.png", build_character_atlas(), 3840, 48), ("jiangnan-interior.png", build_interior_atlas(), 392, 96), ] for name, canvas, w, h in targets: -- cgit v1.2.3