home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Diversos / orbitballs10-blank.swf / scripts / frame_3 / DoAction.as
Encoding:
Text File  |  2008-09-02  |  4.7 KB  |  189 lines

  1. i = 1;
  2. if(actif == 1)
  3. {
  4.    if(ball1.hitTest(zaa) && zaa._alpha == 100)
  5.    {
  6.       zaa._x = random(580) + 11;
  7.       zaa._y = random(380) + 11;
  8.       if(scori > 0)
  9.       {
  10.          scori--;
  11.       }
  12.       if(scori == 0)
  13.       {
  14.          actif = 0;
  15.          stopDrag();
  16.          if(thesound == 1)
  17.          {
  18.             win.start(0);
  19.          }
  20.          fond_noir_new.gotoAndPlay(2);
  21.       }
  22.       else if(thesound == 1)
  23.       {
  24.          generic.start(0);
  25.       }
  26.       score.score = scori;
  27.       scorp += Math.round((Math.abs(speedx1) + Math.abs(speedy1)) / 10);
  28.       scorepts.scorepts = scorp;
  29.    }
  30.    timeb._width -= step;
  31.    if(timeb._width < 100 && first_boum == 0)
  32.    {
  33.       first_boum = 1;
  34.       if(thesound == 1)
  35.       {
  36.          soundclocktick.start(0);
  37.       }
  38.    }
  39.    if(timeb._width < 1)
  40.    {
  41.       actif = 0;
  42.       stopDrag();
  43.       game_over = 1;
  44.       fond_noir_new.gotoAndPlay(2);
  45.    }
  46. }
  47. while(Number(i) <= 2)
  48. {
  49.    if(eval("drag" add i) == true)
  50.    {
  51.       set("thenx" add i,eval("nowx" add i));
  52.       set("theny" add i,eval("nowy" add i));
  53.       set("nowx" add i,getProperty("ball" add i, _X));
  54.       set("nowy" add i,getProperty("ball" add i, _Y));
  55.       set("speedx" add i,eval("nowx" add i) - eval("thenx" add i));
  56.       set("speedy" add i,eval("nowy" add i) - eval("theny" add i));
  57.       if(eval("nowx" add i) >= 590)
  58.       {
  59.          set("drag" add i,false);
  60.          stopDrag();
  61.          tellTarget("/right")
  62.          {
  63.             gotoAndStop("play");
  64.             play();
  65.          }
  66.          if(eval("speedx" add i) < 0)
  67.          {
  68.             set("speedx" add i,eval("speedx" add i) - 1);
  69.          }
  70.          else
  71.          {
  72.             set("speedx" add i,eval("speedx" add i) * -1 - 1);
  73.          }
  74.       }
  75.       if(eval("nowx" add i) <= 10)
  76.       {
  77.          set("drag" add i,false);
  78.          stopDrag();
  79.          tellTarget("/left")
  80.          {
  81.             gotoAndStop("play");
  82.             play();
  83.          }
  84.          if(eval("speedx" add i) < 0)
  85.          {
  86.             set("speedx" add i,eval("speedx" add i) * -1 + 1);
  87.          }
  88.          else
  89.          {
  90.             set("speedx" add i,eval("speedx" add i) + 1);
  91.          }
  92.       }
  93.       if(eval("nowy" add i) >= 390)
  94.       {
  95.          stopDrag();
  96.          set("drag" add i,false);
  97.          tellTarget("/bottom")
  98.          {
  99.             gotoAndStop("play");
  100.             play();
  101.          }
  102.          if(eval("nowy" add i) < 0)
  103.          {
  104.             set("speedy" add i,eval("speedy" add i) - 1);
  105.          }
  106.          else
  107.          {
  108.             set("speedy" add i,eval("speedy" add i) * -1 - 1);
  109.          }
  110.       }
  111.       if(eval("nowy" add i) <= 10)
  112.       {
  113.          set("drag" add i,false);
  114.          stopDrag();
  115.          tellTarget("/top")
  116.          {
  117.             gotoAndStop("play");
  118.             play();
  119.          }
  120.          if(eval("speedy" add i) < 0)
  121.          {
  122.             set("speedy" add i,eval("speedy" add i) * -1 + 1);
  123.          }
  124.          else
  125.          {
  126.             set("speedy" add i,eval("speedy" add i) + 1);
  127.          }
  128.       }
  129.    }
  130.    i = Number(i) + 1;
  131. }
  132. duplicateMovieClip("line","tether",16383);
  133. setProperty("tether", _X, nowx1);
  134. setProperty("tether", _Y, nowy1);
  135. setProperty("tether", _xscale, nowx2 - nowx1);
  136. setProperty("tether", _yscale, nowy2 - nowy1);
  137. diffx = nowx2 - nowx1;
  138. diffy = nowy2 - nowy1;
  139. if(Number(Number(diffx * diffx) + Number(diffy * diffy)) >= 800)
  140. {
  141.    touch = false;
  142. }
  143. if(Number(touch) == Number(false))
  144. {
  145.    if(Number(Number(diffx * diffx) + Number(diffy * diffy)) <= 400)
  146.    {
  147.       touch = true;
  148.       if(actif == 1)
  149.       {
  150.          tellTarget("/smack")
  151.          {
  152.             gotoAndStop("sound");
  153.             play();
  154.             if(_root.scorp > 4)
  155.             {
  156.                _root.scorp -= 5;
  157.             }
  158.             else
  159.             {
  160.                _root.scorp = 0;
  161.             }
  162.             _root.scorepts.scorepts = _root.scorp;
  163.          }
  164.       }
  165.       speedxtemp = speedx1;
  166.       speedytemp = speedy1;
  167.       speedx1 = speedx2 * tap * (Number((random(100) / 2 - 25) / 100) + 1);
  168.       if(Number(speedx1 * speedx1) >= Number(max * max))
  169.       {
  170.          speedx1 *= 0.95;
  171.       }
  172.       speedx2 = speedxtemp * tap * (Number((random(100) / 2 - 25) / 100) + 1);
  173.       if(Number(speedx2 * speedx2) >= Number(max * max))
  174.       {
  175.          speedx2 *= 0.95;
  176.       }
  177.       speedy1 = speedy2 * tap * (Number((random(100) / 2 - 25) / 100) + 1);
  178.       if(Number(speedy1 * speedy1) >= Number(max * max))
  179.       {
  180.          speedy1 *= 0.95;
  181.       }
  182.       speedy2 = speedytemp * tap * (Number((random(100) / 2 - 25) / 100) + 1);
  183.       if(Number(speedy2 * speedy2) >= Number(max * max))
  184.       {
  185.          speedy2 *= 0.95;
  186.       }
  187.    }
  188. }
  189.