ACSUtils Wiki

An ACS library for ZDoom-based ports

User Tools

Site Tools


functions:length2d

Table of Contents

length2d

fixed length2d(fixed x, fixed y)

Description

Returns the length of the given 2D vector.

This is a Zandronum replacement for VectorLength.

Example

Egyptian triangle:

length2d(3.0, 4.0) -> 5.0

Show XY distance between actors:

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");
Use ActorDistance2D instead of the example code above.

See also

functions/length2d.txt · Last modified: 2017/03/17 18:13 by korshun