home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Corrida / microracers.swf / scripts / frame_83 / DoAction.as
Encoding:
Text File  |  2006-06-13  |  10.1 KB  |  495 lines

  1. function Pr_Car()
  2. {
  3.    with(_root.car)
  4.    {
  5.       if(_root.doroga.hitTest(getBounds(_root).xMax,_y,true))
  6.       {
  7.          _x -= _root.speed2;
  8.          if(_root.p > 0.5)
  9.          {
  10.             _root.p -= _root.speed2 * 2;
  11.          }
  12.          else if(_root.p < 0.5)
  13.          {
  14.             _root.p += _root.speed2 * 2;
  15.          }
  16.       }
  17.       if(_root.doroga.hitTest(getBounds(_root).xMin,_y,true))
  18.       {
  19.          _x += _root.speed2;
  20.          if(_root.p > 0.5)
  21.          {
  22.             _root.p -= _root.speed2 * 2;
  23.          }
  24.          else if(_root.p < 0.5)
  25.          {
  26.             _root.p += _root.speed2 * 2;
  27.          }
  28.       }
  29.       if(_root.doroga.hitTest(_x,getBounds(_root).yMax,true))
  30.       {
  31.          _y -= _root.speed2;
  32.          if(_root.p > 0.5)
  33.          {
  34.             _root.p -= _root.speed2 * 2;
  35.          }
  36.          else if(_root.p < 0.5)
  37.          {
  38.             _root.p += _root.speed2 * 2;
  39.          }
  40.       }
  41.       if(_root.doroga.hitTest(_x,getBounds(_root).yMin,true))
  42.       {
  43.          _y += _root.speed2;
  44.          if(_root.p > 0.5)
  45.          {
  46.             _root.p -= _root.speed2 * 2;
  47.          }
  48.          else if(_root.p < 0.5)
  49.          {
  50.             _root.p += _root.speed2 * 2;
  51.          }
  52.       }
  53.    }
  54. }
  55. function MoveAll(nextl)
  56. {
  57.    speed = 3;
  58.    speed2 = 0.4;
  59.    otkl = 6;
  60.    if(p < 2)
  61.    {
  62.       car.flame.gotoandstop(1);
  63.       netrofl = false;
  64.       if(_root.netro.dwn)
  65.       {
  66.          _root.netro.gotoandplay(1);
  67.          _root.msnd.Playsnd(4);
  68.       }
  69.    }
  70.    if(p > 0)
  71.    {
  72.       if(_root.netrofl)
  73.       {
  74.          spm.speed._rotation = 85;
  75.       }
  76.       else
  77.       {
  78.          spm.speed._rotation = p * 50 - 90;
  79.       }
  80.    }
  81.    if(p < 0)
  82.    {
  83.       spm.speed._rotation = (- p) * 10 - 90;
  84.    }
  85.    gameDate = new Date();
  86.    sec = gameDate.getSeconds();
  87.    min = gameDate.getMinutes();
  88.    mls = int(gameDate.getMilliseconds() / 10);
  89.    if(mls < 10)
  90.    {
  91.       mls = "0" + mls;
  92.    }
  93.    gts = sec - startsec;
  94.    gtm = min - startmin;
  95.    if(gtm < 0)
  96.    {
  97.       gtmp = gtm + 60;
  98.    }
  99.    else
  100.    {
  101.       gtmp = gtm;
  102.    }
  103.    if(gts < 0)
  104.    {
  105.       gtsl = gts + 60;
  106.    }
  107.    else
  108.    {
  109.       gtsl = gts;
  110.    }
  111.    if(gts < 10 and gts > -1)
  112.    {
  113.       gtsl = "0" + gtsl;
  114.    }
  115.    if(gtsl == 0)
  116.    {
  117.       gtml = gtmp;
  118.    }
  119.    if(gtml < 1)
  120.    {
  121.       time = "00:" + gtsl + ":" + mls;
  122.    }
  123.    else
  124.    {
  125.       time = gtml + ":" + gtsl + ":" + mls;
  126.    }
  127.    if(p < 0.05 && p > 0.049 || p < 0.02 && p > 0.019 || p < 0.04 && p > 0.039 || p < 0.03 && p > 0.029 || p < 0.01 && p > 0.009 || p < 0.01 && p > 0)
  128.    {
  129.       p = 0;
  130.    }
  131.    car._x += p * Math.cos(0.017453292519943295 * _root.rotcar);
  132.    car._y += p * Math.sin(0.017453292519943295 * _root.rotcar);
  133.    car2._x += p2 * Math.cos(0.017453292519943295 * _root.rotcar2);
  134.    car2._y += p2 * Math.sin(0.017453292519943295 * _root.rotcar2);
  135.    car3._x += p3 * Math.cos(0.017453292519943295 * _root.rotcar3);
  136.    car3._y += p3 * Math.sin(0.017453292519943295 * _root.rotcar3);
  137.    car4._x += p4 * Math.cos(0.017453292519943295 * _root.rotcar4);
  138.    car4._y += p4 * Math.sin(0.017453292519943295 * _root.rotcar4);
  139.    rotcar = getProperty("/car", _rotation);
  140.    rotcar2 = getProperty("/car2", _rotation);
  141.    rotcar3 = getProperty("/car3", _rotation);
  142.    rotcar4 = getProperty("/car4", _rotation);
  143.    prov._x = car._x;
  144.    prov._y = car._y;
  145.    prov._rotation = car._rotation;
  146.    prov._visible = 0;
  147.    if(p > 0)
  148.    {
  149.       if(car.hitTest("/fon"))
  150.       {
  151.          p -= 0.02;
  152.       }
  153.    }
  154.    if(p < 0)
  155.    {
  156.       if(car.hitTest("/fon"))
  157.       {
  158.          p += 0.02;
  159.       }
  160.    }
  161.    if(p2 < 0)
  162.    {
  163.       if(car2.hitTest("/fon"))
  164.       {
  165.          p2 += 0.02;
  166.       }
  167.    }
  168.    if(p3 < 0)
  169.    {
  170.       if(car3.hitTest("/fon"))
  171.       {
  172.          p3 += 0.02;
  173.       }
  174.    }
  175.    if(p4 < 0)
  176.    {
  177.       if(car4.hitTest("/fon"))
  178.       {
  179.          p4 += 0.02;
  180.       }
  181.    }
  182. }
  183. function MyCarSelect(col)
  184. {
  185.    col2 = col + 1;
  186.    if(col2 > 5)
  187.    {
  188.       col2 = 1;
  189.    }
  190.    col3 = col2 + 1;
  191.    if(col3 > 5)
  192.    {
  193.       col3 = 1;
  194.    }
  195.    col4 = col3 + 1;
  196.    if(col4 > 5)
  197.    {
  198.       col4 = 1;
  199.    }
  200.    _root.car.gotoandstop(col);
  201.    _root.car2.gotoandstop(col2);
  202.    _root.car3.gotoandstop(col3);
  203.    _root.car4.gotoandstop(col4);
  204. }
  205. function SetEndTime()
  206. {
  207.    stoptime2 = new Date();
  208.    secstop2 = stoptime2.getSeconds();
  209.    minstop2 = stoptime2.getMinutes();
  210.    ssl2 = secstop2 - startsec;
  211.    msl2 = minstop2 - startmin;
  212.    if(msl2 < 0)
  213.    {
  214.       mslp2 = msl2 + 60 - 1;
  215.    }
  216.    else
  217.    {
  218.       mslp2 = msl2 - 1;
  219.    }
  220.    if(ssl2 < 0)
  221.    {
  222.       sslp2 = ssl2 + 60;
  223.    }
  224.    else
  225.    {
  226.       sslp2 = ssl2;
  227.    }
  228.    if(mslp2 < 1)
  229.    {
  230.       _root.timelast2 = sslp2 + "sec";
  231.    }
  232.    else
  233.    {
  234.       _root.timelast2 = mslp2 + "min" + " " + sslp2 + "sec";
  235.    }
  236. }
  237. function CarBot2(ll)
  238. {
  239.    rand = random(ll) * 0.03;
  240.    if(_root.p2 < _root.speed + rand)
  241.    {
  242.       _root.p2 += 0.1 + rand;
  243.    }
  244.    with(_root.car)
  245.    {
  246.       if(_root.car2.hitTest(getBounds(_root).xMax,_y,true))
  247.       {
  248.          _x -= 0.5;
  249.       }
  250.       if(_root.car2.hitTest(getBounds(_root).xMin,_y,true))
  251.       {
  252.          _x += 0.5;
  253.       }
  254.       if(_root.car2.hitTest(_x,getBounds(_root).yMax,true))
  255.       {
  256.          _y -= 0.5;
  257.       }
  258.       if(_root.car2.hitTest(_x,getBounds(_root).yMin,true))
  259.       {
  260.          _y += 0.5;
  261.       }
  262.    }
  263.    with(_root.car3)
  264.    {
  265.       if(_root.car2.hitTest(getBounds(_root).xMax,_y,true))
  266.       {
  267.          _rotation -= 3;
  268.          _x -= 0.5;
  269.       }
  270.       if(_root.car2.hitTest(getBounds(_root).xMin,_y,true))
  271.       {
  272.          _rotation -= 3;
  273.          _x += 0.5;
  274.       }
  275.       if(_root.car2.hitTest(_x,getBounds(_root).yMax,true))
  276.       {
  277.          _rotation -= 3;
  278.          _y -= 0.5;
  279.       }
  280.       if(_root.car2.hitTest(_x,getBounds(_root).yMin,true))
  281.       {
  282.          _rotation -= 3;
  283.          _y += 0.5;
  284.       }
  285.    }
  286.    with(_root.car4)
  287.    {
  288.       if(_root.car2.hitTest(getBounds(_root).xMax,_y,true))
  289.       {
  290.          _rotation -= 3;
  291.          _x -= 0.5;
  292.       }
  293.       if(_root.car2.hitTest(getBounds(_root).xMin,_y,true))
  294.       {
  295.          _rotation -= 3;
  296.          _x += 0.5;
  297.       }
  298.       if(_root.car2.hitTest(_x,getBounds(_root).yMax,true))
  299.       {
  300.          _rotation -= 3;
  301.          _y -= 0.5;
  302.       }
  303.       if(_root.car2.hitTest(_x,getBounds(_root).yMin,true))
  304.       {
  305.          _rotation -= 3;
  306.          _y += 0.5;
  307.       }
  308.    }
  309. }
  310. function CarBot3(ll)
  311. {
  312.    rand = random(3) * 0.03;
  313.    if(_root.p3 < _root.speed + rand)
  314.    {
  315.       _root.p3 += 0.1 + rand;
  316.    }
  317.    with(_root.car)
  318.    {
  319.       if(_root.car3.hitTest(getBounds(_root).xMax,_y,true))
  320.       {
  321.          _x -= 0.5;
  322.       }
  323.       if(_root.car3.hitTest(getBounds(_root).xMin,_y,true))
  324.       {
  325.          _x += 0.5;
  326.       }
  327.       if(_root.car3.hitTest(_x,getBounds(_root).yMax,true))
  328.       {
  329.          _y -= 0.5;
  330.       }
  331.       if(_root.car3.hitTest(_x,getBounds(_root).yMin,true))
  332.       {
  333.          _y += 0.5;
  334.       }
  335.    }
  336.    with(_root.car2)
  337.    {
  338.       if(_root.car3.hitTest(getBounds(_root).xMax,_y,true))
  339.       {
  340.          _rotation -= 3;
  341.          _x -= 0.5;
  342.       }
  343.       if(_root.car3.hitTest(getBounds(_root).xMin,_y,true))
  344.       {
  345.          _rotation -= 3;
  346.          _x += 0.5;
  347.       }
  348.       if(_root.car3.hitTest(_x,getBounds(_root).yMax,true))
  349.       {
  350.          _rotation -= 3;
  351.          _y -= 0.5;
  352.       }
  353.       if(_root.car3.hitTest(_x,getBounds(_root).yMin,true))
  354.       {
  355.          _rotation -= 3;
  356.          _y += 0.5;
  357.       }
  358.    }
  359.    with(_root.car4)
  360.    {
  361.       if(_root.car3.hitTest(getBounds(_root).xMax,_y,true))
  362.       {
  363.          _rotation -= 3;
  364.          _x -= 0.5;
  365.       }
  366.       if(_root.car3.hitTest(getBounds(_root).xMin,_y,true))
  367.       {
  368.          _rotation -= 3;
  369.          _x += 0.5;
  370.       }
  371.       if(_root.car3.hitTest(_x,getBounds(_root).yMax,true))
  372.       {
  373.          _rotation -= 3;
  374.          _y -= 0.5;
  375.       }
  376.       if(_root.car3.hitTest(_x,getBounds(_root).yMin,true))
  377.       {
  378.          _rotation -= 3;
  379.          _y += 0.5;
  380.       }
  381.    }
  382. }
  383. function CarBot4(ll)
  384. {
  385.    rand = random(ll) * 0.03;
  386.    if(_root.p4 < _root.speed + rand)
  387.    {
  388.       _root.p4 += 0.1 + rand;
  389.    }
  390.    with(_root.car)
  391.    {
  392.       if(_root.car4.hitTest(getBounds(_root).xMax,_y,true))
  393.       {
  394.          _x -= 0.5;
  395.       }
  396.       if(_root.car4.hitTest(getBounds(_root).xMin,_y,true))
  397.       {
  398.          _x += 0.5;
  399.       }
  400.       if(_root.car4.hitTest(_x,getBounds(_root).yMax,true))
  401.       {
  402.          _y -= 0.5;
  403.       }
  404.       if(_root.car4.hitTest(_x,getBounds(_root).yMin,true))
  405.       {
  406.          _y += 0.5;
  407.       }
  408.    }
  409.    with(_root.car2)
  410.    {
  411.       if(_root.car4.hitTest(getBounds(_root).xMax,_y,true))
  412.       {
  413.          _x -= 0.5;
  414.       }
  415.       if(_root.car4.hitTest(getBounds(_root).xMin,_y,true))
  416.       {
  417.          _x += 0.5;
  418.       }
  419.       if(_root.car4.hitTest(_x,getBounds(_root).yMax,true))
  420.       {
  421.          _y -= 0.5;
  422.       }
  423.       if(_root.car4.hitTest(_x,getBounds(_root).yMin,true))
  424.       {
  425.          _y += 0.5;
  426.       }
  427.    }
  428.    with(_root.car3)
  429.    {
  430.       if(_root.car4.hitTest(getBounds(_root).xMax,_y,true))
  431.       {
  432.          _rotation -= 3;
  433.          _x -= 0.5;
  434.       }
  435.       if(_root.car4.hitTest(getBounds(_root).xMin,_y,true))
  436.       {
  437.          _rotation -= 3;
  438.          _x += 0.5;
  439.       }
  440.       if(_root.car4.hitTest(_x,getBounds(_root).yMax,true))
  441.       {
  442.          _rotation -= 3;
  443.          _y -= 0.5;
  444.       }
  445.       if(_root.car4.hitTest(_x,getBounds(_root).yMin,true))
  446.       {
  447.          _rotation -= 3;
  448.          _y += 0.5;
  449.       }
  450.    }
  451. }
  452. function SetEndGame()
  453. {
  454.    stopAllSounds();
  455.    laps = "5";
  456.    netrofl = false;
  457.    stay = 1;
  458.    t = 15;
  459.    p = 0;
  460.    p2 = 0;
  461.    p3 = 0;
  462.    p4 = 0;
  463.    lap = 1;
  464.    lap2 = 1;
  465.    lap3 = 1;
  466.    lap4 = 1;
  467.    po1 = 0;
  468.    po2 = 0;
  469.    po3 = 0;
  470.    pob3_2 = 0;
  471.    pob3_3 = 0;
  472.    pob3_4 = 0;
  473.    ran = random(10);
  474.    netro.gotoandstop(1);
  475.    car._rotation = -90;
  476.    car.flame.gotoandstop(1);
  477.    spm.speed._rotation = -90;
  478. }
  479. if(map == 2)
  480. {
  481.    gotoAndPlay(113);
  482. }
  483. if(map == 3)
  484. {
  485.    gotoAndPlay(141);
  486. }
  487. if(map == 4)
  488. {
  489.    gotoAndPlay(169);
  490. }
  491. if(map == 5)
  492. {
  493.    gotoAndPlay(197);
  494. }
  495.