home *** CD-ROM | disk | FTP | other *** search
/ One Click 21 (Special) / OC021.iso / Juegos / 04-10-20-2.swf / scripts / DefineSprite_438 / frame_2 / DoAction.as
Encoding:
Text File  |  2005-11-18  |  1.4 KB  |  83 lines

  1. if(Key.isDown(37) && gameActive)
  2. {
  3.    da = 6;
  4.    ds += 0.1;
  5.    tube.gotoAndStop("rActive");
  6. }
  7. else if(Key.isDown(39) && gameActive)
  8. {
  9.    da = -6;
  10.    ds += 0.1;
  11.    tube.gotoAndStop("lActive");
  12. }
  13. else
  14. {
  15.    da *= 0.5;
  16.    ds *= 0.5;
  17.    if(!gameActive)
  18.    {
  19.       tube.gotoAndStop("winGame");
  20.    }
  21.    else
  22.    {
  23.       tube.gotoAndStop("inActive");
  24.    }
  25. }
  26. a += da;
  27. s = (s + ds) * waterRes;
  28. if(s < sMin)
  29. {
  30.    s = sMin;
  31. }
  32. if(sMax < s)
  33. {
  34.    s = sMax;
  35. }
  36. dx = Math.cos(3.141592653589793 * (a - 90) / 180) * s;
  37. dy = Math.sin(3.141592653589793 * (a - 90) / 180) * s;
  38. var tx = x + dx;
  39. var ty = y + dy;
  40. if(wall.hittest(tx,ty,true))
  41. {
  42.    s *= -0.5;
  43. }
  44. else
  45. {
  46.    x = tx;
  47.    y = ty;
  48. }
  49. tube._x = x;
  50. tube._y = y;
  51. tube._rotation = a;
  52. if(finish.hittest(x,y,true))
  53. {
  54.    if(lastmarker == 2)
  55.    {
  56.       lastmarker = 0;
  57.       currentLap += 1;
  58.       timer.currentLap = currentLap;
  59.       if(currentLap == 2)
  60.       {
  61.          timer.timerActive = false;
  62.          g1Result._visible = true;
  63.          g1Result.finalTime = timer.elapsedTime + " seconds";
  64.          _root.timeTracker += timer.elapsedTime;
  65.          gameActive = false;
  66.       }
  67.    }
  68. }
  69. else if(partway1.hittest(x,y,true))
  70. {
  71.    if(lastmarker == 0)
  72.    {
  73.       lastmarker = 1;
  74.    }
  75. }
  76. else if(partway2.hittest(x,y,true))
  77. {
  78.    if(lastmarker == 1)
  79.    {
  80.       lastmarker = 2;
  81.    }
  82. }
  83.