Posted on December 5th, 2006
8265 views Mystic Particles - Worm tutorial alternative
Ben Fleming Another thing you can do with the worm tutorial. If you havent read that tutorial, do so here. In this tutorial, we will be making this. If you have taken the Create a Worm that "Follows" the Mouse tutorial, this will be easy. First, open up Flash. Start a new document, and put your framerate (FPS) at about 20-30. This is so it will be smooth. Then, go Insert > New Symbol, or Ctrl+F8. Use the following settings: Inside the Particle symbol, draw a 25x25 circle of the colour of your choice. Then, right-click on the first frame, and select Create Motion Tween. On about the 40th frame, add a keyframe, and set the circle's width and height to 1. Then move the circle up about 50-100 pixels, so it gives the effect of shooting out. Return to the main stage, and in the first frame, add this code: [code=Java]var depth:Number = 0; onEnterFrame = function() { newPart = "particle"+depth; _root.attachMovie("particle", newPart, depth); _root[newPart]._x = _root._xmouse; _root[newPart]._y = _root._ymouse; _root[newPart]._rotation = random(360); _root[newPart].onEnterFrame = function() { if(this._currentframe == 40) { this.removeMovieClip(); } } depth++; }[/code] I'll run you through it breifly.. We've created the depth variable, then an onEnterFrame loop. Inside there we've created a new variable newPart, which will contain the name of the newly attached clip. Then we've actually attached the Particle clip, with the linkage of particle, and given its new name, and then set its dimension, or depth. Then we've set its x and y positions to the mouse, and randomised its rotation (so it appears mystic). Then we create another onEnterFrame loop, but just for the object, and it constantly asks if the current frame is 40, and when it is, it removes the clip. Then we've closed the loop and the if statement, increased depth, and closed the main loop. There we go, test your movie. |