ASSIGNING PARTICLE TYPES TO EMITTERS
|
After creation, emitters are empty by default. You will have to
attach one or more particle types to it. We
will show you how to design particle types into
detail later. For now, let's just create a simple
default particle type:
MyParticleType = CreateParticleType()
If you dont define any attributes for a particle
type, a simple default particle type will be created.
Just something to test with. Now attach this type
of particle to your emitter:
Emitter_AddParticleType(MyEmitter, MyParticleType, A%, B%, C%)
Here's an explanation of the command's parameters:
A = Delay time (in milliseconds) of that particle kind. If you
set a delay time of 0, this particle type will be emitted as soon
as you launch this emitter. Or, if set to 1000,
for example, the particles of this kind will start emitting one second
after the emitter was launched. You can create nice effects using a different
delay time for each assigned particle type.
B = The duration of the particle emission in milliseconds (counted from
the moment they started emitting).
C = Emission rate per second. If set to 50, for example, the emitter will
spray 50 particles of that type per second.
You can assign up to 10 different particle types to an emitter.
This is really enough for 99% of all effects you can imagine.
You may also change this limit by tweaking the Constant 'PT_PARTICLE_TYPES'
at the top of the 'particle candy.bb' file to any other value.
|
UPDATING ATTACHED PARTICLE TYPES
|
With version 1.4.9, a new command has been introduced:
Emitter_UpdateSlot MyEmitter%, SlotID%, A%, B%, C%
Using this command, you can change a particle type's emission rate, start time and duration at any later time again. The parameters are the same as with the AddParticleType()-command above:
A = Delay time (in milliseconds) of that particle type
B = The duration of the particle emission in milliseconds
C = Emission rate per second.
Note, that you must provide an Emitter ID and a Slot ID here. A Slot ID can be obtained when you attach a particle
type to an emitter:
SlotID% =
Emitter_AddParticleType (MyEmitter%, MyParticleType%, A%, B%, C%)
So Slot ID is the returned slot number of the emitter where this particle type has been attached to.
To learn more about an emitter's particle slots, please refer to this chapter.
|
|