openclonk/docs/sdk/script/fn/Angle.xml

57 lines
2.0 KiB
XML

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<!DOCTYPE funcs
SYSTEM '../../../clonk.dtd'>
<?xml-stylesheet type="text/xsl" href="../../../clonk.xsl"?>
<funcs>
<func>
<title>Angle</title>
<category>Arithmetics</category>
<version>1.0 OC</version>
<syntax>
<rtype>int</rtype>
<params>
<param>
<type>int</type>
<name>x1</name>
<desc>X coordinate of the first point</desc>
</param>
<param>
<type>int</type>
<name>y1</name>
<desc>Y coordinate of the first point</desc>
</param>
<param>
<type>int</type>
<name>x2</name>
<desc>X coordinate of the second point</desc>
</param>
<param>
<type>int</type>
<name>y2</name>
<desc>Y coordinate of the second point</desc>
</param>
<param>
<type>int</type>
<name>precision</name>
<desc>Multiplied with the angle. For a higher precision while working with integers (whole numbers) you can specify a higher precision value. A precision of 10 will produce values from 0 to 3600.</desc>
<optional />
</param>
</params>
</syntax>
<desc>Returns the view angle from the first point to the second in degrees. 0° ist straight up. All coordinates global.</desc>
<examples>
<example>
<code><funclink>SetR</funclink>(Angle(<funclink>GetCursor</funclink>(0)-><funclink>GetX</funclink>(), <funclink>GetCursor</funclink>(0)-><funclink>GetY</funclink>(),
<funclink>GetCursor</funclink>(1)-><funclink>GetX</funclink>(), <funclink>GetCursor</funclink>(1)-><funclink>GetY</funclink>() ));</code>
<text>The object rotates so it points from the clonk of player 1 to the clonk of player 2.</text>
</example>
</examples>
<related>
<funclink>Cos</funclink>
<funclink>Sin</funclink>
</related>
</func>
<author>jwk</author><date>2002-04</date>
<author>Clonk-Karl</author><date>2004-09</date>
</funcs>