I might be missing something but doesn't this do the same thing...
or here if you want a homing missile?
Graphics 640,480 Global my_x#=100.0,my_y#=100.0, pointx#=100.0,pointy#=100.0,xspeed#=3.0,yspeed#=3.0 While Not KeyHit(1) Cls DrawLine my_x,my_y,MouseX(),MouseY() DrawOval my_x-10.0,my_y-10.0,20,20 DrawText "my_x : " + my_x + " my_y : " + my_y,0,0 DrawText "Point_x : " + pointx + " Point_y : " + pointy,0,10 ' If MouseDown(1) moveoval() moveoval() Flip Wend Function moveoval() pointx# = Float(MouseX()) pointy# = Float(MouseY()) angle# = ATan2((pointy-my_y),(pointx-my_x)) xmov# = Cos(angle) * xspeed ymov# = Sin(angle) * yspeed my_x# = my_x + xmov my_y# = my_y + ymov DrawText ((my_x-pointx)*(my_x-pointx)) + ((my_y-pointy)*(my_y-pointy)),0,20 If ((my_x-pointx)*(my_x-pointx)) + ((my_y-pointy)*(my_y-pointy)) < 10.0 my_x=pointx my_y=pointy EndIf End Function
or here if you want a homing missile?