Particle behaviors (particles doing things):
Use p:addBehavior(particle type, behavior type, parameters, trigger)
particle type is the type of particle this behavior will happen in
behavior type is the type of behavior the particles will do.
parameters is the parameter table (look above if you don’t know what that is)
trigger I’ll go into more detail about this later, but this allows you to only have certain behaviors happen when certain events happen.
Behaviors:
timeout: This behavior will make a particle delete itself after a set amount of time.
Parameters:
time: the amount of frames that the particle will delete itself after.
chance_timeout: This behavior will make a particle have a chance to delete itself every frame.
Parameters:
chance: Each frame, the particle has a 1 / this chance to delete itself.
spawn_particle: This behavior will make a particle spawn another particle after a set amount of time.
Parameters:
type: the type of particle that will be spawned in. Defaults to the type of particle that spawned it in.
time: the amount of time from the first particle’s creation to the spawning in the next particle.
amount: how many particles will be spawned in
chance_spawn_particle: This behavior will make a particle have a chance to spawn another every frame.
Parameters:
chance: the chance that another particle will spawn in a given frame is 1 / this.
type: this is the type of particle that will spawn in. Defaults to the same type of particle that spawned it in.
amount: how many particles will be spawned in
loop_spawn_particle: This behavior will make a particle spawn in another on a time interval.
Parameters:
time: the amount of frames between particle spawn.
type: this is the type of particle that will spawn in. Defaults to the same type of particle that spawned it in.
amount: how many particles will be spawned in.
NOTE: When a particle is spawned from another, it will keep the same velocity. To disable this, use the “init_velocity” behavior.
wander: this will make a particle jiggle around in a smooth way.
Parameters:
amount: how intense the jiggling is.
move_straight: this will make the particles move in a straight line.
Parameters:
dir: the direction of the particles’ movement. 0 degrees is right, 90 degrees is up, etc. defaults to 90 degrees (up)
speed: how fast the particles will move.
gravity: this will cause gravity to be applied to a particle.
Parameters:
x, y: the forces that will be applied to the particle.
timeout_radius: will cause the particle to despawn if it goes too far away from the center of the screen.
Parameters:
radius: the max distance a particle can be without despawning.
loop_change_direction: Will make the particle “zig-zag” around the screen, changing directions on a time interval
Parameters:
speed: the speed that the particles will move at.
time: the amount of frames between direction changes.
chance_change_direction: Will make the particle “zig-zag” around the screen, changing direction randomly.
Parameters:
chance: the chance that the particle will change direction on any given frame is 1 / this.
speed: the speed that the particles will move at.
init_velocity: Causes a particle to start at a specific velocity when it spawns.
Parameters:
x, y: the x and y velocity the particle will start at.