x


How to change the alpha of a spawned particle?

Hello,

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

more ▼

asked Jan 29 '11 at 10:00 PM

DanMarionette gravatar image

DanMarionette
177 11 12 21

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

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.

more ▼

answered Jan 29 '11 at 10:53 PM

anomalous_underdog gravatar image

anomalous_underdog
335 3 6 18

Thanks, this is perfect.

Jan 30 '11 at 12:45 AM DanMarionette
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3926
x659
x526
x340
x252

asked: Jan 29 '11 at 10:00 PM

Seen: 2360 times

Last Updated: Jan 29 '11 at 10:00 PM