3 Replies Latest reply on Jul 25, 2010 7:06 PM by kglad

    I'd like to make a plane fired bullets effect(help)

    liuzhijun

      I'd like to make a plane fired bullets, that i press the space bar to make three planes and one plane are automatically a shot. how shall i write.

      未命名.jpg

      this my code

      var m:Number = 1;
      var speed:Number = 3;
      onEnterFrame = function () {
             if (Key.isDown(Key.SPACE)) {
                    for (var i = 1; i<=3; i++) {
                           var _mc1:MovieClip = aa_mc.duplicateMovieClip("newaa_mc"+i, i+1000);
                           _mc1._x = aa_mc._x*i/3+78.8;
                           _mc1._y = aa_mc._y-30;
                           _mc1.onEnterFrame = function() {
                                  this._y -= speed;
                                  if (this._y<0) {
                                         this.removeMovieClip();
                                  }
                           };
                    }
             }
      };

       

      fired bullets film code

      var speed:Number = 1;
      function zidan() {
             m++;
             var _mc:MovieClip = zidan_mc.duplicateMovieClip("newzidan_mc"+m, m);
             _mc.onEnterFrame = function() {
                    this._y -= speed*10;
                    trace(this._y);
                    if (this._y>0) {
                           this.removeMovieClip();
                    }
             };
      }
      onEnterFrame = function () {
             zidan();
      };