atanfull() demo
try this.
remstart
"How do I get an angle value using a x# pos and a z# pos.
The way I get the value at the moment,
I point an object using the point command and get the y# value of that object.
I'd like to use a more professional way."
remend
Rem Project: GetAngleFrom2DCoordinate
Rem Created: 16/07/2003 00:14:38
Rem Author: Lee 'Dr DB' Bamber :)
rem Set coordinates
youx#=320 : youy#=240
rem Main loop
do
rem Set moving target coordinate
targetx#=mousex() : targety#=mousey()
rem Calculate angle from YOUR position to TARGET position
dx#=targetx#-youx#
dy#=targety#-youy#
angle#=atanfull(dx#,dy#)
rem Clear screen
cls
rem Draw coordinates
circle youx#,youy#,5
circle targetx#,targety#,5
rem Show angle by drawing line
line youx#,youy#,newxvalue(youx#,angle#,100),newzvalue(youy#,angle#,100)
center text 320,260,"ANGLE = "+str$(int(wrapvalue(angle#)))
rem End loop
loop
windowsXp