home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / sneak_attack.swf / scripts / DefineSprite_144 / frame_1 / DoAction.as
Encoding:
Text File  |  2007-03-20  |  2.8 KB  |  144 lines

  1. if(0 >= _root.life)
  2. {
  3.    _parent.gotoAndStop("die");
  4. }
  5. if(0 < _parent.timer_hurt)
  6. {
  7.    _parent.timer_hurt--;
  8. }
  9. else if(_parent.hurt == true)
  10. {
  11.    _parent.hurt = false;
  12. }
  13. _root.scroll();
  14. _parent.body.head.face.gotoAndStop(_root.face);
  15. if(_root.face != "normal")
  16. {
  17.    if(_parent.timer_face == 0)
  18.    {
  19.       _root.face = "normal";
  20.    }
  21.    else
  22.    {
  23.       _parent.timer_face--;
  24.    }
  25. }
  26. else
  27. {
  28.    _parent.timer_face = random(40) + 20;
  29. }
  30. if(Key.isDown(83))
  31. {
  32.    if(_parent.key_jump != true)
  33.    {
  34.       if(_parent.air != true)
  35.       {
  36.          _root.synj_jump();
  37.       }
  38.       _parent.key_jump = true;
  39.    }
  40. }
  41. else
  42. {
  43.    _parent.key_jump = false;
  44. }
  45. if(_parent.jumping == true && _parent.dest_y < _parent._y)
  46. {
  47.    _parent._y -= _root.jumpspeed;
  48.    if(_root.jumpspeed_min < _root.jumpspeed)
  49.    {
  50.       _root.jumpspeed -= 2;
  51.    }
  52. }
  53. else
  54. {
  55.    _parent.jumping = false;
  56. }
  57. if(_parent.jumping == false && _parent.air != false)
  58. {
  59.    _parent._y += _root.jumpspeed;
  60.    if(_root.jumpspeed < _root.jumpspeed_max)
  61.    {
  62.       _root.jumpspeed += 2;
  63.    }
  64.    _parent.legs.gotoAndStop("fall");
  65. }
  66. if(_parent.air == false && _parent.legs._currentFrame == 3)
  67. {
  68.    _parent.legs.gotoAndStop("run");
  69. }
  70. attack_dir = "middle";
  71. if(Key.isDown(Key.UP))
  72. {
  73.    attack_dir = "up";
  74. }
  75. if(Key.isDown(Key.DOWN))
  76. {
  77.    attack_dir = "down";
  78. }
  79. if(Key.isDown(65))
  80. {
  81.    if(_parent.key_attack != true && _parent.body.body._currentFrame == 1 && _root.face != "fire")
  82.    {
  83.       _root.s_sword1.start();
  84.       _parent.body.body.gotoAndStop("slash_" + attack_dir);
  85.       _parent.key_attack = true;
  86.    }
  87. }
  88. else
  89. {
  90.    _parent.key_attack = false;
  91. }
  92. if(Key.isDown(68))
  93. {
  94.    if(_parent.key_attack2 != true)
  95.    {
  96.       if(_parent.body.body._currentFrame == 1 && _root.fireball._currentFrame == 2 && 0 < _root.firepower)
  97.       {
  98.          _root.face = "fire";
  99.          _root.firepower--;
  100.          _root.fireball._x = _parent._x + 150;
  101.          _root.fireball._y = _parent._y - 35;
  102.          _root.s_fire1.start();
  103.       }
  104.       _parent.key_attack2 = true;
  105.    }
  106. }
  107. else
  108. {
  109.    _parent.key_attack2 = false;
  110. }
  111. if(Key.isDown(Key.RIGHT))
  112. {
  113.    _parent.key_right = _parent.key_right + 1;
  114. }
  115. else
  116. {
  117.    _parent.key_right = 0;
  118. }
  119. if(Key.isDown(Key.LEFT))
  120. {
  121.    _parent.key_left = _parent.key_left + 1;
  122. }
  123. else
  124. {
  125.    _parent.key_left = 0;
  126. }
  127. if(Key.isDown(Key.RIGHT) && (_parent.key_left == 0 || _parent.key_right < _parent.key_left))
  128. {
  129.    _parent._x += _root.speed / 2;
  130. }
  131. if(Key.isDown(Key.LEFT) && (_parent.key_right == 0 || _parent.key_left < _parent.key_right))
  132. {
  133.    _parent._x -= _root.speed;
  134. }
  135. if(_root.limit_right < _parent._x)
  136. {
  137.    _parent._x = _root.limit_right;
  138. }
  139. else if(_parent._x < _root.limit_left)
  140. {
  141.    _parent._x = _root.limit_left;
  142. }
  143. _root.shadow._x = _parent._x;
  144.