home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / kung_fu.swf / scripts / __Packages / com / KidFighting / skills / SklTailorRotate.as < prev    next >
Encoding:
Text File  |  2006-06-13  |  2.1 KB  |  72 lines

  1. class com.KidFighting.skills.SklTailorRotate extends com.KidFighting.objects.CSkill
  2. {
  3.    var name;
  4.    var keys;
  5.    var effStartFrame;
  6.    var hurtValue;
  7.    var type;
  8.    var maxHit;
  9.    var owner;
  10.    var performing;
  11.    var hit;
  12.    var movingSpeed;
  13.    var characterMovingSpeed = 12;
  14.    function SklTailorRotate()
  15.    {
  16.       super();
  17.       this.name = "TailorRotate";
  18.       this.keys = com.KidFighting.Input.RIGHT + "," + com.KidFighting.Input.RIGHT + "," + com.KidFighting.Input.A;
  19.       this.effStartFrame = 3;
  20.       this.hurtValue = 18;
  21.       this.type = "self";
  22.    }
  23.    function perform()
  24.    {
  25.       this.maxHit = 3;
  26.       this.owner.startInvincible(0.1);
  27.       this.performing = true;
  28.       this.hit = false;
  29.       this.movingSpeed = this.owner.side * this.characterMovingSpeed;
  30.       this.observeCharacterTween(this.owner._twnF);
  31.       this.onMotionFinished = this.onMotionStopped;
  32.       ds.controls.SoundPlayer.playSound("tailor_special1");
  33.    }
  34.    function onMotionUpdated(twn)
  35.    {
  36.       if(twn.obj._currentframe > this.effStartFrame)
  37.       {
  38.          if(!this.hit)
  39.          {
  40.             this.hit = this.owner.hitTest(this.owner.getInstance().hitBlock,null,this.hurtValue,null,null,true,"mtBlastHurt");
  41.             if(this.hit)
  42.             {
  43.                this.maxHit = this.maxHit - 1;
  44.             }
  45.          }
  46.          else if(this.maxHit-- > 0)
  47.          {
  48.             if(this.hit == 1)
  49.             {
  50.                this.owner.opponent.mtBlastHurt("Hurt");
  51.             }
  52.             else
  53.             {
  54.                this.hit = this.owner.hitTest(this.owner.getInstance().hitBlock,null,this.hurtValue,null,null,true,"mtBlastHurt");
  55.             }
  56.          }
  57.          this.owner.ani._x += this.movingSpeed;
  58.          if(this.owner.opponent.direction != "up")
  59.          {
  60.             this.owner.correctPosition();
  61.          }
  62.          this.owner.correctOffside();
  63.       }
  64.    }
  65.    function onMotionStopped()
  66.    {
  67.       this.unobserveCharacterTween(this.owner._twnF);
  68.       this.performing = false;
  69.       this.owner.setSkillMotionFinished(this);
  70.    }
  71. }
  72.