Swim (bird)

The swim of the game cycles for birds: the feet paddle in turn under the body, the wings folded in and the head bobbing, looping every 1.2 seconds for as long as a game has the bird afloat.

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

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

What it is for

Swim (bird) is the swim of the nine game cycles, written for the bird set: floating and swimming, paddling its feet in turn under it with its wings folded and its head bobbing, rather than paddling with the arms the way Swim does.

The principle it shows: overlapping action

The legs and feet paddle on a 0.6-second cycle, and the head bobs at that same faster rhythm, while the body's own small bob and the tail swing keep a slower, 1.2-second rhythm underneath. Two different speeds running at once, rather than one shared timing, is what keeps the float from reading as a single mechanical rock.

The program, line by line

settings: h = 540, leg = 0.05
when it starts
  show the side view
  set left arm -4, right arm 4, torso -3, dy (-0.03*h), left leg 10, right leg 10, left foot 10, right foot 10
  sin wave on left leg · every 0.6 s · amp 26
  sin wave on right leg · every 0.6 s · amp 26 · phase 3.141592653589793
  sin wave on left foot · every 0.6 s · amp 20 · phase 1.5707963267948966
  sin wave on right foot · every 0.6 s · amp 20 · phase 4.71238898038469
  sin wave on dy · every 1.2 s · amp 3
  sin wave on head · every 0.6 s · amp 3
  sin wave on tail · every 1.2 s · amp 8

Try this

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

    In the program: wave · amp 26 → 40

  2. Lean the body 10 degrees forward instead of 3. The bird sits noticeably lower and further forward in the water.

    In the program: set · to.part:torso -3 → -10

How it differs from Swim and Climb (bird)

Swim is the same idea paddling with two arms rather than two feet. Climb (bird) is the other cycle written for this body with no foot-planting math, beating its wings 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, turns, body, head, arms, legs
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_bird · version 1.0.0 · c4c-free · by Jabbertoon