Walk (four legs, in place)
The walk of the game cycles for four legs: the back-left and front-right paws step together, then the back-right and front-left, the stride fitted to a speed setting so no planted paw ever slides.

Use it in a cartoonOpen it in the block editorThe pack file (JSON)
What it is for
Walk (four legs, in place) is the walk of the nine game cycles, written for the fours set: four legs, numbered back-left, back-right, front-left and front-right. The gait has the legs stepping in diagonal pairs, which the program's own phase numbers confirm: the back-left and front-right paws share one half of the loop, the back-right and front-left share the other, the ordinary walking trot of a four-legged animal.
The principle it shows: arcs
The body's height still comes from the same cosine formula the two-legged walk uses, worked out from the lower leg's own bending angle rather than drawn by hand. With four legs sharing the load two at a time instead of one, that height formula only has to compare one diagonal pair against the other, which is why a four-legged walk can hold a steadier body height than a two-legged one does over the same stride.
The program, line by line
settings: speed = 0.75, h = 540, leg = 0.33, every = (clamp(0.9 - 0.3*speed, 0.45, 0.8)), stride = (57.29578*((clamp(speed*every/(4*leg), 0, 0.6)) + pow(clamp(speed*every/(4*leg), 0, 0.6), 3)/6 + 3*pow(clamp(speed*every/(4*leg), 0, 0.6), 5)/40)), give = 6, bend = 30, feet = 0.4
when it starts
show the side view
walk cycle every (every) s · arm swing 0 · no bob · roll 0.6 · stride (stride) · give (give) · bend (bend) · seen from the side
back left foot follows (-feet*(stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))) + (give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1))))))
back right foot follows (-feet*(stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))) + (give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1))))))
front left foot follows (-feet*(stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))) + (give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1))))))
front right foot follows (-feet*(stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))) + (give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1))))))
dy follows (h*leg/2*(2 - (1 - step(0.5, mod(local/every, 1)))*(cos((stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))))*pi/180) + cos(((stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1)))) + ((give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1))))))*pi/180)) - step(0.5, mod(local/every, 1))*(cos((stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))))*pi/180) + cos(((stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1)))) + ((give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1))))))*pi/180))) - 0.01*h)
sin wave on head · every (every/2) s · amp 2 · phase 0.6
sin wave on tail · every (every) s · amp 10 · phase 1.2show the side view— the move is drawn in profile.set head -6, tail 20— the head tips down a little and the tail lifts, the resting carry of a walking four-legged body.walk cycle every (every) s · arm swing 0 · no bob · roll 0.6 · stride (stride) · give (give) · bend (bend) · seen from the side— the base gait: a small 0.6-degree body roll timed to the stride.back left foot follows (…),back right foot follows (…),front left foot follows (…),front right foot follows (…)— each paw drags back through its own stance; the back-left and front-right share one half of the loop, the back-right and front-left the other, the diagonal pairing of a trot.dy follows (…)— the body sits at whichever diagonal pair is lower at that instant, dipping more at the middle of each step.sin wave on head · every (every/2) s · amp 2 · phase 0.6— the head bobs twice a stride.sin wave on tail · every (every) s · amp 10 · phase 1.2— the tail sways once a stride.
Written out in full, exactly as the engine prints them:
clamp(0.9 - 0.3*speed, 0.45, 0.8)
57.29578*((clamp(speed*every/(4*leg), 0, 0.6)) + pow(clamp(speed*every/(4*leg), 0, 0.6), 3)/6 + 3*pow(clamp(speed*every/(4*leg), 0, 0.6), 5)/40)
-feet*(stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))) + (give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1)))))
-feet*(stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))) + (give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1)))))
h*leg/2*(2 - (1 - step(0.5, mod(local/every, 1)))*(cos((stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1))))*pi/180) + cos(((stride*((1 - 4*mod(local/every + 0, 1))*(1 - step(0.5, mod(local/every + 0, 1))) + (4*mod(local/every + 0, 1) - 3)*step(0.5, mod(local/every + 0, 1)))) + ((give*(1 - step(0.5, mod(local/every + 0, 1))) + bend*step(0.5, mod(local/every + 0, 1)))*sin(pi*(2*mod(local/every + 0, 1) - step(0.5, mod(local/every + 0, 1))))))*pi/180)) - step(0.5, mod(local/every, 1))*(cos((stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1))))*pi/180) + cos(((stride*((1 - 4*mod(local/every + 0.5, 1))*(1 - step(0.5, mod(local/every + 0.5, 1))) + (4*mod(local/every + 0.5, 1) - 3)*step(0.5, mod(local/every + 0.5, 1)))) + ((give*(1 - step(0.5, mod(local/every + 0.5, 1))) + bend*step(0.5, mod(local/every + 0.5, 1)))*sin(pi*(2*mod(local/every + 0.5, 1) - step(0.5, mod(local/every + 0.5, 1))))))*pi/180))) - 0.01*hTry this
Raise the walking speed from 0.75 to 1.75 body heights a second, the top of this move's fitted range. The diagonal pairs quicken and lengthen their stride together, without a planted paw sliding.
In the program:
params.speed0.75→1.75Turn each stance paw only a tenth of the way flat instead of four-tenths. The walk looks lighter on its paws, each step leaving less of a trailing drag.
In the program:
params.feet0.4→0.1
How it differs from Walk (in place) and Run (four legs, in place)
Walk (in place) is the two-legged version, one foot down at a time rather than a diagonal pair. Run (four legs, in place) is this same diagonal-pair mechanism pushed to a faster, wider bound.
Works on
| Body | Moves? | What moves |
|---|---|---|
| 2 legs (a person) | yes | whole body, turns, legs |
| 4 legs (a dog) | yes | whole body, front legs, back legs, tail |
| no legs (the monster with no legs) | yes | whole body, turns, tail |