rendered paste bodymenu * {
Drop Ball:Throw
}
alias Throw {
if ($hget(Throw)) hfree Throw
hadd -m Throw BC $r(1,15)
window -Ckpd +btn @Throw -1 -1 640 480
drawrect -nf @Throw $hget(Throw,BC) 1 0 0 640 480
drawdot @Throw
}
menu @Throw {
sclick:{
hinc -m throw Num 1
throwball $hget(throw,Num) 1
}
dclick:{
hinc -m throw Num 1
throwball $hget(throw,Num) 1
}
}
alias -l throwball {
if (!$1) halt
if (!$window(@Throw)) halt
var %throw = $+(throw.,$1)
if ($hget(%throw,x)) && ($hget(%throw,y)) drawdot -n @Throw $hget(Throw,BC) 20 $hget(%throw,x) $hget(%throw,y)
if ($2) {
hadd -m %throw pos $mouse.y
hadd -m %throw x $mouse.x
hadd -m %throw speed 0
hadd -m %throw Color $r(1,15)
hadd -m throw gravity 15
}
hinc %throw speed $hget(throw,gravity)
hadd -m %throw y $calc($int($hget(%throw,pos)) + $hget(%throw,speed) /10)
if ($hget(%throw,y) > 430) {
hadd -m %throw y 430
hadd -m %throw speed $calc($hget(%throw,speed) * -0.7)
}
hadd -m %throw pos $hget(%throw,y)
drawdot -n @Throw $hget(%throw,color) 20 $hget(%throw,x) $hget(%throw,y)
drawdot @Throw
if ($left($calc($hget(throw,gravity) / $hget(%throw,speed)),4) != -2.6) .timerthrow $+ $1 -m 1 25 throwball $1
else {
drawdot -n @Throw $hget(Throw,BC) 20 $hget(%throw,x) $hget(%throw,y)
drawdot @Throw
}
}