---
name: studio-pixel-walk-cycle
description: Create a pixel-art character walk cycle (4, 6 or 8 frames, side or 4-direction) as a transparent sprite sheet with Aseprite CLI or Pillow, plus engine import settings for Godot, Unity or Phaser. Use for "walk cycle sprite", "pixel character animation", "sprite sheet", "8-frame walk".
version: "1.1.0"
category: gamedev
platforms: [CLAUDE_CODE, CURSOR, CODEX_CLI]
---

# Pixel-art walk cycles

A readable pixel walk depends on a few things: fixed frame size and pivot, clear contact poses, a body bob of 1 px, and opposite arm and leg phases. This skill turns that into a repeatable pipeline from pose plan to sliced, engine-ready sprite sheet.

## When to use

- A playable or NPC character needs a walk (or run) loop for a 2D game.
- Producing a sprite sheet with documented frame size, order and timing.
- Fixing an existing walk that slides, jitters or reads as a shuffle.

## Agree on inputs first

| Decision    | Common choices                                                                               |
| ----------- | -------------------------------------------------------------------------------------------- |
| Frame size  | 16x16, 16x24, 24x32, 32x32, 48x48 (leave 2 to 4 px headroom for bob and arm swing)           |
| Frame count | 4 (retro), 6 (smooth small sprites), 8 (standard), 12+ (large sprites)                       |
| Directions  | Side (mirror for left), or 4-direction (down, up, left/right mirrored), or 8                 |
| Timing      | 8 frames at 100 to 120 ms each (about 8 to 10 fps) for walk; run is faster with fewer frames |
| Pivot       | Bottom center, at the feet baseline                                                          |
| Palette     | 8 to 24 colors including outline; document hex values                                        |
| Outline     | Dark colored outline (not pure black) or selective outline                                   |

## Pose plan (8-frame side walk)

| Frame | Pose                                                 | Body y offset |
| ----- | ---------------------------------------------------- | ------------- |
| 1     | Contact: front heel down, back toe down, legs widest | 0             |
| 2     | Down: weight lands, front knee bends                 | +1 (lowest)   |
| 3     | Passing: back leg swings under body                  | 0             |
| 4     | Up: pushing off, body highest                        | -1            |
| 5     | Contact, opposite legs                               | 0             |
| 6     | Down, opposite                                       | +1            |
| 7     | Passing, opposite                                    | 0             |
| 8     | Up, opposite                                         | -1            |

Arms swing opposite to legs: when the left leg is forward, the left arm is back. Head and torso move together with the bob; hair, scarves and capes lag by one frame. For a 4-frame cycle use contact, passing, contact (opposite), passing (opposite). For 6 frames drop the down poses.

Front-facing (down) walk: legs alternate vertical position by 1 px, arms swing in and out, body bobs 1 px. Up-facing mirrors the down structure with the back of the head.

## Toolchain

- **Aseprite** for drawing (onion skin on, tags per animation) and the CLI for export.
- **Python Pillow** for assembling, validating and previewing sheets; also for procedural placeholder sprites.
- **Engines**: Godot 4 AnimatedSprite2D / SpriteFrames, Unity Sprite Editor + Animator, Phaser 3 spritesheet loader.
- Alternatives: LibreSprite, Pixelorama (free, has CLI export), Piskel (web).

## Workflow

### 1. Neutral silhouette

Draw the standing idle at final size. The silhouette, filled black, must read as the character at 1x. Lock the feet baseline row and the horizontal center column; mark them on a guide layer.

### 2. Key poses, then in-betweens

Draw contacts first (frames 1 and 5), then passing (3 and 7), then down and up. Work with onion skinning. Move whole limbs as clusters of pixels; avoid single-pixel jitters on the face or outline between frames, which read as noise.

### 3. Anti-sliding

In a game, the engine moves the character; the sprite should walk in place. Measure foot travel: a planted foot moves backward a constant number of pixels per frame. Set character speed in the engine to match: `speed_px_per_s = stride_px_per_frame * fps`. Example: 2 px per frame at 10 fps = 20 px/s.

### 4. Export with Aseprite CLI

```bash
# one row per tag (walk_side, walk_down, walk_up), transparent, no padding
aseprite -b hero.aseprite --split-tags \
  --sheet hero_sheet.png --sheet-type rows \
  --data hero_sheet.json --format json-array --list-tags

# a single tag as horizontal strip
aseprite -b hero.aseprite --tag walk_side --sheet walk_side.png --sheet-type horizontal

# scaled preview GIF (nearest neighbor)
aseprite -b hero.aseprite --tag walk_side --scale 6 --save-as walk_preview.gif
```

The JSON includes each frame's rect and `duration` in ms, so timing travels with the sheet.

### 5. Or assemble with Pillow

```python
from PIL import Image
W, H = 32, 32
frames = [Image.open(f"frames/walk_{i}.png").convert("RGBA") for i in range(8)]
assert all(f.size == (W, H) for f in frames)
sheet = Image.new("RGBA", (W * len(frames), H), (0, 0, 0, 0))
for i, f in enumerate(frames):
    sheet.paste(f, (i * W, 0))
sheet.save("walk_side.png")
# preview: 6x nearest-neighbor GIF at 100 ms per frame
big = [f.resize((W * 6, H * 6), Image.NEAREST) for f in frames]
big[0].save("walk_preview.gif", save_all=True, append_images=big[1:], duration=100, loop=0, disposal=2)
```

### 6. Engine import

- **Godot 4**: Texture Filter Nearest (project default under Rendering > Textures), mipmaps off. AnimatedSprite2D > SpriteFrames > Add frames from sprite sheet, set Horizontal and Vertical counts, FPS 10, loop on. Offset the sprite so the pivot sits at the feet (`offset.y = -H/2`, or `centered = false` with an explicit offset). Mirror left with `flip_h`.
- **Unity**: Sprite Mode Multiple, PPU equal to your world unit (often 16), Filter Point, Compression None, Pivot Bottom Center (custom pivot per slice). Slice Grid By Cell Size. Drag frames into the scene to make a clip; set sample rate 10. Pixel Perfect Camera component.
- **Phaser 3**: `this.load.spritesheet('hero', 'walk_side.png', {frameWidth: 32, frameHeight: 32})`, then `this.anims.create({key: 'walk', frames: this.anims.generateFrameNumbers('hero', {start: 0, end: 7}), frameRate: 10, repeat: -1})`; game config `pixelArt: true`.

## Common variants

- **Run**: 6 frames, longer stride, forward lean of 1 px, both feet off the ground in one frame, body bob 2 px.
- **4-direction sheet**: rows down, left, right, up (document the order; the RPG Maker convention is down, left, right, up).
- **Idle**: 2 to 4 frames, a 1 px breathing bob on the torso only, 300 to 500 ms per frame.
- **Palette swaps**: keep indexed color (Aseprite Indexed mode) so recolors are palette edits, not redraws.
- **Upscaled for marketing**: integer scale only (4x, 6x) with nearest neighbor: `ffmpeg -i walk_preview.gif -vf scale=iw*4:ih*4:flags=neighbor big.gif`.

## Quality checks

- Sheet width = frame width x frame count, height = frame height x rows, exactly.
- Alpha is binary: every pixel alpha is 0 or 255 (`set(img.getchannel('A').getdata()) <= {0, 255}`).
- No pixel touches the frame border unless intended (clipping risk when the engine trims).
- Baseline: for each frame, the lowest opaque row of the planted foot is at the same y. Compute the bottom row per frame in Pillow (`img.getbbox()[3]`); variation is at most the planned bob, never random.
- Horizontal center: the bbox center of the torso varies by at most 1 px across frames (no drift).
- Color count is at most the documented palette size.
- Play the preview at native fps for at least 5 loops, on both a light (#f0f0f0) and dark (#202020) background, at 1x and 4x. Check for foot sliding, stutter at the loop point and halo pixels.
- Silhouette test: fill each frame black; legs must be distinguishable in contact poses.

## Pitfalls and fixes

| Problem                                   | Fix                                                                                    |
| ----------------------------------------- | -------------------------------------------------------------------------------------- |
| Character looks like it is sliding on ice | Engine speed does not match foot travel; compute from stride px per frame              |
| Jittery or "boiling" sprite               | Outline and face pixels change frame to frame; copy unchanged regions exactly          |
| Shuffle with no weight                    | Missing down/up bob; add 1 px vertical offset pattern                                  |
| Limp on one side                          | Opposite-side frames not mirrored in timing or pose; build frames 5 to 8 from 1 to 4   |
| Blurry in engine                          | Filter not Nearest/Point, or non-integer camera zoom                                   |
| Sprite pops when flipping left/right      | Pivot not centered on the body; set pivot at bottom center of the torso, not the frame |
| Semi-transparent edge pixels              | Brush anti-aliasing or resize with bilinear; use pencil tool and nearest scaling only  |

## Deliverables

- [ ] Source file (.aseprite or layered frames) with tags per animation
- [ ] Sprite sheet PNG at native resolution, transparent, no padding unless documented
- [ ] Metadata: frame width and height, count, order, rows per direction, ms per frame, pivot
- [ ] Preview GIF at integer scale on a neutral background
- [ ] Engine import notes and the movement speed that matches the stride

[Cinder Courier reference](https://skills-hub.ai/showcases/projects/cinder-courier)
