B5 - Bigger Art — Anchors

Updated 2 weeks ago

Bigger Art — Anchors

Sprites · for creators. Your replacement can be bigger than the original — a longer needle, a taller crest. Stitchwork grows the atlas to fit, and the anchor decides where that extra room goes. Five presets cover almost everything; a precise pivot covers the rest.

You'll be able to: enlarge a sprite without it drifting out of place, pick the right anchor, set it from the filename or the Dev Hub, and reach for the precise pivot when the five presets can't say what you mean.

Before you start: B1. This only matters once a replacement outgrows its slot — for same-size art, none of this applies.

Why an anchor is needed at all

Say the vanilla sprite is a 64×96 head, and you draw a 128×128 one. Stitchwork enlarges that slot to fit your art — but it has to decide where the bigger slot sits relative to the body:

  • Bottom (the default): the neck/chin stays put, art grows up and out. Usually right — most character art stands on the ground and you want the ground contact fixed.
  • Center: art grows equally in all directions, which floats the head higher than you meant.
  • Top: art hangs from the top edge and grows down.

Get this wrong and an enlarged sprite slides off its body. The anchor is how you keep it pinned.

[image: the same enlarged sprite at each of the five anchors, overlaid on the character body — THE key illustration for this page]

What's needed for this image: one enlarged sprite shown anchored top/bottom/left/right/center against the original silhouette, so the displacement of each is obvious.

When it matters (and when it doesn't)

  • Only for replacements LARGER than the vanilla slot. That's the whole feature.
  • Same-size or smaller → the tag is inert. The slot never expands, so there's nothing to anchor. (The Dev Hub still lets you set one; it just has no visible effect until the art is enlarged.)

The five anchors

Five, not nine — Stitchwork deliberately omits the corners. The unspecified axis always centres:

              top  (@t)
  left (@l)  center (@c)  right (@r)
            bottom (@b)
  • bottom — the default, and you never type it; an untagged file is bottom-anchored. Right for anything that stands on the ground.
  • center — for art that radiates from a point (effects, symmetric items).
  • top — for things that hang (a light beam, a banner).
  • left / right — pin that edge, grow away from it.

Need a corner? Pick the axis that matters most; the other centres. (No corner tags by design — five anchors, not nine.)

Setting an anchor — the filename tag

The anchor lives in the PNG file name, as a trailing @x:

Sprites/{Collection}/{Material}/{Sprite}@t.png
File name Anchor
[email protected] top
crest.png bottom (default)
[email protected] bottom (explicit — same as untagged)
[email protected] / [email protected] left / right
[email protected] center

Stitchwork strips the tag when matching the file to a sprite, so [email protected] still replaces the sprite named crest — the tag only steers the anchoring of an enlarged replacement.

Don't ship two tagged files for one sprite. If crest.png and [email protected] both sit in the same folder, that's a conflict; Stitchwork resolves it deterministically (lexically-first wins, so untagged beats @t), but you should delete the duplicate so the result is the one you meant.

Setting an anchor in the Dev Hub

  • Animation tab → click your sprite. The inspector shows the current anchor (the active button lit) and whether the replacement is enlarged.
  • Click Top / Bottom / Left / Right / Center. Stitchwork renames your workspace PNG to carry (or drop, for Bottom) the matching tag — e.g. Top renames crest.png[email protected].
  • If a file with the target name already exists, the rename is refused with a log warning rather than clobbering it. Remove the duplicate and retry.

The rename fires the sprite watcher, so the sprite repositions in ~100 ms — no scene reload.

[image: the Animation inspector's five anchor buttons with one lit]

What's needed for this image: the anchor button row in the inspector, one active.

The precise pivot — @p<px>_<py>

The five presets are shorthands for the most common placements. When you need one they can't express — an asymmetric expansion like +50 px on top but only +25 on the bottom — there's the general form:

Sprites/{Collection}/{Material}/{Sprite}@p120_64.png

@p<px>_<py> places your replacement so its pixel (px from the left, py from the bottom) lands on the vanilla sprite's pivot. The five presets are just specific (px, py) choices of this same placement, so anything they do, @p can do — plus everything they can't.

You'll rarely hand-write this — it's most often produced for you: the Animation Canvas compile stamps an @p tag on any frame you grew past its footprint, so its registration is exact. But it's a real, documented tag, and if you're placing an asymmetric enlargement by hand, it's the precise tool.

Pack vs. root

  • Packs ship the tagged name directly — a pack author just names the file {Sprite}@t.png inside …/Sprites/{coll}/{mat}/.
  • The Dev Hub's rename authoring acts on the root workspace (…/StitchworkRoot/Sprites/…) — it never renames files inside other people's pack folders.
  • If several packs supply the same sprite, the usual priority order decides which file (and tag) wins.

Migrating from anchors.txt

Older packs used a Sprites/{coll}/{mat}/anchors.txt sidecar. It's no longer read — Stitchwork logs a one-time warning if it finds one. To migrate: for each spriteName = anchor line, rename that sprite's PNG to carry the matching tag, then delete anchors.txt. The old nine points collapse to five — corners pick their dominant axis; *-center → that side; plain center@c; bottom-center → untagged.

Troubleshooting

  • "My enlarged sprite is positioned wrong." Check the tag on the file name, and confirm the file is at the right collection+material path.
  • "I set an anchor but nothing happened." The anchor only shows when the replacement is larger than the slot. Same-size art → the tag is inert.
  • "The Dev Hub refused to set my anchor." A file with the target tagged name already exists. Remove the duplicate, then set it again.
  • "My old anchors.txt stopped working." Intentional — see Migrating from anchors.txt above.

You can now enlarge a sprite and keep it pinned, set anchors by filename or in the Dev Hub, and use the precise pivot for placements the presets can't reach. Next: Sprite Paths Reference for the full path suite, or Animation Canvas, which automates @p for grown animation frames.