Add a four-direction walk demo that seeds its own sprite sheet
tools/seed-actor.mjs builds the project Actor demo: it uploads tools/assets/Actor1.png, slices the 576x384 sheet into the 96 cells of a 12x8 grid (48x48 each, no remainder) and wears the character in the top left corner. Walking is four ping-pong animations of three frames, which is the original RPG-Maker walk cycle; standing is the middle frame of the row, not an animation. The graph pastes walk- or idle- in front of the direction faced and wears the result, so eight cases need no branch tree - the List node only holds numbers. Which way it looks is the key pressed last, corrected whenever only one axis is still held, or letting go of one key of a diagonal would walk backwards. Axis input already normalizes its vector. tools/lib/projects.mjs gains uploadTexture, since data/textures/ is git-ignored and a seed that ships its picture has to send it. The harness gains w/a/s/d and keyDown/keyUp halves, because holdKey cannot express two presses that overlap - which is what a diagonal is. tools/smoke-actor.mjs plays it in 19 checks and reads the drawn pixels at the camera edge, where the bounds hold him walking on the spot: three distinct frames walking, one standing. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1135bf4562
commit
e147dd6d21
7 files changed
+534
No files matched your search
@@ -730,6 +730,7 @@ GM_STEPS=20 node tools/e2e.mjs # or 1-12, or 6,20
|
||||
./e2e.sh status # live progress, or the last run's result
|
||||
node tools/seed-jumprun.mjs && node tools/smoke-jumprun.mjs # 24 checks: the example game, played end to end
|
||||
node tools/seed-tetris.mjs && node tools/smoke-tetris.mjs # 19 checks: the Tetris example, played end to end
|
||||
node tools/seed-actor.mjs && node tools/smoke-actor.mjs # 19 checks: the walk demo (the seed uploads its own sheet)
|
||||
```
|
||||
|
||||
**A run needs a working GPU.** An idle editor page keeps rendering a picture that never changes, and
|
||||
@@ -849,6 +850,21 @@ no loop and no list access of its own, which `tools/smoke-tetris.mjs` checks. Th
|
||||
the game in a headless browser (fall, move, turn, drop, land, clear a line, fill the well) – it
|
||||
is the regression test for loops, lists and behaviors used as nodes.
|
||||
|
||||
**The walk demo** (`tools/seed-actor.mjs`, project *Actor demo*) is the smallest of the three and the
|
||||
only one that ships its own picture: it uploads `tools/assets/Actor1.png` and slices the 576×384
|
||||
sheet into the 96 cells of a 12×8 grid. That is the usual RPG-Maker layout – eight characters, each
|
||||
three columns (left foot / standing / right foot) by four rows (down, left, right, up) – and the demo
|
||||
wears the one in the top left corner. Walking is four **ping-pong** animations of three frames, which
|
||||
is exactly the original walk cycle; standing is no animation at all but the middle frame of the row.
|
||||
The graph builds what the sprite wears **by name**, pasting `walk-` or `idle-` in front of the
|
||||
direction it faces, which is why the standing frames carry named ids. Which way it looks is the key
|
||||
pressed last, corrected whenever only one axis is held – otherwise letting go of one key of a
|
||||
diagonal would leave it walking backwards. It is the worked example for animations, for a seed that
|
||||
brings its own texture, and for `Axis input`, whose vector is already normalized so a diagonal is not
|
||||
faster than a straight line. `tools/smoke-actor.mjs` walks it in a headless browser; that the
|
||||
animation really advances it reads off the **drawn pixels**, standing at the edge of the camera where
|
||||
he walks on the spot – a clock that ticks without the picture following would pass otherwise.
|
||||
|
||||
The workspace folder itself is what nginx serves, so `npm run build` is the deployment.
|
||||
|
||||
## API
|
||||
|
||||
Reference in new issue
Block a user