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

  1. class com.KidFighting.effects.EffDynamite extends com.KidFighting.objects.CEffect
  2. {
  3.    var _twnY;
  4.    var ani;
  5.    var func;
  6.    var onMotionFinished;
  7.    var continueTo;
  8.    var owner;
  9.    var hurtValue;
  10.    var skill;
  11.    var movingSpeed = 15;
  12.    function EffDynamite($ani, twn, ch, x, y)
  13.    {
  14.       super();
  15.       $ani._xscale *= ch.side;
  16.       this.init($ani,twn,ch,x,y);
  17.       this._twnY = new ds.transitions.Tween(this.ani,"_y",mx.transitions.easing.Bounce.easeOut,y,y - 60,12);
  18.       var lastY = ch.orgY;
  19.       this._twnY.onMotionFinished = function(twn)
  20.       {
  21.          this.func = null;
  22.          this.onMotionFinished = undefined;
  23.          this.continueTo(lastY,6);
  24.       };
  25.    }
  26.    function onEffectMotionUpdated()
  27.    {
  28.       this.ani._x += this.movingSpeed;
  29.       this.movingSpeed -= 0.5 * this.owner.side;
  30.       if(this.ani._x < -50 || this.ani._x > Stage.width + 50)
  31.       {
  32.          this.stop();
  33.       }
  34.       if(this.owner.hitTest(this.ani,"Explosion",this.hurtValue,"Explosion"))
  35.       {
  36.          this.stop();
  37.       }
  38.       else if(this.ani._y >= this.owner.orgY)
  39.       {
  40.          this.skill.explode(this.ani._x);
  41.          this.stop();
  42.       }
  43.    }
  44.    function destroy()
  45.    {
  46.       super.destroy();
  47.       delete this._twnY;
  48.    }
  49.    function onPauseGame()
  50.    {
  51.       super.onPauseGame();
  52.       if(this._twnY.isPlaying)
  53.       {
  54.          this._twnY.pause();
  55.       }
  56.    }
  57.    function onResumeGame()
  58.    {
  59.       super.onResumeGame();
  60.       this._twnY.resume();
  61.    }
  62. }
  63.