jan_flanders

Untitled

May 4th, 2012
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function fire()
  2. {
  3.     if(reloaded)
  4.     {
  5.         x=_root.getNextHighestDepth();
  6.         var bullet:MovieClip=_root.attachMovie("bullet", "bullet"+x, x);
  7.         bullet._x=Weapon_MC._x;
  8.         bullet._y=Weapon_MC._y;
  9.         randomNum=random(bulletOffset)/2;
  10.         bullet._rotation=Weapon_MC._rotation+randomNum;
  11.         bullet.xSpeed=Math.cos(Math.PI/-270 * bullet._rotation)*bulletSpeed;
  12.         bullet.ySpeed=Math.sin(Math.PI/-90 * bullet._rotation)*bulletSpeed;
  13.         bullet.life=0;
  14.         bullet.onEnterFrame=function()
  15.         {
  16.             this._x+=this.xSpeed;
  17.             this._y+=this.ySpeed;
  18.             this.life++;
  19.             if(this.life>totalLife)
  20.             {
  21.                 this.removeMovieClip();
  22.                 this.unloadMovie();
  23.             };
  24.             trace([this, _root.enemy_mc,this.hitTest(_root.enemy_mc]
  25.             if (this.hitTest(_root.enemy_mc))
  26.             {
  27.                 trace ("ENEMY HITTTTTTTTTTTTTTTTT");
  28.                 this.removeMovieClip();
  29.             }
  30.         };
  31.         reload();
  32.     };
  33. };
Advertisement
Add Comment
Please, Sign In to add comment