Join Todd Perkins for an in-depth discussion in this video Understanding how particle systems work, part of ActionScript 3.0: Building Particle Systems.
In this movie, we'll take a look at the general way that a particle system operates. The first thing we have is a particle class. The particle classes actually fairly simple. It has several properties that we can modify. We initialize the properties in the constructor, and we have an update method to update all the properties based on some pretty simple math. Believe it or not this is actually the same particle class that we're going to be using throughout most of this title. We're just going to add a little bit here and there and use it in different ways to create different types of particles that behave differently.
Animating many particles of the same time is called a particle system and in a particle system, you don't have control over all the individual particles, but rather you give each particle a range of values and the whole group of particles behaves a certain way. For example, I'll test the movie and you'll see the particles behind the boat shoot out to the left in a little bit. The fish particles come out when the fish makes a splash and the fish itself as a particle. And so it jumps up every few seconds and rotates into the direction it's moving.
Let's take a look of the particle code here for a particle system. We have some simple variables that dictate how many particles we're going to create, what a class we're going to use to create the particles. Then we use loops to generate the particles and to update them by running the update method. The particles are connected to the particle class via linkage properties. So that's a general idea of how a particle system works. We're going to have the same set up with a particle class, a particle system and movie clips connected to the particle class through this whole title.
So that's a look at our workflow. Now let's get started making some particles.