gettargetangle

From ZDoom Wiki
Revision as of 21:13, 31 December 2010 by Ijon Tichy (talk | contribs) (exstension -> extension)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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);
}