home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Classicos / pepsi_pinball.swf / scripts / frame_13 / DoAction.as
Encoding:
Text File  |  2006-05-18  |  2.9 KB  |  108 lines

  1. initGame();
  2. saloon_mc.animateLight();
  3. switch_mc.animateLight();
  4. bonus_mc.animateLight();
  5. BG_leftWindows.animateLight();
  6. BG_rightWindows.animateLight();
  7. BG_saloonWindows.animateLight();
  8. BG_pepsiTitle.animateLightOnce();
  9. playSound(T_musicMainTheme_snd);
  10. starter = setInterval(function()
  11. {
  12.    if(debug)
  13.    {
  14.       ball.mode = "table";
  15.       ball.vel.x = 0;
  16.       ball.vel.y = -6;
  17.    }
  18.    else
  19.    {
  20.       launchNewBall();
  21.    }
  22.    saloon_mc.setLightOff();
  23.    switch_mc.setLightOff();
  24.    bonus_mc.setLightOff();
  25.    BG_leftWindows.setLightOff();
  26.    BG_rightWindows.setLightOff();
  27.    BG_saloonWindows.setLightOff();
  28.    clearInterval(starter);
  29. }
  30. ,5000);
  31. _root.onEnterFrame = function()
  32. {
  33.    ballmode = ball.mode;
  34.    switch(ball.mode)
  35.    {
  36.       case "stop":
  37.          break;
  38.       case "table":
  39.          moveBall();
  40.          scaleBall();
  41.          checkWalls();
  42.          checkFlippers();
  43.          checkBumpers();
  44.          checkLargeBumpers();
  45.          checkTargets();
  46.          checkSwitches();
  47.          checkCart();
  48.          checkOutScreen();
  49.          checkRightRamp();
  50.          break;
  51.       case "rampDown" || "idle":
  52.          break;
  53.       case "rampUp":
  54.          moveBall();
  55.          scaleBall();
  56.          checkMainRamp();
  57.          break;
  58.       case "saloonEntrance":
  59.          moveBall();
  60.          scaleBall();
  61.          var velocity = new tVector(ball.vel.x,ball.vel.y);
  62.          ball.vel = new Position((- 0.707) * velocity.norm,(- 0.707) * velocity.norm);
  63.          if(ball.pos.x < 237 || ball.pos.y < 155)
  64.          {
  65.             fadeSound(M_saloonDoor_snd);
  66.             ball.mode = "stop";
  67.             ball.mc._visible = false;
  68.             saloon_mc.animateLight();
  69.             BG_saloonWindows.animateLight();
  70.             stopSound(T_musicIntro_snd);
  71.             playSound(T_musicMainTheme_snd);
  72.             starter = setInterval(function()
  73.             {
  74.                saloon_mc.setLightOff();
  75.                BG_saloonWindows.setLightOff();
  76.                _root.attachMovie("breakOut","breakOut",10000);
  77.                breakOutMode = true;
  78.                clearInterval(starter);
  79.             }
  80.             ,1500);
  81.          }
  82.          break;
  83.       case "cartEntrance":
  84.          cartRamp.startPos = new Position(ball.pos.x - cartRamp._x,ball.pos.y - cartRamp._y);
  85.          cartRamp.endPos = new Position(cart.pos.x - 6 - cartRamp._x,cart.pos.y - 15 - cartRamp._y);
  86.          cartRamp.move();
  87.          ball.mode = "idle";
  88.          while(soundIndice > 4)
  89.          {
  90.             soundIndice -= 5;
  91.          }
  92.          playSound(cartSoundArr[soundIndice]);
  93.          soundIndice++;
  94.          break;
  95.       case "rightRamp":
  96.          ball.vel.x = 2;
  97.          ball.vel.y = 0;
  98.          moveBall();
  99.          scaleBall();
  100.          if(ball.pos.x > 537)
  101.          {
  102.             playSound(M_wolf_snd);
  103.             ball.mode = "idle";
  104.             rightRamp.start();
  105.          }
  106.    }
  107. };
  108.