From ZDoom Wiki
Jump to navigation Jump to search

This function acts as an extension to VectorAngle, it returns the relative angle of a thing with tid2, from a thing with tid1.

function int GetTargetAngle (int tid1, int tid2)
    int x, y;
    x = GetActorX(tid2) - GetActorX(tid1);
    y = GetActorY(tid2) - GetActorY(tid1);
    return VectorAngle(x, y);