Distance

Category: Arithmetics
Since engine version: 4.6.5.0 CP

Description

Calculates the distance between two points. Same as Sqrt((iX2-iX1)^2 + (iY2-iY1)^2;).

Syntax

int Distance (int iX1, int iY1, int iX2, int iY2);

Parameters

iX1:
X coordinate of the first point
iY1:
Y coordinate of the first point
iX2:
X coordinate of the second point
iY2:
Y coordinate of the second point

Example

Message("Schnell, noch %d Clonks trennen dich vom Ziel!", 0, Distance(GetX(GetCursor(0)), GetY(GetCursor(0)), 1000, 200));
Displays the distance of the clonk from point 1000/200.
See also: ObjectDistance
Sven2, November 2001