(local qtau (/ math.pi 2))
(fn rotating [state x y ax ay ox oy]
  (if (or (= 0 state.rt) (= nil state.rt)) (values x y)
      (let [th (match state.piece.r ; I know, I know, math.atan2, but no.
                 1 (* math.pi 2)
                 2 qtau
                 3 (* math.pi -1)
                 4 (+ math.pi qtau))
            th2 (+ th (* qtau (/ state.rt -4)))]
        (set state.rt (- state.rt 0.25))
        (values (+ ox (* 8 (+ ax (math.cos th2))))
                (+ oy (* 8 (+ ay (math.sin th2))))))))

Generated by Phil Hagelberg using scpaste at Sat Oct 23 10:44:35 2021. PDT. (original)