home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Esportes / VirtualCurling.swf / scripts / frame_59 / DoAction.as
Encoding:
Text File  |  2005-08-08  |  2.3 KB  |  97 lines

  1. function Map_Balls_to_perspective(max_b)
  2. {
  3.    trace("first " + first_play);
  4.    ball = 1;
  5.    while(max_b >= ball)
  6.    {
  7.       trace("ball === " + ball + "  " + in_zone[ball]);
  8.       if(in_zone[ball])
  9.       {
  10.          disp_zoom_y = zoom_origin_y - realy[ball];
  11.          thisball = eval("per" + ball);
  12.          even_number = ball == int(ball / 2) * 2;
  13.          if(first_play == "computer" and even_number or first_play == "user" and !even_number)
  14.          {
  15.             trace("blue" + ball_in);
  16.             thisball.gotoandstop("blue");
  17.          }
  18.          else
  19.          {
  20.             trace("red" + ball_in);
  21.             thisball.gotoandstop("red");
  22.          }
  23.          thisball._y = (PerY1 - Pery3) / (ZooY1 - ZooY3) * disp_zoom_y + Pery3;
  24.          a = zoox1;
  25.          b = middle;
  26.          c = realx[ball];
  27.          o = perx1;
  28.          p = b;
  29.          f = perx3;
  30.          g = b;
  31.          d1 = (c - a) * (p - o) / (b - a) + o;
  32.          d2 = (c - a) * (g - f) / (b - a) + f;
  33.          extra_y = pery1 - thisball._y;
  34.          extra_dy = pery1 - pery3;
  35.          extra_dx = d2 - d1;
  36.          extra_m = extra_dy / extra_dx;
  37.          extra_x = extra_y / extra_m;
  38.          thisball._x = (realx[ball] - offset) / mgrad + extra_x;
  39.       }
  40.       ball++;
  41.    }
  42. }
  43. minimum_points_for_prize = 2;
  44. timeout_value = 3000;
  45. home_radius = 137;
  46. waiting = false;
  47. end_no = 1;
  48. max_ends = 2;
  49. Message = "";
  50. computer_score = 0;
  51. user_score = 0;
  52. totals_message = "";
  53. ends_message = "END: 1";
  54. score_message = ends_message + totals_message;
  55. winpoints = 0;
  56. curve = 1;
  57. curve_amplitude = 25;
  58. stone_status = new array();
  59. stone_in_use = 0;
  60. totalballs = 8;
  61. max_pwr = 950;
  62. min_pwr = 600;
  63. vx = new array();
  64. vy = new array();
  65. realx = new array();
  66. realy = new array();
  67. in_zone = new array();
  68. Map_Perx = new array();
  69. Map_Pery = new array();
  70. ZooX1 = 95;
  71. ZooY1 = 370;
  72. ZooX2 = 549;
  73. ZooY2 = 370;
  74. ZooY3 = 12;
  75. ZooY4 = 12;
  76. middle = 322;
  77. PerX1 = 254;
  78. PerY1 = 60;
  79. PerX2 = 390;
  80. PerY1 = 60;
  81. Perx3 = 272;
  82. PerY3 = 20;
  83. Perx4 = 372;
  84. mgrad = (ZooX2 - ZooX1) / (PerX2 - PerX1);
  85. offset = zoox1 - mgrad * perx1;
  86. zoom_origin_x = 0;
  87. zoom_origin_y = 400;
  88. ball = 1;
  89. while(totalballs >= ball)
  90. {
  91.    in_zone[ball] = false;
  92.    realx[ball] = -999 * ball;
  93.    realy[ball] = -999 * ball;
  94.    stone_status[ball] = "bright";
  95.    ball++;
  96. }
  97.