move-ball ( GADGET -- )


Vocabulary
pong

Inputs
GADGETan object


Outputs
None

Definition


:: move-ball ( GADGET -- )
GADGET ball>> :> BALL BALL vel>> first dup 0 > 380 10 ?
BALL pos>> first - swap / 1 min BALL vel>> second dup 0 >
380 10 ? BALL pos>> second - swap / 1 min min
:> movement movement 0 > [ movement throw ] unless
BALL pos>> BALL vel>> movement v*n v+ BALL pos<< ;