home *** CD-ROM | disk | FTP | other *** search
- class LevelManager extends Library.DispatcherBase
- {
- var mcRef;
- var nLevel;
- var aPaddles;
- var aBlocks;
- var aBalls;
- var aItems;
- var aBolts;
- var nBallNum;
- var nItemNum;
- var bLevelEnded;
- var bDropDownMotionWait;
- var bDropDownMotion;
- var aDropDownElements;
- var aEndLevelElements;
- var bBallSpeedUp;
- var bCalledLevelEnd;
- var bSentEndingWord;
- var nEndCountDown;
- var nNextRemoveDepth;
- var nNextFrontDepth;
- var bPaused;
- var nGameState;
- var nPreventiveEndDelay;
- var bPaddleEndMoveComplete;
- var oMainBall;
- var oBallSpeedUpTimer;
- var oMainPaddle;
- var oPixies;
- var bPixiesVisible;
- var oPixiesVisibleTimer;
- static var oCtrl;
- static var nBLOCKS_NEAR_DISTANCE_X = 60;
- static var nBLOCKS_NEAR_DISTANCE_Y = 40;
- static var nBALLS_NEAR_DISTANCE = 75;
- static var nPADDLE_NEAR_DISTANCE = 185;
- static var nDROPDOWN_LINE_BUFFER = 12;
- static var nLIMITS_CEIL = 35;
- static var nLIMITS_FLOOR = 520;
- static var nLIMITS_LEFT = 15;
- static var nLIMITS_RIGHT = 435;
- static var nGAME_STATE_DROP_DOWN_MOTION = 1;
- static var nGAME_STATE_PLAYING = 2;
- static var nGAME_STATE_WAIT_END_ITEMS_REMAIN = 3;
- static var nGAME_STATE_END_WON_COUNTDOWN = 4;
- static var nGAME_STATE_END_LOSE_COUNTDOWN = 5;
- static var nGAME_STATE_END_EXPLOSION = 6;
- static var nEND_COUNTDOWN = 45;
- static var sLINKAGE_MAIN_BALL = "mcBall";
- static var sBOLT_LINKAGE = "mcBolt";
- static var sTRAIL_STARS_LINKAGE = "mcTrailStars";
- static var sTRAIL_TIMMY_LINKAGE = "mcTrailTimmy";
- static var sWORDS_LINKAGE = "mcMots";
- static var nENDING_WORD_X = 225;
- static var nENDING_WORD_Y = 260;
- static var nMAIN_PADDLE_DEPTH = 50;
- static var nPIXIES_DEPTH_START = 75;
- static var nMAIN_PADDLE_START_X = 225;
- static var nMAIN_PADDLE_START_Y = 420;
- static var nBALL_DEPTH_START = 25000;
- static var nITEMS_DEPTH_START = 75000;
- static var nCHECK_DISTANCE_X = 50;
- static var nCHECK_DISTANCE_Y = 50;
- static var nDEPTH_REMOVE_MIN = 150000;
- static var nDEPTH_REMOVE_MAX = 160000;
- static var nDEPTH_FRONT_MIN = 550000;
- static var nDEPTH_FRONT_MAX = 760000;
- function LevelManager(_mcRef, _nLevel)
- {
- super();
- this.mcRef = _mcRef;
- LevelManager.oCtrl = this;
- this.nLevel = _nLevel;
- this.mcRef.gotoAndStop(_nLevel);
- this.mcRef.mcLevel.gotoAndStop("Init");
- this.aPaddles = new Array();
- this.aBlocks = new Array();
- this.aBalls = new Array();
- this.aItems = new Array();
- this.aBolts = new Array();
- this.nBallNum = 0;
- this.nItemNum = 0;
- this.bLevelEnded = false;
- this.bDropDownMotionWait = true;
- this.bDropDownMotion = false;
- this.aDropDownElements = new Array();
- this.aEndLevelElements = new Array();
- this.bBallSpeedUp = false;
- this.bCalledLevelEnd = false;
- this.bSentEndingWord = false;
- this.nEndCountDown = 0;
- this.nNextRemoveDepth = LevelManager.nDEPTH_REMOVE_MIN;
- this.nNextFrontDepth = LevelManager.nDEPTH_FRONT_MIN;
- this.onInitLevel();
- Game.Instance.doAddListener(this);
- }
- static function get Instance()
- {
- return LevelManager.oCtrl;
- }
- function doEnterFrame()
- {
- super.doEnterFrame();
- if(!this.bPaused)
- {
- if(this.nGameState == LevelManager.nGAME_STATE_END_WON_COUNTDOWN)
- {
- this.nEndCountDown = this.nEndCountDown - 1;
- if(this.nEndCountDown == 0)
- {
- this.onLevelEnded();
- }
- }
- else if(this.nGameState == LevelManager.nGAME_STATE_END_LOSE_COUNTDOWN)
- {
- this.nEndCountDown = this.nEndCountDown - 1;
- if(this.nEndCountDown == 0)
- {
- Game.Instance.doLevelEnd(false);
- }
- }
- else if(this.nGameState == LevelManager.nGAME_STATE_DROP_DOWN_MOTION)
- {
- if(this.bDropDownMotionWait && this.aDropDownElements.length != 0)
- {
- this.bDropDownMotionWait = false;
- this.bDropDownMotion = true;
- }
- if(this.bDropDownMotion)
- {
- this.doDropDownMotion();
- }
- }
- else if(this.nGameState == LevelManager.nGAME_STATE_END_EXPLOSION)
- {
- if(this.bLevelEnded)
- {
- this.doLevelEndExplode();
- if(!this.bCalledLevelEnd)
- {
- this.nPreventiveEndDelay = this.nPreventiveEndDelay - 1;
- if(this.nPreventiveEndDelay <= 0)
- {
- Game.Instance.doLevelEnd(true);
- this.bCalledLevelEnd = true;
- }
- }
- }
- }
- this.doCheckActiveModifiers();
- }
- }
- function doCheckLevelEndAnimComplete()
- {
- if(this.aEndLevelElements.length <= 0 && this.bPaddleEndMoveComplete && !this.bCalledLevelEnd)
- {
- Game.Instance.doLevelEnd(true);
- this.bCalledLevelEnd = true;
- }
- }
- function onPaddleMovedCenter()
- {
- if(this.bLevelEnded)
- {
- this.bPaddleEndMoveComplete = true;
- this.doCheckLevelEndAnimComplete();
- }
- }
- function onLevelEndAnimEnded(_oElement)
- {
- for(var _loc3_ in this.aEndLevelElements)
- {
- if(this.aEndLevelElements[_loc3_].oObj == _oElement)
- {
- delete this.aEndLevelElements[_loc3_].oObj;
- delete this.aEndLevelElements[_loc3_].bExploded;
- this.aEndLevelElements.splice(Number(_loc3_),1);
- }
- }
- this.doCheckLevelEndAnimComplete();
- }
- function onDropDownCompleteForElement(_oElement)
- {
- for(var _loc3_ in this.aDropDownElements)
- {
- if(this.aDropDownElements[_loc3_].oObj == _oElement)
- {
- delete this.aDropDownElements[_loc3_].oObj;
- delete this.aDropDownElements[_loc3_].bMoving;
- this.aDropDownElements.splice(Number(_loc3_),1);
- }
- }
- if(this.aDropDownElements.length <= 0)
- {
- this.onDropDownComplete();
- }
- }
- function doAddPaddle(_oPaddle)
- {
- this.aPaddles.push(_oPaddle);
- }
- function doRemovePaddle(_oPaddle)
- {
- for(var _loc3_ in this.aPaddles)
- {
- if(this.aPaddles[_loc3_] == _oPaddle)
- {
- delete this.aPaddles[_loc3_];
- this.aPaddles.splice(_loc3_,1);
- }
- }
- }
- function doAddLevelDesignItem(_mcItem, _nItemType)
- {
- new LevelDesignItem(_mcItem,_nItemType);
- }
- function doAddItemAt(_nX, _nY, _nItemType)
- {
- var _loc2_ = undefined;
- switch(_nItemType)
- {
- case LevelDesignItem.nBONUS_FAIRY_CROWN:
- _loc2_ = LevelDesignItem.sLINKAGE_BONUS_FAIRY_CROWN;
- break;
- case LevelDesignItem.nBONUS_CC_POWERSUIT:
- _loc2_ = LevelDesignItem.sLINKAGE_BONUS_CC_POWERSUIT;
- break;
- case LevelDesignItem.nBONUS_CC_SYMBOL:
- _loc2_ = LevelDesignItem.sLINKAGE_BONUS_CC_SYMBOL;
- break;
- case LevelDesignItem.nPOWERDOWN_ROCKET:
- _loc2_ = LevelDesignItem.sLINKAGE_POWERDOWN_ROCKET;
- break;
- case LevelDesignItem.nBONUS_TRAMPOLINE:
- _loc2_ = LevelDesignItem.sLINKAGE_BONUS_TRAMPOLINE;
- break;
- case LevelDesignItem.nPOWERDOWN_JACKBOX:
- _loc2_ = LevelDesignItem.sLINKAGE_POWERDOWN_JACKBOX;
- break;
- case LevelDesignItem.nBONUS_CHEWINGGUM:
- _loc2_ = LevelDesignItem.sLINKAGE_BONUS_CHEWINGGUM;
- break;
- case LevelDesignItem.nBONUS_MAGICWAND:
- _loc2_ = LevelDesignItem.sLINKAGE_BONUS_MAGICWAND;
- break;
- case LevelDesignItem.nPOWERDOWN_PING:
- _loc2_ = LevelDesignItem.sLINKAGE_POWERDOWN_PING;
- }
- this.nItemNum = this.nItemNum + 1;
- var _loc3_ = this.mcRef.attachMovie(_loc2_,"mcItem" + this.nItemNum,LevelManager.nITEMS_DEPTH_START + this.nItemNum);
- _loc3_._x = _nX;
- _loc3_._y = _nY;
- var _loc4_ = new FallingItem(_loc3_,_nItemType);
- this.aItems.push(_loc4_);
- }
- function doAddShootingStar(_mcStar)
- {
- var _loc2_ = new ShootingStar(_mcStar);
- this.aDropDownElements.push({oObj:_loc2_,bMoving:false});
- _loc2_.onHideForDropDown();
- this.aBalls.push(_loc2_);
- }
- function doAddBlock(_mcBlock, _nStepNumber)
- {
- var _loc2_ = new Block(_mcBlock,_nStepNumber);
- this.aDropDownElements.push({oObj:_loc2_,bMoving:false});
- _loc2_.onHideForDropDown();
- this.aBlocks.push(_loc2_);
- }
- function doNewBolt(_nX, _nY)
- {
- this.nItemNum = this.nItemNum + 1;
- var _loc2_ = this.mcRef.attachMovie(LevelManager.sBOLT_LINKAGE,"mcBolt" + this.nItemNum,LevelManager.nITEMS_DEPTH_START + this.nItemNum);
- _loc2_._x = _nX;
- _loc2_._y = _nY;
- var _loc3_ = new Bolt(_loc2_);
- this.aBolts.push(_loc3_);
- }
- function doNewTimmyTrail(_nX, _nY, _sAddonState)
- {
- this.nItemNum = this.nItemNum + 1;
- var _loc2_ = this.mcRef.attachMovie(LevelManager.sTRAIL_TIMMY_LINKAGE,"mcTT" + this.nItemNum,LevelManager.nITEMS_DEPTH_START + this.nItemNum);
- _loc2_._x = _nX;
- _loc2_._y = _nY;
- new TrailTimmy(_loc2_,_sAddonState);
- }
- function doNewTrailStar(_nX, _nY)
- {
- this.nItemNum = this.nItemNum + 1;
- var _loc2_ = this.mcRef.attachMovie(LevelManager.sTRAIL_STARS_LINKAGE,"mcTS" + this.nItemNum,LevelManager.nITEMS_DEPTH_START + this.nItemNum);
- _loc2_._x = _nX;
- _loc2_._y = _nY;
- new TrailStars(_loc2_);
- }
- function doNewEndingWord()
- {
- if(!this.bSentEndingWord)
- {
- this.nItemNum = this.nItemNum + 1;
- var _loc2_ = this.mcRef.attachMovie(LevelManager.sWORDS_LINKAGE,"mcWord" + this.nItemNum,LevelManager.nITEMS_DEPTH_START + this.nItemNum);
- _loc2_._x = LevelManager.nENDING_WORD_X;
- _loc2_._y = LevelManager.nENDING_WORD_Y;
- new EndingWord(_loc2_);
- this.bSentEndingWord = true;
- }
- }
- function getNearPaddlesForObject(_oObject)
- {
- var _loc4_ = new Array();
- var _loc3_ = Library.Utils.MoreMath.getBoundsCenter(_oObject.Bounds);
- for(var _loc6_ in this.aPaddles)
- {
- if(this.aPaddles[_loc6_] != _oObject)
- {
- var _loc2_ = Library.Utils.MoreMath.getBoundsCenter(this.aPaddles[_loc6_].Bounds);
- if(Library.Utils.MoreMath.getManhattanDistance(_loc3_.x,_loc3_.y,_loc2_.x,_loc2_.y) <= LevelManager.nPADDLE_NEAR_DISTANCE)
- {
- _loc4_.push(this.aPaddles[_loc6_]);
- }
- }
- }
- return _loc4_;
- }
- function getNearBallsForObject(_oObject)
- {
- var _loc4_ = new Array();
- var _loc3_ = Library.Utils.MoreMath.getBoundsCenter(_oObject.Bounds);
- for(var _loc6_ in this.aBalls)
- {
- if(this.aBalls[_loc6_] != _oObject)
- {
- var _loc2_ = Library.Utils.MoreMath.getBoundsCenter(this.aBalls[_loc6_].Bounds);
- if(Library.Utils.MoreMath.getManhattanDistance(_loc3_.x,_loc3_.y,_loc2_.x,_loc2_.y) <= LevelManager.nBALLS_NEAR_DISTANCE)
- {
- _loc4_.push(this.aBalls[_loc6_]);
- }
- }
- }
- return _loc4_;
- }
- function getNearBlocksForObject(_oObject)
- {
- var _loc4_ = new Array();
- var _loc3_ = Library.Utils.MoreMath.getBoundsCenter(_oObject.Bounds);
- for(var _loc6_ in this.aBlocks)
- {
- if(this.aBlocks[_loc6_] != _oObject)
- {
- var _loc2_ = Library.Utils.MoreMath.getBoundsCenter(this.aBlocks[_loc6_].Bounds);
- if(Math.abs(_loc3_.y - _loc2_.y) <= LevelManager.nBLOCKS_NEAR_DISTANCE_Y)
- {
- if(Math.abs(_loc3_.x - _loc2_.x) <= LevelManager.nBLOCKS_NEAR_DISTANCE_X)
- {
- _loc4_.push(this.aBlocks[_loc6_]);
- }
- }
- }
- }
- return _loc4_;
- }
- function onItemLost(_oItem)
- {
- this.doDeleteItem(_oItem);
- if(this.nGameState == LevelManager.nGAME_STATE_WAIT_END_ITEMS_REMAIN)
- {
- this.doCheckLevelEnd();
- }
- }
- function onPlayerCatchItem(_oItem)
- {
- this.doDeleteItem(_oItem);
- var _loc3_ = _oItem.ItemType;
- Game.Instance.onPlayerCatchItem(_loc3_);
- switch(_loc3_)
- {
- case LevelDesignItem.nBONUS_FAIRY_CROWN:
- Game.Instance.Status.onGainLive();
- Game.Instance.Status.onCatchBonus();
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Bonus_Catch_FairyCrown.mp3",100,1,true);
- break;
- case LevelDesignItem.nBONUS_CC_POWERSUIT:
- this.oMainBall.onGainPassThroughAbility();
- Game.Instance.Status.onCatchBonus();
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Bonus_Catch_CC_Suit.mp3",100,1,true);
- break;
- case LevelDesignItem.nBONUS_CC_SYMBOL:
- Game.Instance.Status.onCatchBonus();
- Game.Instance.Status.doAddPoints(LevelDesignItem.nBONUS_CC_SYMBOL_POINTS);
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Bonus_Catch_CC_Points.mp3",100,1,true);
- break;
- case LevelDesignItem.nPOWERDOWN_ROCKET:
- if(!this.bBallSpeedUp)
- {
- for(var _loc2_ in this.aBalls)
- {
- this.aBalls[_loc2_].doAffectSpeed(LevelDesignItem.nPOWERDOWN_ROCKET_SPEED);
- }
- }
- this.bBallSpeedUp = true;
- this.oBallSpeedUpTimer = new Library.Utils.Timer();
- this.oBallSpeedUpTimer.Method = Library.Utils.Timer.TIMER_COUNT_DOWN;
- this.doAddListener(this.oBallSpeedUpTimer);
- this.oBallSpeedUpTimer.setTime(LevelDesignItem.nPOWERDOWN_ROCKET_TIME);
- this.oBallSpeedUpTimer.doStartTimer();
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Bonus_Catch_Rocket.mp3",100,1,true);
- break;
- case LevelDesignItem.nBONUS_TRAMPOLINE:
- Game.Instance.Status.onCatchBonus();
- this.oMainPaddle.onPaddleResize(PlayerPaddle.sPADDLE_STATE_LARGE);
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Bonus_Catch_Trampoline.mp3",100,1,true);
- break;
- case LevelDesignItem.nPOWERDOWN_JACKBOX:
- this.oMainPaddle.onPaddleResize(PlayerPaddle.sPADDLE_STATE_SHORT);
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Bonus_Catch_JackBox.mp3",100,1,true);
- break;
- case LevelDesignItem.nBONUS_CHEWINGGUM:
- Game.Instance.Status.onCatchBonus();
- this.oMainPaddle.onChewingGumCatch();
- this.oMainBall.onChewingGumCatch();
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Bonus_Catch_BubbleGum.mp3",100,1,true);
- break;
- case LevelDesignItem.nBONUS_MAGICWAND:
- Game.Instance.Status.onCatchBonus();
- this.oMainPaddle.onMagicWandCatch();
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Bonus_Catch_MagicWand.mp3",100,1,true);
- break;
- case LevelDesignItem.nPOWERDOWN_PING:
- this.doCreatePixies();
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Bonus_Catch_Ping.mp3",100,1,true);
- }
- if(this.nGameState == LevelManager.nGAME_STATE_WAIT_END_ITEMS_REMAIN)
- {
- this.doCheckLevelEnd();
- }
- }
- function onChewingGumEnd()
- {
- this.oMainBall.onChewingGumEnd();
- }
- function onBlockCrushed(_oBlock)
- {
- this.doDeleteBlock(_oBlock);
- this.doCheckLevelEnd();
- }
- function onBallLost(_oBall)
- {
- this.doDeleteBall(_oBall);
- _oBall.doDestroy();
- if(this.nGameState == LevelManager.nGAME_STATE_PLAYING)
- {
- if(_oBall == this.oMainBall)
- {
- Game.Instance.Status.onLoseLive();
- Library.Sound.SoundManager.doPlaySoundInCat(Main.sSOUND_CAT_SOUND,"Lose_Life.mp3");
- this.oMainPaddle.onChewingGumEnd();
- if(Game.Instance.Status.getPlayerCanContinue())
- {
- delete this.oMainBall;
- this.oMainPaddle.doGetBall();
- }
- else
- {
- this.nGameState = LevelManager.nGAME_STATE_END_LOSE_COUNTDOWN;
- this.nEndCountDown = LevelManager.nEND_COUNTDOWN;
- }
- }
- }
- }
- function getNewBall()
- {
- this.nBallNum = this.nBallNum + 1;
- var _loc2_ = this.GameStage.attachMovie(LevelManager.sLINKAGE_MAIN_BALL,"mcBall" + this.nBallNum,LevelManager.nBALL_DEPTH_START + this.nBallNum);
- this.oMainBall = new MainBall(_loc2_);
- if(this.bBallSpeedUp)
- {
- this.oMainBall.doAffectSpeed(LevelDesignItem.nPOWERDOWN_ROCKET_SPEED);
- }
- this.aBalls.push(this.oMainBall);
- return this.oMainBall;
- }
- function onLevelEnded()
- {
- this.nGameState = LevelManager.nGAME_STATE_END_EXPLOSION;
- this.bLevelEnded = true;
- this.nPreventiveEndDelay = 150;
- for(var _loc4_ in this.aBalls)
- {
- this.aEndLevelElements.push({oObj:this.aBalls[_loc4_],bExploded:false});
- this.aBalls[_loc4_].onLevelEnded();
- this.aBalls.splice(Number(_loc4_),1);
- }
- for(_loc4_ in this.aBlocks)
- {
- this.aEndLevelElements.push({oObj:this.aBlocks[_loc4_],bExploded:false});
- this.aBlocks[_loc4_].onLevelEnded();
- this.aBlocks.splice(Number(_loc4_),1);
- }
- this.bPaddleEndMoveComplete = false;
- this.oMainPaddle.onLevelEnded();
- this.oPixies.doHide();
- }
- function doPutInFront(_mc)
- {
- do
- {
- this.nNextFrontDepth = this.nNextFrontDepth + 1;
- if(this.nNextFrontDepth > LevelManager.nDEPTH_FRONT_MAX)
- {
- this.nNextFrontDepth = LevelManager.nDEPTH_FRONT_MIN;
- }
- }
- while(_mc._parent.getInstanceAtDepth(this.nNextFrontDepth) != undefined);
-
- _mc.swapDepths(this.nNextFrontDepth);
- }
- function doDestroy()
- {
- for(var _loc2_ in this.aBalls)
- {
- this.aBalls[_loc2_].doDestroy();
- this.aBalls.splice(Number(_loc2_),1);
- }
- for(_loc2_ in this.aBlocks)
- {
- this.aBlocks[_loc2_].doDestroy();
- this.aBlocks.splice(Number(_loc2_),1);
- }
- delete this.aBalls;
- delete this.aBlocks;
- delete LevelManager.oCtrl;
- this.oMainPaddle.doDestroy();
- delete this.oMainPaddle;
- this.oMainBall.doDestroy();
- delete this.oMainBall;
- this.oPixies.doDestroy();
- delete this.oPixies;
- Game.Instance.doRemoveListener(this);
- }
- function get GameStarted()
- {
- return this.nGameState == LevelManager.nGAME_STATE_PLAYING;
- }
- function get Blocks()
- {
- return Library.Utils.Tools.doCopyArray(this.aBlocks);
- }
- function get MainPaddle()
- {
- return this.oMainPaddle;
- }
- function get GameStage()
- {
- return this.mcRef;
- }
- function get RemoveDepth()
- {
- do
- {
- this.nNextRemoveDepth = this.nNextRemoveDepth + 1;
- if(this.nNextRemoveDepth > LevelManager.nDEPTH_REMOVE_MAX)
- {
- this.nNextRemoveDepth = LevelManager.nDEPTH_REMOVE_MIN;
- }
- }
- while(this.mcRef.getInstanceAtDepth(this.nNextRemoveDepth) != undefined);
-
- return this.nNextRemoveDepth;
- }
- function onDropDownComplete()
- {
- this.nGameState = LevelManager.nGAME_STATE_PLAYING;
- this.oMainPaddle.doGetBall();
- }
- function doLevelEndExplode()
- {
- if(this.aEndLevelElements.length > 0)
- {
- var _loc2_ = new Array();
- for(var _loc3_ in this.aEndLevelElements)
- {
- if(!this.aEndLevelElements[_loc3_].bExploded)
- {
- _loc2_.push(this.aEndLevelElements[_loc3_]);
- }
- }
- var _loc5_ = Library.Utils.MoreMath.getRandomRange(0,_loc2_.length - 1);
- var _loc4_ = _loc2_[_loc5_];
- if(_loc4_ != undefined)
- {
- _loc4_.oObj.doLevelEndedAnim();
- _loc4_.bExploded = true;
- }
- }
- }
- function doDropDownMotion()
- {
- if(this.aDropDownElements.length > 0)
- {
- var _loc3_ = new Array();
- var _loc2_ = -Infinity;
- for(var _loc4_ in this.aDropDownElements)
- {
- if(!this.aDropDownElements[_loc4_].bMoving)
- {
- if(this.aDropDownElements[_loc4_].oObj.Bounds.yMax > _loc2_)
- {
- _loc2_ = this.aDropDownElements[_loc4_].oObj.Bounds.yMax;
- }
- }
- }
- for(_loc4_ in this.aDropDownElements)
- {
- if(!this.aDropDownElements[_loc4_].bMoving)
- {
- if(Math.abs(this.aDropDownElements[_loc4_].oObj.Bounds.yMax - _loc2_) <= LevelManager.nDROPDOWN_LINE_BUFFER)
- {
- _loc3_.push(this.aDropDownElements[_loc4_]);
- }
- }
- }
- var _loc6_ = Library.Utils.MoreMath.getRandomRange(0,_loc3_.length - 1);
- var _loc5_ = _loc3_[_loc6_];
- if(_loc5_ != undefined)
- {
- _loc5_.oObj.onStartDropDownMove();
- _loc5_.bMoving = true;
- }
- else
- {
- this.bDropDownMotion = false;
- }
- }
- else
- {
- this.bDropDownMotion = false;
- }
- }
- function doCreatePixies()
- {
- this.oPixies.doShow();
- this.bPixiesVisible = true;
- this.oPixiesVisibleTimer = new Library.Utils.Timer();
- this.oPixiesVisibleTimer.Method = Library.Utils.Timer.TIMER_COUNT_DOWN;
- this.doAddListener(this.oPixiesVisibleTimer);
- this.oPixiesVisibleTimer.setTime(LevelDesignItem.nPOWERDOWN_PIXIES_TIME);
- this.oPixiesVisibleTimer.doStartTimer();
- }
- function doCheckLevelEnd()
- {
- var _loc2_ = true;
- for(var _loc3_ in this.aBlocks)
- {
- if(!this.aBlocks[_loc3_].NeverDies)
- {
- _loc2_ = false;
- }
- }
- if(_loc2_)
- {
- if(this.aItems.length <= 0)
- {
- this.nGameState = LevelManager.nGAME_STATE_END_WON_COUNTDOWN;
- this.nEndCountDown = LevelManager.nEND_COUNTDOWN;
- this.doNewEndingWord();
- }
- else
- {
- this.nGameState = LevelManager.nGAME_STATE_WAIT_END_ITEMS_REMAIN;
- }
- }
- }
- function doDeleteBlock(_oBlock)
- {
- for(var _loc2_ in this.aBlocks)
- {
- if(this.aBlocks[_loc2_] == _oBlock)
- {
- delete this.aBlocks[_loc2_];
- this.aBlocks.splice(Number(_loc2_),1);
- }
- }
- }
- function doDeleteBall(_oBall)
- {
- for(var _loc3_ in this.aBalls)
- {
- if(this.aBalls[_loc3_] == _oBall)
- {
- this.aBalls.splice(Number(_loc3_),1);
- }
- }
- }
- function doDeleteItem(_oItem)
- {
- for(var _loc3_ in this.aItems)
- {
- if(this.aItems[_loc3_] == _oItem)
- {
- delete this.aItems[_loc3_];
- this.aItems.splice(Number(_loc3_),1);
- }
- }
- }
- function doCheckActiveModifiers()
- {
- if(this.bBallSpeedUp)
- {
- if(this.oBallSpeedUpTimer.Time <= 0)
- {
- this.bBallSpeedUp = false;
- this.doRemoveListener(this.oBallSpeedUpTimer);
- delete this.oBallSpeedUpTimer;
- for(var _loc2_ in this.aBalls)
- {
- this.aBalls[_loc2_].doAffectSpeed(- LevelDesignItem.nPOWERDOWN_ROCKET_SPEED);
- }
- }
- }
- if(this.bPixiesVisible)
- {
- if(this.oPixiesVisibleTimer.Time <= 0)
- {
- this.bPixiesVisible = false;
- this.doRemoveListener(this.oPixiesVisibleTimer);
- delete this.oPixiesVisibleTimer;
- this.oPixies.doHide();
- }
- }
- }
- function onInitLevel()
- {
- this.nGameState = LevelManager.nGAME_STATE_DROP_DOWN_MOTION;
- var _loc2_ = this.GameStage.attachMovie("mcPaddle","mcPaddle",LevelManager.nMAIN_PADDLE_DEPTH);
- _loc2_._x = LevelManager.nMAIN_PADDLE_START_X;
- _loc2_._y = LevelManager.nMAIN_PADDLE_START_Y;
- this.oMainPaddle = new PlayerPaddle(_loc2_);
- this.aPaddles.push(this.oMainPaddle);
- var _loc4_ = this.mcRef.attachMovie("mcPixies_1","mcPixies_1",LevelManager.nPIXIES_DEPTH_START);
- var _loc3_ = this.mcRef.attachMovie("mcPixies_2","mcPixies_2",LevelManager.nPIXIES_DEPTH_START + 1);
- this.oPixies = new PixiesGroup(_loc4_,_loc3_);
- }
- }
-