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

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