0509

From GTAMods Wiki
Revision as of 22:37, 13 May 2010 by Spaceeinstein (talk | contribs) (Created page with '{{OpCode | ini = 0509=5,%5d% %1d% %2d% %3d% %4d% | description = Gets the distance between X,Y coordinates | p1 = X1-coordinate | p2 = Y1-coordinate | p…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

{{{games}}}


Description
Gets the distance between X,Y coordinates
Syntax
{{{syntax1}}}
Parameter
Native analog
GET_DISTANCE_BETWEEN_COORDS_2D

This opcode calculates the distance between two X,Y coordinate points. It uses the distance formula in rectangular coordinate system to calculate the distance between the points. The value is stored in the variable as a floating-point value. Use opcode 050A to calculate between two X,Y,Z coordinate points. Note that the parameters of this opcode are rearranged.

Sanny Builder example:

0509: 0@ = distance_between_point 0.0 0.0 and_point 100.0 100.0

Note

The above format is more commonly used. The actual format of this opcode is in order:
0509=5,%1d% %2d% %3d% %4d% %5d%
The format to use depends on which INI file you use.