Advertisement
dcomicboy

racing drv3

Mar 11th, 2013
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Action script...
  2.  
  3. // [onClipEvent of sprite 2461 in frame 1]
  4. onClipEvent (load)
  5. {
  6.     BG1.loadScrollContent(appdir add "\\IMG\\race.jpg");
  7.     BG2.loadScrollContent(appdir add "\\IMG\\race.jpg");
  8. }
  9.  
  10. // [onClipEvent of sprite 2543 in frame 88]
  11. onClipEvent (initialize)
  12. {
  13.     label = "\"\"";
  14.     initialValue = true;
  15.     labelPlacement = "right";
  16.     changeHandler = "\"\"";
  17. }
  18.  
  19. // [onClipEvent of sprite 2543 in frame 88]
  20. onClipEvent (initialize)
  21. {
  22.     label = "";
  23.     initialValue = true;
  24.     labelPlacement = "right";
  25.     changeHandler = "";
  26. }
  27.  
  28. // [onClipEvent of sprite 2543 in frame 88]
  29. onClipEvent (initialize)
  30. {
  31.     label = "\"\"";
  32.     initialValue = true;
  33.     labelPlacement = "right";
  34.     changeHandler = "\"\"";
  35. }
  36.  
  37. // [onClipEvent of sprite 2543 in frame 88]
  38. onClipEvent (initialize)
  39. {
  40.     label = "";
  41.     initialValue = true;
  42.     labelPlacement = "right";
  43.     changeHandler = "";
  44. }
  45.  
  46. // [Action in Frame 1]
  47. function timeFormat(ms)
  48. {
  49.     if (ms % 60 < 10)
  50.     {
  51.         return (Math.floor(ms / 60) add ":0" add ms % 60);
  52.     }
  53.     else
  54.     {
  55.         return (Math.floor(ms / 60) add ":" add ms % 60);
  56.     } // end else if
  57. } // End of the function
  58. function StartNOS(_racer, n)
  59. {
  60.     _racer.rdata.n = 20;
  61. } // End of the function
  62. function NOS(_racer)
  63. {
  64.     if (_racer.stats.NOS <= 5 && _racer.stats.NRES > 0)
  65.     {
  66.         _racer.stats.NOS = 100;
  67.         --_racer.stats.NRES;
  68.     } // end if
  69.     if (_racer.stats.NOS - 2 > 0)
  70.     {
  71.         _racer.stats.NOS = _racer.stats.NOS - 2;
  72.         getAccel(_racer);
  73.         if (_racer.rdata.g >= 4 && _racer.rdata.v / _racer.rdata.TopSpeed[_racer.rdata.g] > 0.400000)
  74.         {
  75.             if (_racer.stats.UPGRADE[27])
  76.             {
  77.                 _racer.rdata.a = _racer.rdata.a * 4;
  78.             }
  79.             else
  80.             {
  81.                 _racer.rdata.a = _racer.rdata.a * 2;
  82.             } // end else if
  83.         }
  84.         else
  85.         {
  86.             _racer.rdata.a = _racer.rdata.a * 0.900000;
  87.         } // end if
  88.     } // end else if
  89. } // End of the function
  90. function getAcceler(g, _stats)
  91. {
  92.     if (_stats["GEAR" add g] == 2 || _stats["GEAR" add g] == 0)
  93.     {
  94.         _stats["GEAR" add g] = 1;
  95.     } // end if
  96.     f = (_stats.TQ + tqbonus - _stats.FR - frbonus) / Math.pow(1.500000, g * 2) * (2 - _stats["GEAR" add g]);
  97.     return (f * 0.900000 / (_stats.WT * wtbonus));
  98. } // End of the function
  99. function getAccel(racer)
  100. {
  101.     racer.rdata.a = racer.rdata.Accel[racer.rdata.g];
  102.     if (racer.rdata.v / racer.rdata.TopSpeed[racer.rdata.g] < 0.700000)
  103.     {
  104.         racer.rdata.a = racer.rdata.a / (racer.stats.CAMADJUST + 1);
  105.     }
  106.     else if (racer.rdata.v / racer.rdata.TopSpeed[racer.rdata.g] > 0.900000)
  107.     {
  108.         racer.rdata.a = racer.rdata.a / 2;
  109.     }
  110.     else
  111.     {
  112.         racer.rdata.a = racer.rdata.a * racer.stats.CAMADJUST;
  113.     } // end else if
  114.     racer.rdata.a = racer.rdata.a * 2;
  115. } // End of the function
  116. function race(racer)
  117. {
  118.     if (burnout && racer.typ == 1)
  119.     {
  120.         if (Key.isDown(32))
  121.         {
  122.             P1.CAR.lwheel.gotoAndStop(_root.CIVIC.MAX_WHEEL + 2);
  123.             ReColor(P1, Player[0]);
  124.             ReColor(P2, Player[1]);
  125.             burnout = true;
  126.             getAccel(racer);
  127.             racer.rdata.v = racer.rdata.v + racer.rdata.a * 100 / 60 * 1.700000;
  128.             if (racer.rdata.v >= racer.rdata.TopSpeed[racer.rdata.g])
  129.             {
  130.                 racer.rdata.v = racer.rdata.TopSpeed[racer.rdata.g] * 0.900000;
  131.             } // end if
  132.             --bn;
  133.             if (bn <= 0)
  134.             {
  135.                 ReColor(P1, Player[0]);
  136.                 burnout = false;
  137.             } // end if
  138.             racer.rdata.d = racer.rdata.d + racer.rdata.v * 0.030000;
  139.         }
  140.         else
  141.         {
  142.             P1.CAR.lwheel.gotoAndStop(Player[0].stats._wheel);
  143.             ReColor(P1, Player[0]);
  144.             ReColor(P2, Player[1]);
  145.             burnout = false;
  146.             race(racer);
  147.         } // end else if
  148.     }
  149.     else if (racer.typ != 5)
  150.     {
  151.         if (Key.isDown(32) && racer.typ == 1 || racer.typ == 2)
  152.         {
  153.             if (racer.rdata.n <= 0)
  154.             {
  155.                 getAccel(racer);
  156.             }
  157.             else
  158.             {
  159.                 NOS(racer);
  160.                 --racer.rdata.n;
  161.             } // end else if
  162.         }
  163.         else
  164.         {
  165.             racer.rdata.a = -0.006000 + racer.stats.CL / 1000;
  166.         } // end else if
  167.         if (racer.typ == 2 && racer.rdata.n <= 0)
  168.         {
  169.             if (Player[1].rdata.d > Player[0].rdata.d)
  170.             {
  171.                 Player[1].rdata.a = Player[1].rdata.a * 0.500000;
  172.             }
  173.             else
  174.             {
  175.                 Player[1].rdata.a = Player[1].rdata.a * 1.500000;
  176.             } // end if
  177.         } // end else if
  178.         racer.rdata.v = racer.rdata.v + racer.rdata.a * 1000 / 60 * 1.700000;
  179.         if (racer.rdata.v < 0)
  180.         {
  181.             racer.rdata.v = 0;
  182.         } // end if
  183.         if (racer.rdata.v >= racer.rdata.TopSpeed[racer.rdata.g])
  184.         {
  185.             racer.rdata.v = racer.rdata.TopSpeed[racer.rdata.g] * 0.900000;
  186.         } // end if
  187.         if (racer.typ == 2 && racer.rdata.v / racer.rdata.TopSpeed[racer.rdata.g] >= 0.800000 + df)
  188.         {
  189.             GearUp(racer);
  190.         } // end if
  191.         if (racer.typ == 2 && racer.rdata.g > 2 && racer.rdata.n <= 0 && typ1 != "a" && df > 0.030000)
  192.         {
  193.             StartNOS(racer);
  194.         } // end if
  195.         racer.rdata.tops = Math.max(racer.rdata.tops, racer.rdata.v);
  196.         racer.rdata.d = racer.rdata.d + racer.rdata.v * 0.030000;
  197.     } // end else if
  198. } // End of the function
  199. function GearUp(racer)
  200. {
  201.     if (!_root.Options.clutch || Key.isDown(17) || racer.typ != 1)
  202.     {
  203.         if (!_root.Options.nogas || !Key.isDown(32) || racer.typ != 1)
  204.         {
  205.             if (racer.rdata.g++ >= 6)
  206.             {
  207.                 racer.rdata.g = 6;
  208.             } // end if
  209.         } // end if
  210.     } // end if
  211. } // End of the function
  212. function GearDown(racer)
  213. {
  214.     if (!_root.Options.clutch || Key.isDown(17) || racer.typ != 1)
  215.     {
  216.         if (!_root.Options.nogas || !Key.isDown(32) || racer.typ != 1)
  217.         {
  218.             if (racer.rdata.g-- <= 1)
  219.             {
  220.                 racer.rdata.g = 1;
  221.             } // end if
  222.         } // end if
  223.     } // end if
  224. } // End of the function
  225. function initrace(racer, stats)
  226. {
  227.     if (racer.typ != 5)
  228.     {
  229.         racer.stats = stats;
  230.         racer.rdata = new Object();
  231.         racer.rdata.tops = 0;
  232.         frbonus = Math.round(racer.stats.AIRINTAKE * 2.500000);
  233.         hpbonus = Math.round(racer.stats.BOOST * 10) - 10;
  234.         tqbonus = Math.round(racer.stats.BOOST * 10) - 25;
  235.         if (stats.WT > 2000)
  236.         {
  237.             wtbonus = 1.150000;
  238.         }
  239.         else if (stats.WT > 1700)
  240.         {
  241.             wtbonus = 1.100000;
  242.         }
  243.         else
  244.         {
  245.             wtbonus = 1;
  246.         } // end else if
  247.         racer.rdata.v = 0;
  248.         racer.rdata.a = 0;
  249.         racer.rdata.d = 0;
  250.         racer.rdata.g = 1;
  251.         racer.rdata.n = 0;
  252.         racer.rdata.Accel = new Array();
  253.         for (var _loc3 = 1; _loc3 <= 6; ++_loc3)
  254.         {
  255.             racer.rdata.Accel[_loc3] = getAcceler(_loc3, racer.stats);
  256.         } // end of for
  257.         racer.rdata.TopSpeed = new Array();
  258.         racer.rdata.TopSpeed[0] = 0;
  259.         racer.rdata.TopSpeed[1] = 15 * stats.GEAR1;
  260.         racer.rdata.TopSpeed[2] = Math.round(25 + Math.sqrt(stats.HP + hpbonus) * 6 / 25 * 4) * stats.GEAR2 * 0.900000;
  261.         racer.rdata.TopSpeed[3] = Math.round(25 + Math.sqrt(stats.HP + hpbonus) * 6 / 25 * 9) * stats.GEAR3 * 0.800000;
  262.         racer.rdata.TopSpeed[4] = Math.round(25 + Math.sqrt(stats.HP + hpbonus) * 6 / 25 * 16) * stats.GEAR4 * 0.900000;
  263.         racer.rdata.TopSpeed[5] = Math.round(25 + Math.sqrt(stats.HP + hpbonus) * 6 / 25 * 25) * stats.GEAR5 * 0.900000;
  264.         racer.rdata.TopSpeed[6] = Math.round(25 + Math.sqrt(stats.HP + hpbonus) * 6 / 25 * 36) * stats.GEAR6 * 0.800000;
  265.         racer.rdata.temp = Math.round((2 - racer.stats.AIRINTAKE) * 10 + racer.stats.BOOST * 40);
  266.         racer.rdata.ctemp = racer.rdata.temp;
  267.         if (racer.typ == 2)
  268.         {
  269.             if (racer.stats.HP > 2000)
  270.             {
  271.                 df = 0.100000;
  272.             }
  273.             else if (racer.stats.HP > 1000)
  274.             {
  275.                 df = 0.070000;
  276.             }
  277.             else if (racer.stats.HP > 600)
  278.             {
  279.                 df = 0.060000;
  280.             }
  281.             else if (racer.stats.HP > 300)
  282.             {
  283.                 df = 0.040000;
  284.             }
  285.             else
  286.             {
  287.                 df = 0;
  288.             } // end else if
  289.         } // end else if
  290.     }
  291.     else
  292.     {
  293.         _root.RaceDataUpdate = true;
  294.         _root.RaceTempDistance = 0;
  295.         Player[1].rdata = new Object();
  296.         Player[1].rdata.d = _root.RaceTempDistance;
  297.     } // end else if
  298. } // End of the function
  299. frames = 0;
  300. startTime = getTimer();
  301. mseconds = 0;
  302. seconds = 0;
  303. if (obj1 == undefined)
  304. {
  305.     _root.prompt("", "Race Error!\nYour Car Was Absent!");
  306.     this.removeMovieClip();
  307. } // end if
  308. numplayers = 2;
  309. raceresult = undefined;
  310. burnout = true;
  311. blur = false;
  312. temp_gear = 1;
  313. gear = 1;
  314. initx = joystick._x;
  315. inity = joystick._y;
  316. tension = 0.500000;
  317. decay = 0.500000;
  318. if (typ1 == "a")
  319. {
  320.     gotoAndStop("analyze");
  321. } // end if
  322.  
  323. // [Action in Frame 2]
  324. function ReColor(CARMCPL, PLYDAT)
  325. {
  326.     COLOUR = new Color(CARMCPL.CAR.lwheel.COL);
  327.     COLOUR.setTransform(PLYDAT.stats.rimcols);
  328.     COLOUR = new Color(CARMCPL.CAR.rwheel.COL);
  329.     COLOUR.setTransform(PLYDAT.stats.rimcols);
  330. } // End of the function
  331. function UpdateHUD()
  332. {
  333.     HUD.v = Math.round(Player[0].rdata.v) add "mph";
  334.     HUD.ts = Player[0].rdata.TopSpeed[Player[0].rdata.g];
  335.     HUD.a = Player[0].rdata.a;
  336.     HUD.d = Player[0].rdata.d;
  337.     joystick.knob.gear = Player[0].rdata.g;
  338.     HUD.t = timeFormat(seconds * 60 + mseconds);
  339.     HUD.FPS = Math.round(Player[0].rdata.ctemp);
  340.     HUD.nospin._rotation = Player[0].stats.NOS / 100 * 270 - 135;
  341.     HUD.temppin._rotation = Player[0].rdata.ctemp / 100 * 270 - 125;
  342.     HUD.NRES = Player[0].stats.NRES;
  343.     BG.BG0._x = BG.BG0._x - Player[0].rdata.v * 2;
  344.     BG.BG1._x = BG.BG1._x - Player[0].rdata.v * 2;
  345.     BG.BG2._x = BG.BG2._x - Player[0].rdata.v * 2;
  346.     if (BG.BG2._x <= BG.BG1._width / 2)
  347.     {
  348.         BG.BG1._x = BG.BG1._width / 2;
  349.         BG.BG2._x = BG.BG1._width * 1.500000;
  350.     } // end if
  351.     BG2._x = BG2._x - Player[0].rdata.v * 1.500000;
  352.     if (BG2._x <= -400)
  353.     {
  354.         BG2._x = BG2._width * 0.500000 - 400;
  355.     } // end if
  356.     HUD.DM.M1._x = Player[0].rdata.d / maxdistance * 772;
  357.     HUD.DM.M2._x = Player[1].rdata.d / maxdistance * 772;
  358.     if (burnout && Player[0].rdata.v > 0)
  359.     {
  360.         P1.CAR.lwheel._rotation = 0;
  361.         P1.CAR.lwheel.gotoAndStop(_root.CIVIC.MAX_WHEEL + 2);
  362.         P1.CAR.rwheel.gotoAndStop(Player[0].stats._wheel);
  363.         ReColor(P1, Player[0]);
  364.     }
  365.     else if (Player[0].rdata.v * 4 > 180)
  366.     {
  367.         P1.CAR.lwheel.gotoAndStop(_root.CIVIC.MAX_WHEEL + 1);
  368.         P1.CAR.rwheel.gotoAndStop(_root.CIVIC.MAX_WHEEL + 1);
  369.         ReColor(P1, Player[0]);
  370.     }
  371.     else
  372.     {
  373.         P1.CAR.lwheel.gotoAndStop(Player[0].stats._wheel);
  374.         P1.CAR.rwheel.gotoAndStop(Player[0].stats._wheel);
  375.         ReColor(P1, Player[0]);
  376.     } // end else if
  377.     if (!burnout)
  378.     {
  379.         P1.CAR.lwheel._rotation = P1.CAR.lwheel._rotation + Player[0].rdata.v * 4;
  380.         P1.CAR.rwheel._rotation = P1.CAR.rwheel._rotation + Player[0].rdata.v * 4;
  381.     } // end if
  382.     P2.CAR.lwheel._rotation = P2.CAR.lwheel._rotation + Player[1].rdata.v * 4;
  383.     P2.CAR.rwheel._rotation = P2.CAR.rwheel._rotation + Player[1].rdata.v * 4;
  384.     P2._x = (Player[1].rdata.d - Player[0].rdata.d) * 50 + P1._x;
  385.     if (P1._x < 0)
  386.     {
  387.         P1._x = P1._x + Player[0].rdata.v * 0.500000;
  388.     }
  389.     else if (P1._x > 0)
  390.     {
  391.         P1._x = 0;
  392.     } // end else if
  393.     tach = Player[0].rdata.v / Player[0].rdata.TopSpeed[Player[0].rdata.g];
  394.     if (Player[0].rdata.v < 120)
  395.     {
  396.         setAngle(P1, Math.round((1 + tach * -5) * 10) / 15);
  397.     }
  398.     else if (Math.random() < 0.500000)
  399.     {
  400.         setAngle(P1, Math.round((1 + tach * -5) * 10) / 15 + 0.200000);
  401.     }
  402.     else
  403.     {
  404.         setAngle(P1, Math.round((1 + tach * -5) * 10) / 15 - 0.200000);
  405.     } // end else if
  406.     HUD.rpmpin._rotation = Player[0].rdata.v / Player[0].rdata.TopSpeed[Player[0].rdata.g] * REDLINE_ANG - 135;
  407.     HUD.velopin._rotation = Player[0].rdata.v - 135;
  408.     if (HUD.REDLINE._currentframe == 1 && Player[0].rdata.v / Player[0].rdata.TopSpeed[Player[0].rdata.g] > 0.900000)
  409.     {
  410.         HUD.REDLINE.gotoAndPlay("red");
  411.         Player[0].rdata.ctemp = Player[0].rdata.ctemp + 3;
  412.     }
  413.     else if (HUD.REDLINE._currentframe == 1 && Player[0].rdata.v / Player[0].rdata.TopSpeed[Player[0].rdata.g] > 0.800000)
  414.     {
  415.         HUD.REDLINE.gotoAndPlay("red2");
  416.         Player[0].rdata.ctemp = Player[0].rdata.ctemp + 0.500000;
  417.     }
  418.     else if (HUD.REDLINE._currentframe == 1 && Player[0].rdata.v / Player[0].rdata.TopSpeed[Player[0].rdata.g] > 0.700000)
  419.     {
  420.         Player[0].rdata.ctemp = Player[0].rdata.ctemp + 0.100000;
  421.     }
  422.     else
  423.     {
  424.         HUD.REDLINE.gotoAndStop(1);
  425.         Player[0].rdata.ctemp = Player[0].rdata.ctemp - 0.100000;
  426.         Player[0].rdata.ctemp = Math.max(Player[0].rdata.ctemp, Player[0].rdata.temp);
  427.     } // end else if
  428.     P1.CAR.exhaust.NOS._visible = Player[0].rdata.n > 0 && Player[0].stats.NOS > 1;
  429.     P2.CAR.exhaust.NOS._visible = Player[1].rdata.n > 0 && Player[1].stats.NOS > 1;
  430.     if (Player[0].rdata.n > 0 && Player[0].stats.NOS > 1)
  431.     {
  432.         nosSound = new Sound(this);
  433.         nosSound.attachSound("NOS.wav");
  434.         nosSound.start();
  435.         this._x = this._x + (Math.random() - 0.500000) * 5;
  436.         this._y = this._y + (Math.random() - 0.500000) * 5;
  437.     }
  438.     else
  439.     {
  440.         nosSound.stop();
  441.         this._x = 400;
  442.         this._y = 0;
  443.     } // end else if
  444. } // End of the function
  445. function setAngle(PMC, a)
  446. {
  447.     if (burnout && Player[0].stats.TQ > 800)
  448.     {
  449.         a = (a - 2) * 5;
  450.         max = 6;
  451.     }
  452.     else
  453.     {
  454.         max = 2;
  455.     } // end else if
  456.     if (PMC.CAR._rotation > Player[0].stats.frameangle + a)
  457.     {
  458.         PMC.CAR._rotation = PMC.CAR._rotation - Math.min(max, PMC.CAR._rotation - (Player[0].stats.frameangle + a));
  459.     }
  460.     else if (PMC.CAR._rotation < Player[0].stats.frameangle + a)
  461.     {
  462.         PMC.CAR._rotation = PMC.CAR._rotation + Math.min(max, Player[0].stats.frameangle + a - PMC.CAR._rotation);
  463.     } // end else if
  464.     with (PMC)
  465.     {
  466.         LCALC = Math.tan(CAR._rotation * 3.141593 / 180) * ldiff;
  467.         RCALC = Math.tan(CAR._rotation * 3.141593 / 180) * rdiff;
  468.         if (!burnout)
  469.         {
  470.             CAR.rcaliper._y = RWY + RCALC * 1.500000;
  471.             CAR.rwheel._y = RWY + RCALC * 1.500000;
  472.             S;
  473.             CAR.lwheel._y = LWY + LCALC;
  474.             CAR.lcaliper._y = LWY + LCALC;
  475.             CAR._y = CY + LCALC / 2;
  476.         }
  477.         else
  478.         {
  479.             CAR.rcaliper._y = RWY;
  480.             CAR.rwheel._y = RWY;
  481.             CAR.lwheel._y = LWY;
  482.             CAR.lcaliper._y = LWY;
  483.             CAR._y = CY + LCALC;
  484.         } // end else if
  485.     } // End of with
  486. } // End of the function
  487. _parent.gotoAndStop("racestop");
  488. Player = new Array();
  489. if (obj1 != undefined)
  490. {
  491.     Player[0] = new Object();
  492.     Player[0].typ = typ1;
  493.     initrace(Player[0], obj1);
  494. } // end if
  495. if (obj2 != undefined)
  496. {
  497.     Player[1] = new Object();
  498.     Player[1].typ = typ2;
  499.     initrace(Player[1], obj2);
  500. }
  501. else
  502. {
  503.     P2._visible = false;
  504. } // end else if
  505. bn = 5 + Math.floor(Player[0].TQ / 2);
  506. COL = new Color(HUD.DM.M1);
  507. COL.setTransform(Player[0].stats.framecols);
  508. COL = new Color(HUD.DM.M2);
  509. COL.setTransform(Player[1].stats.framecols);
  510. HUD.DM.M1._x = 0;
  511. HUD.DM.M2._x = 0;
  512. _root.BuildCar(obj1, this._name, "P1");
  513. _root.BuildCar(obj2, this._name, "P2");
  514. P1._yscale = 60;
  515. P2._yscale = 55;
  516. P1._xscale = 60;
  517. P2._xscale = 55;
  518. HUD.nospin.gotoAndStop(Player[0].stats.UPGRADE[66] + 1);
  519. HUD.temppin.gotoAndStop(Player[0].stats.UPGRADE[66] + 1);
  520. HUD.rpmpin.gotoAndStop(Player[0].stats.UPGRADE[66] + 1);
  521. HUD.velopin.gotoAndStop(Player[0].stats.UPGRADE[66] + 1);
  522. HUD.nospin._rotation = Player[0].stats.NOS / 100 * 270 - 125;
  523. HUD.temppin._rotation = HUD.FPS / 30 * 270 - 125;
  524. if (Player[0].stats.HP < 200)
  525. {
  526.     HUD.REDZONE.gotoAndStop(1);
  527.     REDLINE_ANG = 115;
  528. }
  529. else if (Player[0].stats.HP < 300)
  530. {
  531.     HUD.REDZONE.gotoAndStop(2);
  532.     REDLINE_ANG = 150;
  533. }
  534. else if (Player[0].stats.HP < 400)
  535. {
  536.     HUD.REDZONE.gotoAndStop(3);
  537.     REDLINE_ANG = 210;
  538. }
  539. else
  540. {
  541.     HUD.REDZONE.gotoAndStop(4);
  542.     REDLINE_ANG = 260;
  543. } // end else if
  544. BG1.loadScrollContent(appdir add "\\IMG\\dash.jpg");
  545. temp_gear = 1;
  546. gear = 1;
  547. initx = joystick._x;
  548. inity = joystick._y;
  549. tension = 0.500000;
  550. decay = 0.500000;
  551. joystick.onPress = function ()
  552. {
  553.     _root.dragging = true;
  554. };
  555. joystick.onRelease = function ()
  556. {
  557.     _root.dragging = false;
  558. };
  559. joystick.onReleaseOutside = function ()
  560. {
  561.     _root.dragging = false;
  562. };
  563. with (joystick)
  564. {
  565.     shaft._xscale = Math.sqrt((knob._x - shaft._x) * (knob._x - shaft._x) + (knob._y - shaft._y) * (knob._y - shaft._y));
  566.     shaft._rotation = Math.atan2(knob._y - shaft._y, knob._x - shaft._x) * 180 / 3.141593;
  567.     if (shaft._xscale > 90)
  568.     {
  569.         shaft._xscale = 90;
  570.         knob._x = shaft._x + Math.cos(shaft._rotation * 3.141593 / 180) * shaft._xscale;
  571.         knob._y = shaft._y + Math.sin(shaft._rotation * 3.141593 / 180) * shaft._xscale;
  572.         targetx = knob._x;
  573.         targety = knob._y;
  574.     } // end if
  575. } // End of with
  576. joystick.knob.gotoAndStop(Player[0].stats.UPGRADE[64] + 1);
  577. LWY = P1.CAR.lwheel._y;
  578. RWY = P1.CAR.rwheel._y;
  579. CY = P1.CAR._y;
  580. ldiff = P1.CAR.frame._x - P1.CAR.lwheel._x;
  581. rdiff = P1.CAR.frame._x - P1.CAR.rwheel._x;
  582.  
  583. // [Action in Frame 80]
  584. P1.CAR.lwheel.gotoAndStop(_root.CIVIC.MAX_WHEEL + 2);
  585. ReColor(P1, Player[0]);
  586. if (typ2 != 5)
  587. {
  588.     P2.CAR.lwheel.gotoAndStop(_root.CIVIC.MAX_WHEEL + 2);
  589.     ReColor(P2, Player[1]);
  590. } // end if
  591.  
  592. // [Action in Frame 85]
  593. P2.CAR.lwheel.gotoAndStop(Player[1].stats._wheel);
  594. ReColor(P2, Player[1]);
  595. rctTime = 0;
  596. rctCheck = false;
  597.  
  598. // [Action in Frame 86]
  599. mseconds = mseconds + 4;
  600. if (mseconds >= 60)
  601. {
  602.     mseconds = 0;
  603.     ++seconds;
  604. } // end if
  605. var i = 0;
  606. while (i < numplayers)
  607. {
  608.     race(Player[i]);
  609.     ++i;
  610. } // end while
  611. if (!rctCheck)
  612. {
  613.     if (!Key.isDown(32))
  614.     {
  615.         rctTime = rctTime + 4;
  616.     }
  617.     else if (Key.isDown(32))
  618.     {
  619.         rctCheck = true;
  620.     } // end if
  621. } // end else if
  622. UpdateHUD();
  623. if (Player[0].rdata.d > maxdistance || Player[0].rdata.ctemp >= 100 || raceresult == false)
  624. {
  625.     sound.gotoAndPlay("stop");
  626.     sound.engine.stop("eng90");
  627.     Player[0].stats.OIL = Player[0].stats.OIL + 3;
  628.     if (Player[0].stats.OIL >= 100)
  629.     {
  630.         _root.prompt("", "Your Oil Needs to be Changed!");
  631.     } // end if
  632.     if (Player[0].rdata.ctemp >= 100)
  633.     {
  634.         _root.prompt("", "Your Engine Broke Down!");
  635.         raceresult = false;
  636.     } // end if
  637.     if (Player[0].stats.HP < 40)
  638.     {
  639.         Player[0].stats.HP = 40;
  640.     } // end if
  641.     if (Player[0].stats.TQ < 40)
  642.     {
  643.         Player[0].stats.TQ = 40;
  644.     } // end if
  645.     if (_root.RaceDataUpdate)
  646.     {
  647.         ftime = seconds * 60 + mseconds;
  648.         _root.es.sendMove([_root.OnlineChallenger.name.value], {action: ftime});
  649.         gotoAndPlay(ONLINE);
  650.     }
  651.     else if (raceresult != false)
  652.     {
  653.         raceresult = true;
  654.         gotoAndPlay(WIN);
  655.     }
  656.     else
  657.     {
  658.         gotoAndPlay(LOSE);
  659.     } // end else if
  660. }
  661. else
  662. {
  663.     raceresult = undefined;
  664.     var i = 1;
  665.     while (i < numplayers)
  666.     {
  667.         if (Player[i].rdata.d > maxdistance && typ2 != 5)
  668.         {
  669.             raceresult = false;
  670.         } // end if
  671.         ++i;
  672.     } // end while
  673. } // end else if
  674. with (joystick)
  675. {
  676.     if (!_root.Options.nogas || !Key.isDown(32))
  677.     {
  678.         if (_root.dragging && _root.Options.gearsh)
  679.         {
  680.             targetx = _xmouse;
  681.             targety = _ymouse;
  682.         }
  683.         else
  684.         {
  685.             targetx = joystick["G" add temp_gear]._x + joystick["G" add temp_gear]._width / 2;
  686.             targety = joystick["G" add temp_gear]._y + joystick["G" add temp_gear]._width / 2;
  687.         } // end if
  688.     } // end else if
  689. } // End of with
  690. with (joystick)
  691. {
  692.     boolx = new Number(0);
  693.     booly = new Number(0);
  694.     var p = 0;
  695.     while (p <= 5)
  696.     {
  697.         angle = Math.atan2(targety - knob._y, targetx - knob._x);
  698.         oldx = knob._x;
  699.         oldy = knob._y;
  700.         knob._x = knob._x + Math.cos(angle) * 7;
  701.         boolx = 0;
  702.         var i = 1;
  703.         while (i <= 4)
  704.         {
  705.             if (!_parent["GEARCHECK" add i].hitTest(knob.col))
  706.             {
  707.                 ++boolx;
  708.             } // end if
  709.             ++i;
  710.         } // end while
  711.         knob._x = oldx;
  712.         knob._y = knob._y + Math.sin(angle) * 7;
  713.         booly = 0;
  714.         var i = 1;
  715.         while (i <= 4)
  716.         {
  717.             if (!_parent["GEARCHECK" add i].hitTest(knob.col))
  718.             {
  719.                 ++booly;
  720.             } // end if
  721.             ++i;
  722.         } // end while
  723.         if (boolx != 4)
  724.         {
  725.             knob._x = knob._x + Math.cos(angle) * 7;
  726.         } // end if
  727.         if (booly == 4)
  728.         {
  729.             knob._y = oldy;
  730.         } // end if
  731.         ++p;
  732.     } // end while
  733. } // End of with
  734. with (joystick)
  735. {
  736.     shaft._xscale = Math.sqrt((knob._x - shaft._x) * (knob._x - shaft._x) + (knob._y - shaft._y) * (knob._y - shaft._y));
  737.     shaft._rotation = Math.atan2(knob._y - shaft._y, knob._x - shaft._x) * 180 / 3.141593;
  738.     if (shaft._xscale > 90)
  739.     {
  740.         shaft._xscale = 90;
  741.         knob._x = shaft._x + Math.cos(shaft._rotation * 3.141593 / 180) * shaft._xscale;
  742.         knob._y = shaft._y + Math.sin(shaft._rotation * 3.141593 / 180) * shaft._xscale;
  743.         targetx = knob._x;
  744.         targety = knob._y;
  745.     } // end if
  746. } // End of with
  747. if (Math.abs(joystick.knob._x - targetx) < 15 && Math.abs(joystick.knob._y - targety) < 15)
  748. {
  749.     var i = 0;
  750.     while (i <= 6)
  751.     {
  752.         if (joystick.knob.col.hitTest(joystick["G" add i]))
  753.         {
  754.             temp_gear = i;
  755.             Player[0].rdata.g = i;
  756.         } // end if
  757.         ++i;
  758.     } // end while
  759. } // end if
  760.  
  761. // [Action in Frame 87]
  762. gotoAndPlay(RaceLoop);
  763.  
  764. // [Action in Frame 88]
  765. stop ();
  766. if (_root.player.typ != "Arcade")
  767. {
  768.     _root.SaveGame(_root.player, _root.car);
  769. }
  770. else
  771. {
  772.     submit._visible = false;
  773. } // end else if
  774. ftime = seconds * 60 + mseconds;
  775. rctTime = timeFormat(rctTime);
  776. final = ftime add "ms (" add timeFormat(ftime) add ")";
  777. topspeed = Math.round(Player[0].rdata.tops) add "mph";
  778. wonby = Math.round(Player[0].rdata.d - Player[1].rdata.d) add "m";
  779. if (wonby < 0)
  780. {
  781.     gotoAndStop("LOSE");
  782. } // end if
  783. if (Player[1] != undefined)
  784. {
  785.     ++_root.player.wins;
  786. } // end if
  787. maxd = maxdistance add "m Race";
  788. tmpNOS = obj1.NOS;
  789. tmpNRES = obj1.NRES;
  790. perfect = new Object();
  791. perfect.typ = 2;
  792. initrace(perfect, obj1);
  793. while (perfect.rdata.d < maxdistance)
  794. {
  795.     race(perfect);
  796.     ptime = ptime + 4;
  797. } // end while
  798. obj1.NOS = tmpNOS;
  799. obj1.NRES = tmpNRES;
  800. perfecttime = ptime add "ms (" add timeFormat(ptime) add ")";
  801. effic = Math.round(ptime / ftime * 100) add "%";
  802. credits = rew.cr;
  803. carwon = rew.ca.FULLNAME;
  804.  
  805. // [Action in Frame 89]
  806. stop ();
  807. rctTime = timeFormat(rctTime);
  808. if (_root.player.typ != "Arcade")
  809. {
  810.     _root.SaveGame(_root.player, _root.car);
  811. }
  812. else
  813. {
  814.     submit._visible = false;
  815. } // end else if
  816. ftime = seconds * 60 + mseconds;
  817. final = ftime add "ms (" add timeFormat(ftime) add ")";
  818. topspeed = Math.round(Player[0].rdata.tops) add "mph";
  819. wonby = Math.round(Player[1].rdata.d - Player[0].rdata.d) add "m";
  820. maxd = maxdistance add "m Race";
  821. ++_root.player.loss;
  822. perfecttime = "Unavailable";
  823. effic = "Unavailable";
  824. credits = los.cr;
  825. if (los.ca)
  826. {
  827.     carwon = "This Car!";
  828. }
  829. else
  830. {
  831.     carwon = "";
  832. } // end else if
  833. if (los.cr != undefined)
  834. {
  835.     _root.Buy(rew.cr);
  836. } // end if
  837. if (los.ca)
  838. {
  839.     player.cash = player.cash - _root.car[_root.player.car].CW;
  840.     _root.SellCar(_root.player.car);
  841. } // end if
  842.  
  843. // [Action in Frame 90]
  844. play ();
  845. rctTime = timeFormat(rctTime);
  846. ftime = seconds * 60 + mseconds;
  847. p1final = ftime add "ms (" add timeFormat(ftime) add ")";
  848. p1name = _root.Account.alias;
  849. p2name = _root.OnlineChallenger.name.value;
  850. if (_root.RaceTempTime != "")
  851. {
  852.     _root.RaceDataUpdate = false;
  853.     p2final = _root.RaceTempTime add "ms (" add timeFormat(_root.RaceTempTime) add ")";
  854.     result._visible = true;
  855.     if (_root.RaceTempTime > ftime)
  856.     {
  857.         result.gotoAndStop(1);
  858.     }
  859.     else if (_root.RaceTempTime < ftime)
  860.     {
  861.         result.gotoAndStop(2);
  862.     }
  863.     else if (_root.RaceTempTime == ftime)
  864.     {
  865.         result.gotoAndStop(3);
  866.     } // end else if
  867. }
  868. else
  869. {
  870.     p2final = "Waiting...";
  871.     result._visible = false;
  872. } // end else if
  873.  
  874. // [Action in Frame 91]
  875. prevFrame ();
  876.  
  877. // [Action in Frame 92]
  878. gtime = new Array();
  879. var i = 1;
  880. while (i <= 6)
  881. {
  882.     gtime[i] = 0;
  883.     ++i;
  884. } // end while
  885. perfect = new Object();
  886. perfect.typ = 2;
  887. tmpNOS = obj1.NOS;
  888. tmpNRES = obj1.NRES;
  889. initrace(perfect, obj1);
  890. ptime = 0;
  891. while (perfect.rdata.d < 400)
  892. {
  893.     race(perfect);
  894.     ptime = ptime + 4;
  895.     gtime[perfect.rdata.g] = gtime[perfect.rdata.g] + 4;
  896. } // end while
  897. t400 = timeFormat(ptime);
  898. ts400 = Math.round(perfect.rdata.tops) add " mph";
  899. perfect = new Object();
  900. perfect.typ = 2;
  901. initrace(perfect, obj1);
  902. for (ptime = 0; perfect.rdata.d < 1000; ptime = ptime + 4)
  903. {
  904.     race(perfect);
  905. } // end of for
  906. t1000 = timeFormat(ptime);
  907. ts1000 = Math.round(perfect.rdata.tops) add " mph";
  908. tspeed = Math.round(perfect.rdata.TopSpeed[6]) add " mph";
  909. accel = 0;
  910. var i = 1;
  911. while (i <= 6)
  912. {
  913.     this["g" + i + "ts"] = Math.round(perfect.rdata.TopSpeed[i]);
  914.     this["g" + i + "a"] = Math.round(perfect.rdata.Accel[i] * 1000);
  915.     this["g" + i + "t"] = timeFormat(gtime[i]);
  916.     accel = accel + perfect.rdata.Accel[i];
  917.     ++i;
  918. } // end while
  919. accel = accel / 6;
  920. accel = accel * 1000;
  921. accel = Math.round(accel);
  922. obj1.NOS = tmpNOS;
  923. obj1.NRES = tmpNRES;
  924.  
  925. // [Action in Frame 93]
  926. stop ();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement