Swim (many legs)

The swim of the game cycles for many legs: the legs paddle in turn, two groups opposite each other, with the claws held forward, looping every 0.8 seconds for as long as a game has the character afloat.

A cartoon person and a dog with legs paddling, arms held forward, afloat on the grass.

Use it in a cartoonOpen it in the block editorThe pack file (JSON)

What it is for

Swim (many legs) is the swim of the nine game cycles, written for the many set: paddling the legs one after another from back to front with the claws held forward, bobbing, rather than the upright swim's two-armed stroke.

The principle it shows: overlapping action

The legs and the shins both paddle on the same 0.8-second rhythm, but the shins lag a quarter-turn behind their own leg, so each stroke bends through rather than sweeping as one stiff piece. The body's own small bob keeps that same shared rhythm underneath, rather than a faster beat layered on top the way the upright swim's legs and tail use.

The program, line by line

settings: h = 540, leg = 0.1
when it starts
  set left arm -10, right arm 10, left arm lift (0.05*h), right arm lift (0.05*h), dy (-0.03*h)
  sin wave on left leg · every 0.8 s · amp 22
  sin wave on right leg · every 0.8 s · amp 22 · phase 3.141592653589793
  sin wave on left shin · every 0.8 s · amp 16 · phase 1.5707963267948966
  sin wave on right shin · every 0.8 s · amp 16 · phase 4.71238898038469
  sin wave on dy · every 0.8 s · amp 3

Try this

  1. Paddle the left leg 35 degrees instead of 22. The stroke becomes a much harder paddle, pushing far more water with each kick.

    In the program: wave · amp 22 → 35

  2. Hold the left claw 25 degrees out instead of 10. The claws reach much further forward while afloat.

    In the program: set · to.part:arm:-1 -10 → -25

How it differs from Swim and Climb (many legs)

Swim is the same idea paddling with two arms on a two-legged body rather than legs by the set. Climb (many legs) is the other cycle written for this body with no foot-planting math, reaching with claws against a surface rather than paddling through water.

Works on

Worked out by the build: it plays the move in the engine on each body and checks what moves on screen. Nobody types this table.
BodyMoves?What moves
2 legs (a person)yeswhole body, body, arms, legs
4 legs (a dog)yeswhole body, front legs, back legs
no legs (the monster with no legs)yeswhole body, body, arms

c4c:beh:cycle_swim_many · version 1.0.0 · c4c-free · by Jabbertoon