Difference between revisions of "ScriptCore3.Distance"

From Soldat Community Wiki
Jump to: navigation, search
(Created page with " ''function Distance(X1, Y1, X2, Y2: Single): Single;'' '''Parameter Info:''' X1 (Single): X coordinate of first coordinate. Y1 (Single): Y coordinate of first coordina...")
 
Line 8: Line 8:
 
   
 
   
 
  '''Description:'''
 
  '''Description:'''
   This function will return the distance between two points.
+
   Returns the distance between two points.
 
      
 
      
 
==Examples==
 
==Examples==

Revision as of 13:43, 1 May 2018

function Distance(X1, Y1, X2, Y2: Single): Single;

Parameter Info:
 X1 (Single): X coordinate of first coordinate.
 Y1 (Single): Y coordinate of first coordinate.
 X2 (Single): X coordinate of second coordinate.
 Y2 (Single): Y coordinate of second coordinate..

Description:
 Returns the distance between two points.
   

Examples

var Dist: Single;
begin
    Dist := Distance(Players[1].X,Players[1].Y,Players[2].X,Players[2].Y);
    WriteLn('The distance between player 1 and player 2 is '+inttostr(round(Dist)));
end;