1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
<?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>SimFlight</title>
<category>Objects</category>
<subcat>Movement</subcat>
<version>5.1 OC</version>
<syntax>
<rtype>array</rtype>
<params>
<param>
<type>int</type>
<name>x</name>
<desc>X offset of the starting position. (NOT optional if used in <code>nil</code> object context)</desc>
<optional />
</param>
<param>
<type>int</type>
<name>y</name>
<desc>Y offset of the starting position. (NOT optional if used in <code>nil</code> object context)</desc>
<optional />
</param>
<param>
<type>int</type>
<name>xdir</name>
<desc>Initial horizontal speed. If not specified this will default to the object's horizontal speed. (NOT optional if used in <code>nil</code> object context)</desc>
<optional />
</param>
<param>
<type>int</type>
<name>ydir</name>
<desc>Initial vertical speed. If not specified this will default to the object's vertical speed. (NOT optional if used in <code>nil</code> object context)</desc>
<optional />
</param>
<param>
<type>int</type>
<name>min_density</name>
<desc>Minimum density of the material which will stop the projected trajectory. If not specified this will default to value 50 (solid material).</desc>
<optional />
</param>
<param>
<type>int</type>
<name>max_density</name>
<desc>Maximum density of the material which will stop the projected trajectory. If not specified this will default to value 100.</desc>
<optional />
</param>
<param>
<type>int</type>
<name>iterations</name>
<desc>Number of simulated frames for which the projection runs. If not specified or nonpositive the simulation will run indefinitely until material or the limits of the landscape are encountered.</desc>
<optional />
</param>
<param>
<type>int</type>
<name>precision</name>
<desc>Precision of the velocity input and output parameters (<code>xdir</code>, <code>ydir</code>, <code>xdir_final</code> and <code>ydir_final</code>). Defaults to 10 if not specified.</desc>
<optional />
</param>
</params>
</syntax>
<desc>Simulates the motion of a falling object with a given starting position and initial speed. The returned array will contain [int x_final, int y_final, int xdir_final, int ydir_final, int time_passed]. <br/> If the projected trajectory encounters a material of the specified density, the simulation will stop and time_passed will be non-negative. Otherwise, time_passed will be negative.</desc>
<examples>
<example>
<code>if (<funclink>GetAction</funclink>() == "Jump")
{
var end = SimFlight()
if (end[3] >= 80)
<funclink>Message</funclink>("Oh oh, this will be a rough impact!");
}</code>
<text>If the calling clonk is situated in mid-air and it appears that he will hit the ground at high speed, he will call out.</text>
</example>
</examples>
</func>
<author>Newton</author><date>2004-03</date>
<author>Peewee</author><date>2010-10</date>
</funcs>
|