home *** CD-ROM | disk | FTP | other *** search
/ Champak 48 / cdrom_image.iso / Games / breakawish.swf / scripts / __Packages / MainBall.as < prev    next >
Encoding:
Text File  |  2007-09-28  |  2.2 KB  |  71 lines

  1. class MainBall extends Ball
  2. {
  3.    var nCurrentCombo;
  4.    static var sSTATE_APPEARS = "Appears";
  5.    function MainBall(_mcRef)
  6.    {
  7.       super(_mcRef);
  8.       this.nCurrentCombo = 0;
  9.       this.setState(MainBall.sSTATE_APPEARS);
  10.    }
  11.    function doAppears()
  12.    {
  13.       if(this.isStateComplete())
  14.       {
  15.          this.setState(Ball.sSTATE_LAUNCH_WAIT);
  16.       }
  17.    }
  18.    function doSpecificTrailStar()
  19.    {
  20.       var _loc2_ = undefined;
  21.       switch(this.CurrentState)
  22.       {
  23.          case Ball.sSTATE_MOVING:
  24.             _loc2_ = "Normal";
  25.             break;
  26.          case Ball.sSTATE_MOVING_PASSTHROUGH:
  27.             _loc2_ = "Suit";
  28.             break;
  29.          case Ball.sSTATE_MOVING_CHEWINGGUM:
  30.             _loc2_ = "Gum";
  31.             break;
  32.          case Ball.sSTATE_MOVING_PASSPLUSGUM:
  33.             _loc2_ = "Gum";
  34.       }
  35.       if(_loc2_ != undefined)
  36.       {
  37.          LevelManager.Instance.doNewTimmyTrail(this.Ref._x,this.Ref._y,_loc2_);
  38.       }
  39.    }
  40.    function onPaddleTouch(_oPaddle, _bBounceTop)
  41.    {
  42.       this.nCurrentCombo = 0;
  43.       if(_oPaddle instanceof PlayerPaddle && _bBounceTop)
  44.       {
  45.          switch(_oPaddle.CurrentState)
  46.          {
  47.             case PlayerPaddle.sPADDLE_STATE_NORMAL:
  48.             case PlayerPaddle.sPADDLE_STATE_NORMAL_BOUNCE:
  49.                Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Timmy_Bounce_Normal.mp3");
  50.                break;
  51.             case PlayerPaddle.sPADDLE_STATE_SHORT:
  52.             case PlayerPaddle.sPADDLE_STATE_SHORT_BOUNCE:
  53.                Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Timmy_Bounce_JackBox.mp3");
  54.                break;
  55.             case PlayerPaddle.sPADDLE_STATE_LARGE:
  56.             case PlayerPaddle.sPADDLE_STATE_LARGE_BOUNCE:
  57.                Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Timmy_Bounce_Trampoline.mp3");
  58.          }
  59.       }
  60.    }
  61.    function onBounceSides()
  62.    {
  63.       Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Timmy_Bounce_Sides.mp3",35);
  64.    }
  65.    function onBlockDestroy()
  66.    {
  67.       this.nCurrentCombo = this.nCurrentCombo + 1;
  68.       Game.Instance.Status.onNewCombo(this.nCurrentCombo);
  69.    }
  70. }
  71.