home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Corrida / Skachky.swf / scripts / frame_15 / DoAction.as
Encoding:
Text File  |  2004-07-11  |  3.3 KB  |  148 lines

  1. function determine_whips()
  2. {
  3.    if(whips_limit >= whips_used)
  4.    {
  5.       if(start_whip)
  6.       {
  7.          whipping = true;
  8.          start_whip = false;
  9.          whip_count = 0;
  10.          whips_used++;
  11.       }
  12.       if(whipping)
  13.       {
  14.          whip_count++;
  15.          whip_factor = 1;
  16.          if(whip_cycles < whip_count)
  17.          {
  18.             whipping = false;
  19.             whip_factor = 0;
  20.          }
  21.       }
  22.    }
  23.    else
  24.    {
  25.       whip_factor = 0;
  26.    }
  27.    whips_left = whips_limit - whips_used;
  28.    if(whips_left < 0)
  29.    {
  30.       whips_left = 0;
  31.    }
  32. }
  33. i = 1;
  34. while(4 >= i)
  35. {
  36.    horse_v[i] = horse_u[i] + horse_a[i] * horse_t[i];
  37.    if(horse_maxv[i] < horse_v[i])
  38.    {
  39.       horse_v[i] = horse_maxv[i];
  40.    }
  41.    eval("horse" + i)._x += horse_v[i];
  42.    horse_t[i] += 0.02;
  43.    nosep = eval("horse" + i)._x + nose[i];
  44.    if(fence10._x < nosep and finish[i] == -999)
  45.    {
  46.       finish[i] = counter * 1000 + (600 - nosep);
  47.       fence10.flash.gotoandplay("flash");
  48.    }
  49.    i++;
  50. }
  51. determine_whips();
  52. horse1._x += whip_factor;
  53. railbg._x -= speed;
  54. railbg1._x -= speed;
  55. railfg._x -= speed;
  56. railfg1._x -= speed;
  57. chk_fen = eval("fence" + my_next_fence);
  58. if(my_next_fence < 10 and -10 < chk_fen._x - horse1._x and chk_fen._x - horse1._x < 10 and not_jumping and first_inh)
  59. {
  60.    first_inh = false;
  61.    trace("not jumped");
  62.    horse_u[1] = 0;
  63.    horse_t[1] = 0;
  64.    horse1._x -= 20;
  65. }
  66. if(my_next_fence < 10 and chk_fen._x + 150 < horse1._x)
  67. {
  68.    my_next_fence++;
  69. }
  70. if(not_jumping)
  71. {
  72.    first_check = true;
  73. }
  74. else if(first_check)
  75. {
  76.    if(dtf != -999)
  77.    {
  78.       first_check = false;
  79.       trace("DTF !" + dtf);
  80.       accuracy = 100 - Math.abs(dtf) * 2;
  81.       if(accuracy < 0)
  82.       {
  83.          accuracy = 0;
  84.       }
  85.       horse_u[1] = horse_v[1] * accuracy / 100;
  86.       horse_t[1] = 0;
  87.       horse1._x -= (100 - accuracy) / fence_factor;
  88.       score += int(accuracy / 2);
  89.    }
  90. }
  91. counter++;
  92. i = first_active;
  93. while(10 >= i)
  94. {
  95.    if(f_state[i] == "hidden")
  96.    {
  97.       if(f_pos[i] < counter)
  98.       {
  99.          f_state[i] = "active";
  100.       }
  101.    }
  102.    if(f_state[i] == "active")
  103.    {
  104.       chk_fen = eval("fence" + i);
  105.       if(chk_fen._x - horse4._x < 100 and notj4[i] and i < 10)
  106.       {
  107.          notj4[i] = false;
  108.          horse4.gotoandplay("jump");
  109.          pc = random(100);
  110.          horse_u[4] = horse_v[4] * pc / 100;
  111.          horse_t[4] = 0;
  112.          horse4._x -= (100 - pc) / 10;
  113.       }
  114.       if(chk_fen._x - horse3._x < 100 and notj3[i] and i < 10)
  115.       {
  116.          notj3[i] = false;
  117.          horse3.gotoandplay("jump");
  118.          pc = random(100);
  119.          horse_u[3] = horse_v[3] * pc / 100;
  120.          horse_t[3] = 0;
  121.          horse3._x -= (100 - pc) / 10;
  122.       }
  123.       if(chk_fen._x - horse2._x < 100 and notj2[i] and i < 10)
  124.       {
  125.          notj2[i] = false;
  126.          horse2.gotoandplay("jump");
  127.          pc = random(100);
  128.          horse_u[2] = horse_v[2] * pc / 100;
  129.          horse_t[2] = 0;
  130.          horse2._x -= (100 - pc) / 10;
  131.       }
  132.       chk_fen._x -= speed;
  133.       if(chk_fen._x < -80)
  134.       {
  135.          f_state[i] = "done";
  136.          speed += increment;
  137.          first_active++;
  138.          first_inh = true;
  139.       }
  140.       if(i == 10 and chk_fen._x < 100)
  141.       {
  142.          f_state[i] = "done";
  143.          race_running = false;
  144.       }
  145.    }
  146.    i++;
  147. }
  148.