class punchZoneObject extends CollidableObject 
{
     public var currentLevel:Level; 
     public var range:Number;          //time spark remains
     
     function punchZoneObject(baseClip:MovieClip, category:String, thisLevel:Level, thisRange:Number) {
          super(baseClip, category);     
          this.range = thisRange;                         //how many frames does it last?
          this.elasticity = 0;                     // energy shots don't bounce
          this.isSubjectToFriction=false;          //energy shots don't slow down		
          this.isSubjectToGravity=false;          //energy shots don't fall off	
          this.currentLevel = thisLevel;
          this.canBeSurface=false;
          this.centerOrigin=true;
          this.inplay=true;
          this.radius = this.getWidth()/2;
          this.hitRadius = (this.baseClip.hitbox._width)/2;
     }     
     
     // Make updates every frame
     function processTicks(frameCount):Void {
          //trace("bullet in flight");
          super.processTicks(frameCount);
          this.range--;
          if (this.range<0)
          {
               currentLevel.removeMovingObject(this);
               currentLevel.removeCollidableObject(this);
               //currentLevel.removeCollidableObject(this);
               super.remove();               
               this.remove();               
          }
     }
     
     function remove():Void {
          //trace("remove spark");
          super.remove();
          currentLevel.removeMovingObject(this);
          currentLevel.removeCollidableObject(this);     
     }     
}

function shootPunchZone(attackCode:Number):Void
{
          var bulletClip:MovieClip
          if (attackCode==20)          //punch 1
          {
               bulletClip = this.currentLevel.baseClip.attachMovie("punchBox","punchBox",this.currentLevel.baseClip.getNextHighestDepth());
               if (this.category=="avatar")
               {
                    var newPunchZone:punchZoneObject = new  punchZoneObject(bulletClip,"punchBox1",this.currentLevel,1);
               }
          
               if (this.category=="opponent")
               {
                    var newPunchZone:punchZoneObject = new  punchZoneObject(bulletClip,"punchBox2",this.currentLevel,1);
               }
               
               newPunchZone.causeKnockDown=false;
               newPunchZone.attackKnockDownTime=0;
               newPunchZone.attackDamage=2;
               newPunchZone.attackStaggerTime=15;
               newPunchZone.attackRepelSpeed=5;
               newPunchZone.attackLaunchSpeed=0;
               newPunchZone.attackInvWindow=0;
               newPunchZone.blockStun=3;          
     
               newPunchZone.attackHeight=1;
               newPunchZone.attackStaggerLow=false;
               
               if (this.facing==true)
               {
                    newPunchZone.initPos(this.baseClip._x + 60.0, this.baseClip._y-170);
               }
               else
               {
                    newPunchZone.initPos(this.baseClip._x -60.0, this.baseClip._y-170);     
               }
                         
               var newSound:selfDestructSoundObject = new selfDestructSoundObject(_global.g.currentLevel);
               newSound.attachSound("elecMelee");
               newSound.start(0,0);     
               newSound.initSD();
               _global.g.currentLevel.addSound(newSound);
          }