Hi again...Somehow you are right...we have to refer an angle, but we can get the same result just refering both x,z of starting point and ending point. Here you can see that with the x,z coords of two points( objects )...perhaps ATANFULL is the way you are looking for.
autocam off
sync on
make object box 1,1,5,1
position object 1,20,0,10
yrotate object 1,60
make object box 2,1,5,1
position object 2,10,0,10
color object 2,rgb(0,255,0)
position camera 0,30,-30
point camera 0,10,0
speed#=0.03
do
`getting player angle before moving
oldang=object angle y(1)
`pointing player object to enemy object to get desired angle
point object 1,object position x(2),object position y(2),object position z(2)
`getting actual player angle
lastang=object angle y(1)
`updating player angle after being pointing enemy position
yrotate object 1,oldang
set cursor 0,5
print "Player angle ",oldang
print "Enemy angle ",lastang
print "Atanfull angle ",angle
REM gettin angle with atanfull
ax#=object position x(1)
bx#=object position x(2)
ay#=object position z(1)
by#=object position z(2)
angle = atanfull(bx#-ax#, by#-ay#)
`enemy movements...
if upkey()=1 then x#=newxvalue(x#,a#,speed#) : z#=newzvalue(z#,a#,speed#)
if downkey()=1 then x#=newxvalue(x#,a#,-speed#) : z#=newzvalue(z#,a#,-speed#)
if leftkey()=1 THEN x#=NEWXVALUE(x#,a#-90,speed#)
if leftkey()=1 then z#=NEWZVALUE(z#,a#-90,speed#)
if rightkey()=1 THEN x#=NEWXVALUE(x#,a#-90,-speed#)
if rightkey()=1 then z#=NEWZVALUE(z#,a#-90,-speed#)
position object 1,x#,0,z#
Line object screen x(1), object screen y(1), object screen x(2), object screen y(2)
sync
loop
Cheers.
I'm not a grumpy grandpa
