home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / mid_flight.swf / scripts / DefineSprite_256 / frame_2 / DoAction.as
Encoding:
Text File  |  2008-08-07  |  2.7 KB  |  160 lines

  1. set("/:oldx",eval("/:x"));
  2. set("/:x",_root._xmouse);
  3. if(eval("/:x") < xmin)
  4. {
  5.    set("/:x",xmin);
  6. }
  7. if(eval("/:x") > xmax)
  8. {
  9.    set("/:x",xmax);
  10. }
  11. dx = eval("/:x") - it._x;
  12. if(dx > 0)
  13. {
  14.    set("/:hd",1);
  15. }
  16. else
  17. {
  18.    set("/:hd",2);
  19. }
  20. if(math.abs(dx) > math.abs(xs))
  21. {
  22.    runtime++;
  23.    moving = 500;
  24.    if(dx > 0)
  25.    {
  26.       nx = it._x + xs;
  27.    }
  28.    else
  29.    {
  30.       nx = it._x - xs;
  31.    }
  32.    it.gotoAndStop("run" + eval("/:hd"));
  33.    it._x = nx;
  34. }
  35. else
  36. {
  37.    if(runtime > 3)
  38.    {
  39.       it._x = eval("/:x");
  40.       moving = 0;
  41.       runtime = 0;
  42.       it.gotoAndStop("stand" + eval("/:hd"));
  43.    }
  44.    else if(math.abs(dx) > 3)
  45.    {
  46.       it._x = eval("/:x");
  47.       moving = 500;
  48.       it.gotoAndStop("run" + eval("/:hd"));
  49.    }
  50.    if(moving > 495)
  51.    {
  52.       moving = 5;
  53.    }
  54.    else if(moving > 5 and moving <= 495)
  55.    {
  56.       moving = 0;
  57.    }
  58. }
  59. if(moving > 0)
  60. {
  61.    moving--;
  62. }
  63. if(eval("/:oldx") == eval("/:x"))
  64. {
  65.    if(!moving or it._x == xmax or it._x == xmin)
  66.    {
  67.       it.gotoAndStop("stand" + eval("/:hd"));
  68.    }
  69. }
  70. if(xmax > eval("/:midx"))
  71. {
  72.    set("/:oldx2",eval("/:x2"));
  73.    set("/:x2",_root.m._x);
  74.    if(eval("/:x2") < xmin)
  75.    {
  76.       set("/:x2",xmin);
  77.    }
  78.    if(eval("/:x2") > xmax)
  79.    {
  80.       set("/:x2",xmax);
  81.    }
  82.    dx2 = eval("/:x2") - it2._x;
  83.    if(dx2 > 0)
  84.    {
  85.       set("/:hd2",1);
  86.    }
  87.    else
  88.    {
  89.       set("/:hd2",2);
  90.    }
  91.    if(math.abs(dx2) > math.abs(xs2))
  92.    {
  93.       runtime2++;
  94.       moving2 = 500;
  95.       if(dx2 > 0)
  96.       {
  97.          nx = it2._x + xs2;
  98.       }
  99.       else
  100.       {
  101.          nx = it2._x - xs2;
  102.       }
  103.       it2.gotoAndStop("run" + eval("/:hd2"));
  104.       it2._x = nx;
  105.    }
  106.    else
  107.    {
  108.       if(runtime2 > 3)
  109.       {
  110.          it2._x = eval("/:x2");
  111.          moving2 = 0;
  112.          runtime2 = 0;
  113.          it2.gotoAndStop(1);
  114.       }
  115.       else if(math.abs(dx2) > 3)
  116.       {
  117.          it2._x = eval("/:x2");
  118.          moving2 = 500;
  119.          it2.gotoAndStop("run" + eval("/:hd2"));
  120.       }
  121.       if(moving2 > 495)
  122.       {
  123.          moving2 = 5;
  124.       }
  125.       else if(moving2 > 5 and moving2 <= 495)
  126.       {
  127.          moving2 = 0;
  128.       }
  129.    }
  130.    if(moving2 > 0)
  131.    {
  132.       moving2--;
  133.    }
  134.    if(eval("/:oldx2") == eval("/:x2"))
  135.    {
  136.       if(!moving2 or it2._x == xmax or it2._x == xmin)
  137.       {
  138.          it2.gotoAndStop("stand" + eval("/:hd2"));
  139.       }
  140.    }
  141. }
  142. if(xmax < eval("/:midx"))
  143. {
  144.    edruntime++;
  145.    if(edruntime > 30 and !shout and !eval("/:mtalk"))
  146.    {
  147.       shout = 1;
  148.       set("/:mtalk",1);
  149.       _root.zmacedyoucandoit.start();
  150.    }
  151. }
  152. onmouseDown = function()
  153. {
  154.    if(!eval("/:jump"))
  155.    {
  156.       gotoAndStop("jump");
  157.       play();
  158.    }
  159. };
  160.