Flinch (hurt)

The hurt of the nine game cycles: a quick recoil from a hit, the eyes shut and the arms thrown up to guard the face, back to standing in 0.4 seconds, for a game to play the instant a character takes damage.

A cartoon person and a dog caught mid-flinch, arms thrown up and eyes shut, nudged off their resting spots.

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

What it is for

Flinch (hurt) is the hurt of the nine game cycles: the short reaction a game plays the instant a character takes a hit, 0.4 seconds from start to finish, so it can play and clear quickly between other actions without holding up the game.

The principle it shows: slow in and slow out

The recoil snaps in fast, 0.08 seconds, eased so it lands hard right at the end, the way a real flinch does. The return to standing takes four times as long, 0.32 seconds, eased smoothly both in and out, so the character settles rather than snapping back. The quick strike and the slow recovery either side of it are what keep a 0.4-second move from reading as a single flat twitch.

The program, line by line

settings: h = 540, leg = 0.24
when it starts
  show the side view
  look surprised
  at the same time:
    — 1:
      glide hips 0, left leg 12, right leg 12, left shin 24, right shin 24, left foot 12, right foot 12, head 8, torso 5, left arm 34, right arm 34, left forearm 100, right forearm 100, blink 1 over 0.08 s (out)
    — 2:
      set dx 0, dy 0
      for 0.08 s:
        dy follows (h*leg/2*(2 - cos(((0 + 12*sin((min(local/0.08, 1))*pi/2)))*pi/180) - cos((((0 + 12*sin((min(local/0.08, 1))*pi/2))) - ((0 + 24*sin((min(local/0.08, 1))*pi/2))))*pi/180)))
        dx follows (-h*leg/2*(sin(((0 + 12*sin((min(local/0.08, 1))*pi/2)))*pi/180) + sin((((0 + 12*sin((min(local/0.08, 1))*pi/2))) - ((0 + 24*sin((min(local/0.08, 1))*pi/2))))*pi/180)))
  set dx (-h*leg/2*(sin((12)*pi/180) + sin(((12) - (24))*pi/180))), dy (h*leg/2*(2 - cos((12)*pi/180) - cos(((12) - (24))*pi/180)))
  at the same time:
    — 1:
      glide hips 0, left leg 0, right leg 0, left shin 0, right shin 0, left foot 0, right foot 0, head 0, torso 0, left arm 0, right arm 0, left forearm 0, right forearm 0, blink 0 over 0.32 s (smooth)
    — 2:
      set dx 0, dy 0
      for 0.32 s:
        dy follows (h*leg/2*(2 - cos(((12 + -12*smoothstep(min(local/0.32, 1))))*pi/180) - cos((((12 + -12*smoothstep(min(local/0.32, 1)))) - ((24 + -24*smoothstep(min(local/0.32, 1)))))*pi/180)))
        dx follows (-h*leg/2*(sin(((12 + -12*smoothstep(min(local/0.32, 1))))*pi/180) + sin((((12 + -12*smoothstep(min(local/0.32, 1)))) - ((24 + -24*smoothstep(min(local/0.32, 1)))))*pi/180)))
  set dx (-h*leg/2*(sin((0)*pi/180) + sin(((0) - (0))*pi/180))), dy (h*leg/2*(2 - cos((0)*pi/180) - cos(((0) - (0))*pi/180)))
  look normal

Written out in full, exactly as the engine prints them:

h*leg/2*(2 - cos(((0 + 12*sin((min(local/0.08, 1))*pi/2)))*pi/180) - cos((((0 + 12*sin((min(local/0.08, 1))*pi/2))) - ((0 + 24*sin((min(local/0.08, 1))*pi/2))))*pi/180))

-h*leg/2*(sin(((0 + 12*sin((min(local/0.08, 1))*pi/2)))*pi/180) + sin((((0 + 12*sin((min(local/0.08, 1))*pi/2))) - ((0 + 24*sin((min(local/0.08, 1))*pi/2))))*pi/180))

-h*leg/2*(sin((12)*pi/180) + sin(((12) - (24))*pi/180))

h*leg/2*(2 - cos((12)*pi/180) - cos(((12) - (24))*pi/180))

h*leg/2*(2 - cos(((12 + -12*smoothstep(min(local/0.32, 1))))*pi/180) - cos((((12 + -12*smoothstep(min(local/0.32, 1)))) - ((24 + -24*smoothstep(min(local/0.32, 1)))))*pi/180))

-h*leg/2*(sin(((12 + -12*smoothstep(min(local/0.32, 1))))*pi/180) + sin((((12 + -12*smoothstep(min(local/0.32, 1)))) - ((24 + -24*smoothstep(min(local/0.32, 1)))))*pi/180))

-h*leg/2*(sin((0)*pi/180) + sin(((0) - (0))*pi/180))

h*leg/2*(2 - cos((0)*pi/180) - cos(((0) - (0))*pi/180))

Try this

  1. Take 0.3 seconds to flinch back instead of 0.08. The recoil becomes a slow wince rather than a sudden snap, as if the character is bracing rather than being struck.

    In the program: ramp · over 0.08 → 0.3

  2. Bend the forearms only 40 degrees instead of 100. The guard is far smaller, a flicker of the arms rather than throwing them fully up to shield the face.

    In the program: ramp · to.part:forearm:-1 100 → 40

How it differs from Cheer (win) and Fall

Cheer (win) is the opposite reaction, a happy spring rather than a flinch, and it takes three times as long. Fall is a longer, looping reaction for when a character is actually airborne; Flinch (hurt) is the short, one-shot recoil for a hit that does not knock the character off its feet.

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_hurt · version 1.0.0 · c4c-free · by Jabbertoon