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...")
 
(Examples)
 
(One intermediate revision by the same user not shown)
Line 8: Line 8:
 
   
 
   
 
  '''Description:'''
 
  '''Description:'''
   This function will return the distance between two points.
+
   Returns the distance between two points.
 
      
 
      
 
==Examples==
 
==Examples==
Line 15: Line 15:
 
     Dist := Distance(Players[1].X,Players[1].Y,Players[2].X,Players[2].Y);
 
     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)));
 
     WriteLn('The distance between player 1 and player 2 is '+inttostr(round(Dist)));
end;
+
end.
 
</source>
 
</source>
  
  
 
[[Category:Functions]]
 
[[Category:Functions]]

Latest revision as of 16:47, 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.