ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:length2d

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
functions:length2d [2017/03/15 21:22] korshunfunctions:length2d [2017/03/17 18:13] (current) – [Example] korshun
Line 1: Line 1:
 ====== length2d ====== ====== length2d ======
-{{tag>math vectors}}+{{tag>math vectors zandronum implemented_in_zdoom}}
 ''fixed length2d(fixed x, fixed y)'' ''fixed length2d(fixed x, fixed y)''
  
Line 13: Line 13:
 length2d(3.0, 4.0) -> 5.0 length2d(3.0, 4.0) -> 5.0
 </code> </code>
 +
 +Show XY distance between actors:
 +<code>
 +int x = GetActorX(tid2) - GetActorX(tid1);
 +int y = GetActorY(tid2) - GetActorY(tid1);
 +int distance = length2d(x, y),
 +print(s:"The two actors are ", f:distance, s:" mapunits apart on the automap");
 +</code>
 +
 +<note tip>Use [[ActorDistance2D]] instead of the example code above.</note>
  
 ===== See also ===== ===== See also =====
functions/length2d.1489605773.txt.gz · Last modified: 2017/03/15 21:22 by korshun