VectorAngle
From ZDoom Wiki
int VectorAngle (int x, int y)
Usage
Returns the fixed point angle of the vector (x,y). Angles are measured from the east and moving counterclockwise.
Parameters
- x, y
- Coordinates of the end point of the vector.
Return value
Fixed point angle of the vector (x,y).
Examples
This script will print a little ^ at the botton of the player's screen pointing at the actor with TID set to 1:
script 1 ENTER { int vang, angle; while(1) { vang = VectorAngle (GetActorX (1) - GetActorX (0), GetActorY (1) - GetActorY (0)); angle = (vang - GetActorAngle (0) + 1.0) % 1.0; if (angle < 0.2 || angle > 0.8) { int sx = 320 - (320 * Sin (angle) / Cos (angle)); SetHudSize (640, 480, 0); HudMessage (s:"^"; HUDMSG_PLAIN, 1, CR_RED, sx * 1.0, 480.2, 0); } else { HudMessage (s:" "; HUDMSG_PLAIN, 1, CR_RED, 0, 0, 0); } Delay (1); } }

