PDA

View Full Version : Smoke trail effects


Firebert
03-07-2007, 11:22 PM
I need some help with smoke (apparently). I'm making a game for a school project/web site and i need to learn how to make action script smoke, but its for missiles that the player (a jet) shoots at enemies. all i need it for the smoke to make a trail, following the missile and dissipating upwards.



any ideas help or suggestions?

BernzSed
03-10-2007, 06:11 PM
You mean something like the attached file?

I might have a little trouble digging up the code for that, so I'll explain how I did it.

First, the way to add a particle is to attach a movieclip from the library. As the movieclip in the library animates, it changes color, then fades, until finally it reaches a keyframe with the code "removeMovieClip()".

Now, the key to having the smoke follow the jet/missile is to have the jet/missile be a movieclip that attaches the particle movieclip on every frame. The trick is, it attaches the particle movieclip to a separate movieclip on the root timeline, but then sets the _x and _y variables of the particle so that the particle starts off behind the jet/missile. You can use the localToGlobal() function to determine what the coordinates should be.

So, since you tween the missile movieclip, the position of the missile movieclip is different on every frame, and therefore the starting position of each new particle is different every frame.

I hope that helps!