Game Development Reference
In-Depth Information
this.position.iadd(this.velocity.muls(td));
}
}
Emitters
Nothing comes from nothing. Unlike virtual particles in physics, our particles don't pop into existence
spontaneously; they are created by the emitter. The emitter gives particles their initial attributes, including
their position. Note that the emitter is a purely abstract concept and can be implemented in many different
ways.
The following are examples of emitters:
onclick emitter
one time emitter
constant emitter
Forces
After particles have been created by the emitters, they will be affected by the forces of the particle system.
It's important that those forces are very different from the concept of a force in Newtonian physics. The
interface for a force is as follows:
function force(particle, td){
}
td is the time that has passed since the last update.
A simple example of this is gravity:
function gravity(particle, td){
particle.velocity.y += 50*td;
}
The following are other examples of forces:
acceleration
damping
wind
attraction
repulsion
I will cover a more abstract way to create forces in the next section.
 
Search WWH ::




Custom Search