Sqrt

Category: Arithmetics
Since engine version: 4.6.5.0 CP

Description

Returns the square root of the first parameter. If the parameter is less than 0, the result is 0.

Syntax

int Sqrt (int iValue);

Parameter

iValue:
Value of which you want to take the square root

Example

global func ObjectDistance(pObj1, pObj2)
{
  var dx = GetX(pObj1) - GetX(pObj2);
  var dy = GetY(pObj1) - GetY(pObj2);
  return(Sqrt(dx*dx+dy*dy));
}
Returns the distance between two objects. Notice there's also an engine function ObjectDistance.
See also: Distance, ObjectDistance
Sven2, November 2001