do you mean like this:
createsprite(1,0)
setspritesize(1,2,2)
do
posx=getpointerx()
posy=getpointery()
movedir(1,getspritex(1),getspritey(1),posx,posy,0.1)
Sync()
loop
function movedir(sprite,curx as float, cury as float,destx as float,desty as float, speed as float)
tmpx as float
tmpy as float
a as float
newx as float
newy as float
tmpx=destx-curx
tmpy=desty-cury
a=atanfull(tmpx,tmpy)-90
newx= curx+cos(a)*speed
newy= cury+sin(a)*speed
setspriteposition(sprite,newx,newy)
endfunction
function dist(x as float , y as float ,z as float, x1 as float ,y1 as float ,z1 as float)
dist as float
dist=sqrt( ((x-x1)^2)+((y-y1)^2)+((z-z1)^2) )
endfunction dist