5 Replies Latest reply on Feb 22, 2011 11:27 AM by Ned Murphy

    Rotate movieclip in an array

    rockwar

      I have created an array on my main timeline to fire melons constantly. I  need the melon to rotate through the air I know that I can use a  variable of rotate but I cant figure out where to put it. Advice and  help is appreciated, thanks.

       

       

      //melons
      var melonSpeed=10;
      var melonReady=true;
      var melonDelay=100;
      var melonAmount=0;
      var melonArray=[];

      function createMelons(){
           var melonMc=this.attachMovie("melon","melon"+melonAmount, 1000+melonAmount);
           melonAmount++;
           melonMc._x= _root.hero._x;
           melonMc._y= _root.hero._y;
           melonArray.push(melonMc);
          
      }
      function moveMelons(){
           if(melonReady && Key.isDown(Key.SPACE)){
               melonReady=false;
               currentTime=getTimer();
               createMelons();
              
           }else{
               if(currentTime+melonDelay<=getTimer()){
               melonReady=true;
           }
           }
           for(var i=0; i<melonArray.length; i++){
               melonArray[i]._x+=melonSpeed;
              
           }
          
           }

      onEnterFrame = function(){

           moveMelons();