INNER CODE UNIT · C#
distance
ArcadeMakerSources/ArcadeMaker · src/ArcadeMaker.Core/IGame.Funcs.cs:434
double distance = Math.Formulas.DistanceBetween(args[0]!.Number, args[1]!.Number, inst.X.Value!.Number, inst.Y.Value!.Number);
if (first || distance < nearest.Value)
nearest = new(inst, distance);
first = false;
}
}
return nearest.Key;
}
/// <summary>
/// Returns the instance in the room which is the furthest from a given point.
/// </summary>
/// <param name="_"></param>
/// <param name="args">(pointX, pointY, type (null for any)).</param>
/// <returns>The furthest instance, or <c>null</c> if there is no any instance in the room.</returns>
[EngineFunc(2, 3, 4)]
[Param("x", ParamType.Number, "Position x.")]