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

97 lines
3.7 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>CreateParticle</title>
<category>Particles</category>
<version>3.4 OC</version>
<syntax>
<rtype>bool</rtype>
<params>
<param>
<type>string</type>
<name>particle_name</name>
<desc>Name of the particle definition.</desc>
</param>
<param>
<type>int</type>
<name>x</name>
<desc>X-coordinate of the new particle (relative to object for local calls).</desc>
</param>
<param>
<type>int</type>
<name>y</name>
<desc>Y-coordinate of the new particle (relative to object for local calls).</desc>
</param>
<param>
<type>int</type>
<name>speed_x</name>
<desc>Starting speed of the particle in x-direction. Can also be a value provider function.</desc>
</param>
<param>
<type>int</type>
<name>speed_y</name>
<desc>Starting speed of the particle in y-direction. Can also be a value provider function.</desc>
</param>
<param>
<type>int</type>
<name>lifetime</name>
<desc>Time in frames that the particle will be alive before it is removed. Can also be a value provider function. If set to 0, the particle will not be removed automatically.</desc>
</param>
<param>
<type>proplist</type>
<name>properties</name>
<desc>PropList with the particle attributes (see the <emlink href="particle/index.html#attributes">particle documentation</emlink>).</desc>
</param>
<param>
<type>int</type>
<name>amount</name>
<desc>Amount of particles to create. Defaults to 1.</desc>
</param>
</params>
</syntax>
<desc>Creates a new particle with the given properties. Note that particle creation is not necessarily synchronized over the network and thus, the return value is not whether the particle was actually created but whether the particle definition was found.</desc>
<remark>See the <emlink href="particle/index.html">particle documentation</emlink> for further explanations.</remark>
<examples>
<example>
<code>
var particles =
{
Size = <funclink>PV_KeyFrames</funclink>(0, 0, 0, 200, 50, 1000, 0),
DampingX = 900,
DampingY = 900,
R = 255,
G = <funclink>PV_Linear</funclink>(255, 0),
B = <funclink>PV_Linear</funclink>(128, 0),
Alpha = <funclink>PV_Linear</funclink>(255, 0),
Rotation = <funclink>PV_Direction</funclink>(),
Stretch = <funclink>PV_Speed</funclink>(5 * 1000),
ForceY = <funclink>PV_KeyFrames</funclink>(0, 0, 0, 900, 0, 1000, -20),
ForceX = <funclink>PV_Random</funclink>(-5, 5, 15),
Phase = <funclink>PV_Step</funclink>(1, 0, 10)
};
<funclink>CreateParticle</funclink>("Fire", 0, 0, <funclink>PV_Random</funclink>(-200, 200), <funclink>PV_Random</funclink>(-200, 200), <funclink>PV_Random</funclink>(18, 38 * 5), particles, 100);
</code>
<text>Casts 100 particles with a previously defined behavior.</text>
</example>
</examples>
<related>
<funclink>PV_Linear</funclink>
<funclink>PV_Direction</funclink>
<funclink>PV_Random</funclink>
<funclink>PV_Step</funclink>
<funclink>PV_Speed</funclink>
<funclink>PV_KeyFrames</funclink>
<funclink>PV_Sin</funclink>
<funclink>PV_Wind</funclink>
<funclink>PV_Gravity</funclink>
<funclink>PC_Die</funclink>
<funclink>PC_Bounce</funclink>
<funclink>PC_Stop</funclink>
</related>
</func>
<author>Zapper</author><date>2013-10</date>
</funcs>