yrotate object intRobot, atanfull(x#-x2#, z#-z2#)
where :
x#, z# are coords of Robot u want to point to
x2#, z2# are coords of your Robot
intRobot is object number of the robot you want to rotate
Yeah.. I knew it had somthing to do with Tan or Cos or some similar Mathamatical Thingy, I just could not work it out, I think I missed that day at school
.
I tried that code snippet, It did not work at first, but after a while I tried reversing the variables and my robot follows the target with total accuracy now
Thanks for the help
Below is the final gobbldigook of a peice of code that works
Direction = ATanFull(BBX-TBX,BBZ-TBZ)
`
Set Cursor 100,100
Print "Direction:- ";Direction;"."
Print TBX-BBX
Print TBZ-BBZ
`If Direction=<0 Then Direction=Direction-(Direction*2)
`Print "Reversed Direction:- ";Direction
YRotate Object 2,Direction
`
If Inkey$()="w" Then TBZ=TBZ+5
If Inkey$()="x" Then TBZ=TBZ-5
If Inkey$()="a" Then TBX=TBX+5
If Inkey$()="d" Then TBX=TBX-5
I guess its time to move onto phase 2... guess its time to think what phase 2 is going to be
.
Know Thy Enemy...