Files
QtGameMaker/help/files/412_02_systems.html
T

132 lines
5.4 KiB
HTML
Raw Normal View History

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Particle systems</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>
<body background="images/back.gif">
<!--START-->
<h3>Particle systems</h3>
Particles live in particle systems. So to have particles in your game you need
to create one or more particle systems. There can be different particle
systems (but preferably keep their number small).
For example, if your game has a number of balls and each ball should
have a tail of particles, most likely each ball has its own particle system.
The easiest way to deal with particle systems is to create one and then
create particles in it, using the particle types you specified before.
But, as we will see below, particle systems can contain emitters that
automatically produce particles, attractors that attract them, and
destroyers that destroy them.
<p>
Once particles are added to a particle system they are automatically
updated each step and drawn. No further action is required. To make it possible
that particles are drawn, behind, in front of, or between object instances,
each particle system has a depth, similar to instances and tiles.
<p>
Particle systems will live on forever after they are created. So even if
you change room or restart the game, the systems and the particles remain.
So you better make sure you destroy them once you no longer need them.
<p>
The following basic functions deal with particle systems:
<p>
<blockquote>
<tt><b>part_system_create()</b></tt>
Creates a new particle system. It returns the index of the system.
This index must be used in all calls below to set the properties of
the particle system.<br>
<tt><b>part_system_destroy(ind)</b></tt>
Destroys the particle system ind. Call this if you don't need
it anymore to save space.<br>
<tt><b>part_system_exists(ind)</b></tt>
Returns whether the indicated particle system exists.<br>
<tt><b>part_system_clear(ind)</b></tt>
Clears the particle system ind to its default settings, removing
all particles and emitter and attractors in it.<br>
<tt><b>part_system_draw_order(ind,oldtonew)</b></tt>
Sets the order in which the particle system draws the particles.
When oldtonew is true the oldest particles are drawn first
and the newer one lie on top of them (default). Otherwise the
newest particles are drawn first. This can give rather different effects.<br>
<tt><b>part_system_depth(ind,depth)</b></tt>
Sets the depth of the particle system. This can be used to let the
particles appear behind, in front of, or in between instances.<br>
<tt><b>part_system_position(ind,x,y)</b></tt>
Sets the position where the particle system is drawn. This is normally
not necessary but if you want to have particles at a position relative
to a moving object, you can set the position e.g. to that object.<br>
</blockquote>
<p>
As indicated above, the particle system is automatically updated and drawn.
But sometimes this is not what you want. To facilitate this, you can switch
off automatic updating or drawing and then decide yourself when to update or
draw the particle system. For this you can use the following functions:
<p>
<blockquote>
<tt><b>part_system_automatic_update(ind,automatic)</b></tt>
Indicates whether the particle system must be updated
automatically (1) or not (0). Default is 1.<br>
<tt><b>part_system_automatic_draw(ind,automatic)</b></tt>
Indicates whether the particle system must be drawn
automatically (1) or not (0). Default is 1.<br>
<tt><b>part_system_update(ind)</b></tt>
This functions updates the position of all particles in the
system and lets the emitters create particles.
You only have to call this when updating is not automatic.
(Although sometimes it is also useful to call this function
a couple of time to get the system going.)<br>
<tt><b>part_system_drawit(ind)</b></tt>
This functions draws the particles in the system.
You only have to call this when drawing is not automatic.
It should be called in the draw event of some object.<br>
</blockquote>
<p>
The following functions deal with particles in a particle systems:
<p>
<blockquote>
<tt><b>part_particles_create(ind,x,y,parttype,number)</b></tt>
This functions creates <tt>number</tt> particles of the indicated type at postion (x,y) in the system.<br>
<tt><b>part_particles_create_color(ind,x,y,parttype,color,number)</b></tt>
This functions creates <tt>number</tt> particles of the indicated type at postion (x,y) in the system
with the indicated color. This is only useful when the particle type defines a single color (or does
not define a color at all).<br>
<tt><b>part_particles_clear(ind)</b></tt>
This functions removes all particles in the system.<br>
<tt><b>part_particles_count(ind)</b></tt>
This functions returns the number of particles in the system.<br>
</blockquote>
<!--END-->
</body>
</html>
<!-- KEYWORDS
part_system_create()
part_system_destroy()
part_system_exists()
part_system_clear()
part_system_draw_order()
part_system_depth()
part_system_position()
part_system_automatic_update()
part_system_automatic_draw()
part_system_update()
part_system_drawit()
part_particles_create()
part_particles_create_color()
part_particles_clear()
part_particles_count()
-->