Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.
test(pixel-draw): G6 compares the frames inside the safe area - a staff or a spark that reaches into the margin in one frame is not a taller figure; a recorded attack whose staff and spark do
Soohong Kim09f6d7da5e1c
diff --git a/tests/fixtures/pixel_draw/attack-32-margin-detail.txt b/tests/fixtures/pixel_draw/attack-32-margin-detail.txtnew file mode 100644index 0000000..9574a39--- /dev/null+++ b/tests/fixtures/pixel_draw/attack-32-margin-detail.txt@@ -0,0 +1,152 @@+```pixels+PALETTE+. transparent+o #2a1a2e+d #4a2a7a+p #7a44c0+P #a878e8+y #ffd84a+w #f4f4f0+g #b4b4c4+s #f2c49a+k #c88a64+b #8a5a2e+B #5a3818+t #b8844a+c #3a8cf0+C #b0e4ff+D #2048a8+FRAME attack1+................................+................................+................................+.........oo............o........+.........oPo..........oCo.......+.........oPpo........oCcco......+..........oPppo......occDo......+..........oPpypo......oDo.......+..........oPyyypo.....oto.......+.........oPppypdo.....oto.......+.......oPPPppppppddo..oto.......+........ooooooooooo...oto.......+..........owwkssosso..oto.......+..........ogwwsssssso.oto.......+........oPpgwwwwwwwo..oto.......+.......oPppgwwwwwgoooooto.......+.......oPpppgwwwoPPPpssso.......+.......oPpppgwwwopppdksko.......+.......oPppppgwwoooooooto.......+.......oPpppppgwopdo..oto.......+.......obbbbbbbbbbBo..oto.......+.......oPppppppbppdo..oto.......+......oPpppppppbppddo.oto.......+......oPpppppppBpppdo.oto.......+......oPpppppppppppdo.oto.......+.....oPppppppppppppddooto.......+.....odddddddddddddddooto.......+......obbBo..obbbbbBo.oto.......+......ooooo..oooooooo.ooo.......+................................+................................+................................+FRAME attack2+................................+.....................o..........+....................oCo.........+.........oo........oCcco........+.........oPo.......occDo........+.........oPpo.......oDo.........+..........oPppo.....oto.........+..........oPpypo....oto.........+..........oPyyypo...oto.........+.........oPppypdo...oto.........+.......oPPPppppppddooto.........+........ooooooooooo.oto.........+..........owwkssossooto.........+..........ogwwssssssoto.........+........oPpgwwwwwwwooto.........+.......oPppgwwwwwgoooto.........+.......oPpppgwwwoPPpssso........+.......oPpppgwwwoppdksko........+.......oPppppgwwoooooto.........+.......oPpppppgwopdooto.........+.......obbbbbbbbbbBooto.........+.......oPppppppbppdooto.........+......oPpppppppbppddoto.........+......oPpppppppBpppdoto.........+......oPpppppppppppdoto.........+.....oPppppppppppppdoto.........+.....oddddddddddddddooo.........+......obbBo..obbbbbBo...........+......ooooo..oooooooo...........+................................+................................+................................+FRAME attack3+................................+................................+.............................c..+.........oo...............o.cCc.+.........oPo.............oCo.c..+.........oPpo...........oCcco...+..........oPppo.........occDo...+..........oPpypo.........oDo....+..........oPyyypo........oto....+.........oPppypdo........oto....+.......oPPPppppppddo.....oto....+........ooooooooooo......oto....+..........owwkssosso.....oto....+..........ogwwsssssso....oto....+........oPpgwwwwwwwo.....oto....+.......oPppgwwwwwgooooooooto....+.......oPpppgwwwoPPPPPPpssso....+.......oPpppgwwwoppppppdksko....+.......oPppppgwwooooooooooto....+.......oPpppppgwopdo.....oto....+.......obbbbbbbbbbBo.....oto....+.......oPppppppbppdo.....oto....+......oPpppppppbppddo....oto....+......oPpppppppBpppdo....oto....+......oPpppppppppppdo....oto....+.....oPppppppppppppddo...oto....+.....odddddddddddddddo...oto....+......obbBo..obbbbbBo....oto....+......ooooo..oooooooo....ooo....+................................+................................+................................+FRAME attack4+................................+................................+................................+.........oo...........o.........+.........oPo.........oCo........+.........oPpo.......oCcco.......+..........oPppo.....occDo.......+..........oPpypo.....oDo........+..........oPyyypo....oto........+.........oPppypdo....oto........+.......oPPPppppppddo.oto........+........ooooooooooo..oto........+..........owwkssosso.oto........+..........ogwwssssssooto........+........oPpgwwwwwwwo.oto........+.......oPppgwwwwwgooooto........+.......oPpppgwwwoPPpssso........+.......oPpppgwwwoppdksko........+.......oPppppgwwooooooto........+.......oPpppppgwopdo.oto........+.......obbbbbbbbbbBo.oto........+.......oPppppppbppdo.oto........+......oPpppppppbppddooto........+......oPpppppppBpppdooto........+......oPpppppppppppdooto........+.....oPppppppppppppddoto........+.....odddddddddddddddoto........+......obbBo..obbbbbBooto........+......ooooo..ooooooooooo........+................................+................................+................................+END+```\ No newline at end of filediff --git a/tests/gen/test_pixel_gates.py b/tests/gen/test_pixel_gates.pyindex cc4dd0a..77ad69f 100644--- a/tests/gen/test_pixel_gates.py+++ b/tests/gen/test_pixel_gates.py@@ -228,6 +228,25 @@ def test_a_recorded_blade_reaches_into_the_margin_and_the_body_stays_inside():assert all(3 <= m["body_box"][0] and m["body_box"][2] <= 28 and m["baseline"] == 28 for m in measures.values())+def test_g6_measures_the_frames_inside_the_safe_area():+ """What reaches into the margin - a staff raised in one frame, a spark in another - is G8's to+ judge; G6 compares the figures inside the safe area."""+ still, raised = figure(), paint(figure(), 20, 1, 20, 2) # the staff 2 px into the top margin+ g6 = evaluate({"a": still, "b": raised}, kind="sprite", rule=FREE16, walk_cycle=False)["G6"]+ assert g6["ok"] and g6["heights"] == {"a": 26, "b": 26} and g6["baselines"] == {"a": 28, "b": 28}+ taller = paint(canvas(), 8, 5, 23, 28) # the body itself 2 px shorter inside the safe area+ assert not evaluate({"a": still, "b": taller}, kind="sprite", rule=FREE16, walk_cycle=False)["G6"]["ok"]+++def test_a_recorded_staff_and_spark_in_the_margin_pass():+ """Drawn under the safe-area prompt: the staff pulled back reaches 2 px into the top margin and the+ spark 1 px, the figure is the same height in every frame."""+ frames = frames_of("attack-32-margin-detail.txt", 32, ("attack1", "attack2", "attack3", "attack4"))+ gates = evaluate(frames, kind="sprite", rule=FREE16, walk_cycle=False)+ assert gates["ok"] and gates["warnings"] == [] and gates["G6"]["height_spread"] == 0+ assert [m["bbox"][1] for m in gates["G8"]["frames"].values()] == [3, 1, 2, 3]++def test_recorded_answers_from_the_full_canvas_prompt_fail_g8():"""Drawn when the prompt asked to fill the canvas: the knight's helmet is on row 1 and its bootson row 16, the 16 px canvas's own edge rows."""diff --git a/tests/gen/test_pixel_grid.py b/tests/gen/test_pixel_grid.pyindex 2340a8d..4c214e4 100644--- a/tests/gen/test_pixel_grid.py+++ b/tests/gen/test_pixel_grid.py@@ -42,6 +42,7 @@ PASSING = [("sprite-16-safe-area-pass.txt", "chargrid", 16, ("sprite",)),("walk-32-safe-area-pass.txt", "chargrid", 32, WALK),("attack-32-safe-area-pass.txt", "chargrid", 32, ("attack1", "attack2", "attack3", "attack4")),+ ("attack-32-margin-detail.txt", "chargrid", 32, ("attack1", "attack2", "attack3", "attack4")),]