It took me a while, but I figured it out. This function will point any sprite to any point you specify. It will only work for DBPro because of the rotate sprite command.
Function point_sprite(spritenum,x,y)
a# = atan((sprite x(1)-x)/(sprite y(1)-y))
Rotate sprite spritenum,-a#
Endfunction
The "atan" command is not very accurate so the sprite is not always exactly pointed the right direction (I'm trying to fix that).
Heres a demo:
Box 1,1,20,100
Get image 1,1,1,20,100
Do
x=10
y=10
Sprite 1,mousex(),mousey(),1
Point_sprite(1,x,y)
Line sprite x(1),sprite y(1),x,y
Line sprite x(1),sprite y(1),x,sprite y(1)
Line x,y,x,sprite y(1)
Loop
Function point_sprite(spritenum,x,y)
a# = atan((sprite x(1)-x)/(sprite y(1)-y))
Rotate sprite spritenum,-a#
Endfunction
All programmers are playwrights and all computers are lousy actors." -Anon.
<--- Uh... Um... Oh I forgot