6 Replies Latest reply on Jun 16, 2008 3:38 PM by velocity-vector

    creating turbulence

    velocity-vector Level 1
      hello --

      is there a script or a source for scripts for creating a turbulenbce like effect for an mc?

      is there something down and dirty?

      anway, i want to achieve something like a rocket re-entering the atmosphere. i have the flames shooting out. i would like to show the vehicle shaking just a little bit.

      thanks > mark
        • 1. Re: creating turbulence
          Ned Murphy Adobe Community Professional & MVP
          Try Googling "AS2 shake a movieclip"... you should find a few tutorials/examples.
          • 2. Re: creating turbulence
            clbeech Level 3
            you should be able to achieve this with just a little random incrementing, although you will probably want to keep track of the original position and return to it on each second iteration, in this way you will maintain the main position of the clip. it would look something like this:
            • 3. Re: creating turbulence
              velocity-vector Level 1
              many belated thanks!
              • 4. Re: creating turbulence
                velocity-vector Level 1
                you know i thought this would work but unfortunately i don't know what i'm doing.

                i've tried as many ways, from your original way, to whatever and it is dead. any help?

                function turboMov (mc, duration, distance) {
                var xpos = mc._x;
                var ypos = mc._y;
                var count = 0;
                var even = true;

                mc.onEnterFrame = function () {
                if (count<duration) {
                if (even) {
                var jumpX = ((-1)*distance) + Math.round(Math.random()*(2*distance));
                var jumpY = ((-1)*distance) + Math.round(Math.random()*(2*distance));
                mc._x += jumpX;
                mc._y += jumpY;
                even = false;
                } else {
                mc._x = xpos;
                mc._y = ypos;
                even = true;
                } else {
                delete onEnterFrame;
                mc._x = xpos;
                mc._y = ypos;

                turboMov("shake_mc", 5000, 10); //MC, frames, pixels
                • 5. Re: creating turbulence
                  clbeech Level 3
                  lol - that's ok. the code given above is designed for use with any MC that is on the stage. what you have pasted above has been changed - the onEnterFrame event is 'outside' the method - it should be within it - it won't work without being the way it is. you certainly can change the 'name' of the method to 'turboMov' but the rest of the code should remain the same. place it on the main timeline first frame then you can call it at any time, and 'point' to any clip. if the instance name of the clip you want to shake is 'shake_mc' then that's what you use, however without quotes. you can even call the method on more than one MC at a time, like:

                  turboMov(rocketA, 5000,10);
                  turboMov(rocketB, 2000, 10);
                  • 6. Re: creating turbulence
                    velocity-vector Level 1
                    eek-a-mouse! got it...

                    i wish i worked in flash everyday like you guys. thanks alot...