How to change the alpha of a spawned particle?


I have some particles(space dust) that spawn from an emitter attached to the players space ship. I want the dust to give the player a sense of motion when the move their ship. What I'm looking for is to set the alpha of the particles based on the ships velocity.

So as the player slows down the particles fade away and as they speed up the particles become brighter.

This means changing the alpha value of particles that have been emitted.

Any help would be great. Thanks

Get the instance of the Particle Animator and edit ParticleAnimator.colorAnimation. Its an array of 5 colors. A color has an alpha value that goes from 0.0 to 1.0. With 1.0 being fully opaque.

Have the first color's alpha set to 0.0, the third and preceding colors' alpha set to 0.0.

When the velocity changes, store the ParticleAnimator.colorAnimation in a temporary variable, change the alpha of the second color depending on the ship's velocity, then assign the value back to ParticleAnimator.colorAnimation.

That's the basic idea.