The CODE SNIPPET:
hide mouse
dim pos#(2)
dim dotpos#(2):dotpos#(1)=320:dotpos#(2)=240
sync on
sync rate 10
Do
Cls
`Find Gradient
xGrad# = mousex() - pos#(1)
yGrad# = mousey() - pos#(2)
Grad# = Abs(yGrad#) / Abs(xGrad#)
if pos#(1)<mousex() then pos#(1)=pos#(1)+1
if pos#(1)>mousex() then pos#(1)=pos#(1)-1
if (Grad#<>0) and (Pos#(1)<>0) then Pos#(2) = Grad# * Abs(Pos#(1))
`Red + Green connecting line
ink rgb(25.5,25.5,25.5),0:line pos#(1),pos#(2),mousex(),mousey()
`Red Circle
ink rgb(255,0,0),0:circle pos#(1),pos#(2),5
`Green circles
ink rgb(0,255,0),0:circle mousex(),mousey(),5
ink rgb(0,100,0),0:circle mousex(),mousey(),10
ink rgb(0,50,0),0:circle mousex(),mousey(),15
ink rgb(0,25,0),0:circle mousex(),mousey(),20
`Grey/Yellow cirlces
ink rgb(128,128,0),0:circle dotpos#(1),dotpos#(2),1
ink rgb(255,128,0),0:circle dotpos#(1),dotpos#(2),3
sync
loop
I don't exactly what you were trying to do - but the JUMPY red circle seemed screwed up - so I just added a verification that your GRADIENT math wasn't returning ZERO from having a ZERO value in each parameter for the formula. Jumpy... a bit... but cirlce doesn't jump top to bottom etc. Is that what you were shooting for? Or did I add unneccessary code ?
Later!

(p.s. good luck in competition)

-=/Jaze/=-