Category: Arithmetics
Since engine version: 1.0 OC
Distance
Description
Calculates the distance between two points. Same as Sqrt((x2-x1)^2 + (y2-y1)^2;).
Syntax
int Distance(int x1, int y1, int x2, int y2);
Parameters
- x1:
- X coordinate of the first point.
- y1:
- Y coordinate of the first point.
- x2:
- X coordinate of the second point.
- y2:
- Y coordinate of the second point.
Example
GetCursor(0)->Message("Quick, you are only %d Clonks away from the goal!", Distance(GetX(GetCursor(0)), GetY(GetCursor(0)), 1000, 200));
Displays the distance of the clonk from point 1000/200.
See also: ObjectDistance