Swim (four legs)

The swim of the game cycles for four legs: the front legs paddle in turn while the back legs kick, the head held up, looping every 0.8 seconds for as long as a game has the character afloat.

A cartoon person and a dog with front legs paddling, head held up, afloat on the grass.

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

What it is for

Swim (four legs) is the swim of the nine game cycles, written for the fours set: paddling with the front legs in turn and kicking with the back legs, the head held up, rather than the upright swim's two-armed paddle.

The principle it shows: overlapping action

The front legs paddle on a 0.8-second cycle while the back legs kick twice as fast, every 0.4 seconds, and the body's small bob keeps the slower rhythm while the tail swings with the back legs' faster one. Several different speeds running at once, rather than one shared timing for the whole body, is what keeps the swim from reading as a single mechanical paddle.

The program, line by line

settings: h = 540, leg = 0.33
when it starts
  show the side view
  set dy (-0.05*h), torso 6, head 10, back left leg -10, back left shin 20, back left foot 0, back right leg -10, back right shin 20, back right foot 0, front left leg 30, front left shin 30, front left foot 0, front right leg 30, front right shin 30, front right foot 0
  sin wave on front left leg · every 0.8 s · amp 28
  sin wave on front right leg · every 0.8 s · amp 28 · phase 3.141592653589793
  sin wave on front left shin · every 0.8 s · amp 24 · phase 1.5707963267948966
  sin wave on front right shin · every 0.8 s · amp 24 · phase 4.71238898038469
  sin wave on back left leg · every 0.4 s · amp 16
  sin wave on back right leg · every 0.4 s · amp 16 · phase 3.141592653589793
  sin wave on dy · every 0.8 s · amp 3
  sin wave on tail · every 0.4 s · amp 14

Try this

  1. Paddle the front left leg 40 degrees instead of 28. The stroke becomes a much harder paddle, pushing far more water with each reach.

    In the program: wave · amp 28 → 40

  2. Hold the head 20 degrees up instead of 10. The character strains much further above the water to keep its face clear.

    In the program: set · to.part:head 10 → 20

How it differs from Swim and Climb (four legs)

Swim is the same idea paddling with two arms on a two-legged body rather than four legs. Climb (four legs) is the other cycle written for this body with no foot-planting math, reaching up 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, turns, body, head, arms
4 legs (a dog)yeswhole body, body, head, front legs, back legs, tail, ears
no legs (the monster with no legs)yeswhole body, turns, body, arms, tail, ears

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