towards
xcor ycor
Parameters:
xcor |
Number |
X coordinate on the screen |
ycor |
Number |
Y coordinate on the screen |
Description:
Returns the angle from the caller's xcor and ycor to the specified absolute position specified by xcor
and ycor
.
Examples:
towards 1 1
returns 45
when run by a turtle at (0, 0)
.
towards 1000 1000
returns 225
when run by a turtle at (0, 0)
and the screen-width and screen-height are both 101.
Notes:
The observer is considered to be located at (0, 0)
.
The StarLogo world wraps, so if you want to know the angle to an xcor
and ycor
that are off the screen, they will be modded by screen-width
and screen-height
until they point to a position within the screen and that angle returned. Thus if you want to see the direction towards (1000, 1000) it might just be off to the lower left of you instead of the upper right.
Related Commands:
distance
distance-nowrap
towards-nowrap