Skip to content

Generate clean 2D game sprites & animation atlases — component-row pipeline: state rows, alpha cleanup, frame extraction, runtime atlases. Codex/Claude skill.

fix(video): an attack keeps the grip the image shows

Soohong Kim7d1cd1791deb
diff --git a/docs/video-pipeline.md b/docs/video-pipeline.md
index 4df23fb..c5f125e 100644
--- a/docs/video-pipeline.md
+++ b/docs/video-pipeline.md
@@ -85,7 +85,9 @@ quadruped and a legless blob into a contradiction (2026-09-09).
An attack is a timed strike, not a repeat. `MOTION_TEXT["attack"]` asks for the same attack
twice, each a windup (about 0.5 s), one strike in front (about 0.25 s), a held impact pose
(about 0.3 s) and a recovery to the exact starting stance (about 0.5 s), with what the subject
-holds kept in the hand nearest the viewer and the body never turning. Its template
+holds kept in the grip the image shows — one hand stays one hand, both hands stay both hands,
+never let go, switched or taken in an extra hand — and the body never turning. Naming one hand
+for a weapon the still draws in both hands made the clip let go and grab again mid-attack. Its template
(`ACTION_COMMON_TEXT`) drops the "evenly paced" line, keeps what the subject holds inside the
frame, and asks for crisp frames without motion blur. `video-set` asks attack clips for 4 s
(`STATE_DURATION_SECONDS`; every other state keeps 3 s, and `--duration` overrides every state)
diff --git a/sprite_gen/video/batch.py b/sprite_gen/video/batch.py
index 246664c..6ed570e 100644
--- a/sprite_gen/video/batch.py
+++ b/sprite_gen/video/batch.py
@@ -71,11 +71,12 @@ MOTION_TEXT = {
"run": "moves in place on a treadmill: a fast locomotion cycle for this body type with a bounding rhythm and clear repeating ground contacts.",
"jump": "performs a modest vertical hop in place over and over: compress, spring up about half the body height, land softly, return to the exact starting stance, repeat at an even rhythm. Same height every time.",
"attack": (
- "performs the same melee attack twice in a row with what it is already holding in the hand nearest the viewer "
- "(bare hands only if it holds nothing), keeping every piece of its gear and outfit exactly as drawn. Each attack is "
- "a windup (about 0.5 s), one clean strike in front (about 0.25 s), a held impact pose (about 0.3 s), then a recovery "
- "to the exact starting stance (about 0.5 s). What it holds never changes hands, and the body keeps facing the same "
- "direction without turning."
+ "performs the same melee attack twice in a row with what it is already holding, gripped exactly as in the image "
+ "— one hand stays one hand, both hands stay both hands — (bare hands only if it holds nothing), keeping every "
+ "piece of its gear and outfit exactly as drawn. Each attack is a windup (about 0.5 s), one clean strike in front "
+ "(about 0.25 s), a held impact pose (about 0.3 s), then a recovery to the exact starting stance (about 0.5 s). "
+ "What it holds is never let go, switched to the other hand or taken in an extra hand, and the body keeps facing "
+ "the same direction without turning."
),
"cheer": "celebrates in place: rises into a raised, spread-out cheer pose, holds it for a beat, then settles back to the exact starting stance, repeating at an even rhythm.",
"wave": "waves in place: lifts one side into a friendly wave, sways it a few times, then settles back to the exact starting stance, repeating at an even rhythm.",
diff --git a/tests/video/test_attack_motion.py b/tests/video/test_attack_motion.py
index 0e3ef20..3011176 100644
--- a/tests/video/test_attack_motion.py
+++ b/tests/video/test_attack_motion.py
@@ -16,12 +16,15 @@ from sprite_gen.video import batch as batch_mod
FIXTURE = Path(__file__).parents[1] / "fixtures" / "facing" / "left.png"
-def test_attack_text_is_timed_one_handed_and_twice() -> None:
+def test_attack_text_is_timed_keeps_the_drawn_grip_and_is_twice() -> None:
text = batch_mod.build_prompt("side", "attack", None)
- for phrase in ("twice in a row", "hand nearest the viewer", "windup (about 0.5 s)", "strike in front (about 0.25 s)",
- "held impact pose (about 0.3 s)", "exact starting stance", "never changes hands", "without turning",
- "anything it holds always stay fully inside the frame", "no motion blur"):
+ for phrase in ("twice in a row", "gripped exactly as in the image", "one hand stays one hand, both hands stay both hands",
+ "windup (about 0.5 s)", "strike in front (about 0.25 s)", "held impact pose (about 0.3 s)",
+ "exact starting stance", "never let go, switched to the other hand or taken in an extra hand",
+ "without turning", "anything it holds always stay fully inside the frame", "no motion blur"):
assert phrase in text, phrase
+ # the grip is the image's: a heavy weapon drawn in both hands is not asked into one
+ assert "hand nearest the viewer" not in text
assert "evenly paced" not in text
# the repeating states keep their template, evenly paced line included
assert "evenly paced" in batch_mod.build_prompt("side", "walk", None)