Section 1
//wav (BubbleBump_02.wav)
package BubbleBump_02 {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package BubbleBump_02
Section 2
//wav (BubblePopping_02.wav)
package BubblePopping_02 {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package BubblePopping_02
Section 3
//wav (ButtonsClick_01.wav)
package ButtonsClick_01 {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package ButtonsClick_01
Section 4
//wav (ButtonsOver_01.wav)
package ButtonsOver_01 {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package ButtonsOver_01
Section 5
//wav (CollectibleBFF.wav)
package CollectibleBFF {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package CollectibleBFF
Section 6
//wav (CollectibleTaken.wav)
package CollectibleTaken {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package CollectibleTaken
Section 7
//AttachItem (collisions.basic_class.AttachItem)
package collisions.basic_class {
import flash.events.*;
import flash.display.*;
import library.basic.*;
public class AttachItem extends StateManaged {
protected var bActivatedItem:Boolean;
protected var bLiveAttachItem:Boolean;
protected var nPosX:Number;
protected var nPosY:Number;
protected var nScaleX:Number;
protected var aLinkages:Array;
protected var oLayer:DisplayObjectContainer;
protected var nScaleY:Number;
public function AttachItem(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1);
nScaleX = _arg7;
nScaleY = _arg8;
nPosX = _arg3;
nPosY = _arg4;
oLayer = _arg2;
aLinkages = _arg6;
attachItemMovie(_arg2, _arg5, aLinkages);
}
public function destroy(_arg1:Event=null):void{
if (aLinkages != null){
aLinkages.push(mcRef);
} else {
mcRef = null;
};
}
protected function attachItemMovie(_arg1:DisplayObjectContainer, _arg2:Class, _arg3:Array):void{
if (_arg3 != null){
if (_arg3.length > 0){
mcRef = _arg3.pop();
} else {
mcRef = new (_arg2);
};
} else {
mcRef = new (_arg2);
};
_arg1.addChild(mcRef);
mcRef.x = nPosX;
mcRef.y = nPosY;
mcRef.scaleX = nScaleX;
mcRef.scaleY = nScaleY;
if (mcRef.mcForm != null){
mcRef.mcForm.visible = false;
};
}
public function get PosX():Number{
return (nPosX);
}
public function get PosY():Number{
return (nPosY);
}
}
}//package collisions.basic_class
Section 8
//Character (collisions.basic_class.Character)
package collisions.basic_class {
import flash.display.*;
import gameplay.items.*;
import collisions.colliders.*;
import collisions.events.*;
public class Character extends AllSideBlocker {
protected var nSpdY:Number;
protected var nSpdX:Number;
public function Character(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array=null){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
nSpdX = 0;
nSpdY = 0;
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
oMovingItem = _arg3;
if ((oMovingItem is Character)){
doImpactResult();
} else {
if ((oMovingItem is Collectible)){
} else {
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
};
}
public function get SpeedY():Number{
return (nSpdY);
}
public function set SpeedY(_arg1:Number):void{
nSpdY = _arg1;
}
protected function applyMove():void{
while (((!((nMaxMoveX == 0))) || (!((nMaxMoveY == 0))))) {
dispatchEvent(new EventMoveRequest(EventMoveRequest.MOVEREQUEST, nRealMoveX, nRealMoveY, this));
nPosX = (nPosX + nRealMoveX);
nPosY = (nPosY + nRealMoveY);
checkLimits();
mcRef.x = nPosX;
mcRef.y = nPosY;
if (nMaxMoveX == nRealMoveX){
nMaxMoveX = 0;
} else {
if (nMaxMoveX != 0){
nMaxMoveX = (nMaxMoveX - nRealMoveX);
};
};
if (nMaxMoveY == nRealMoveY){
nMaxMoveY = 0;
} else {
if (nMaxMoveY != 0){
nMaxMoveY = (nMaxMoveY - nRealMoveY);
};
};
setHitBorders();
};
}
protected function checkLimits():void{
}
protected function setMaxMove():void{
nMaxMoveX = nSpdX;
nMaxMoveY = nSpdY;
nMaxMoveX = MathObj.roundNumber(nMaxMoveX);
nMaxMoveY = MathObj.roundNumber(nMaxMoveY);
nRealMoveX = nMaxMoveX;
nRealMoveY = nMaxMoveY;
}
public function setHitGround():void{
nSpdY = 0;
}
}
}//package collisions.basic_class
Section 9
//Enemy (collisions.basic_class.Enemy)
package collisions.basic_class {
import flash.events.*;
import flash.display.*;
import gameplay.*;
import gameplay.items.*;
import collisions.colliders.*;
import collisions.events.*;
import library.interfaces.*;
import library.events.*;
public class Enemy extends Character implements Idestroyable {
protected var bJumping:Boolean;
protected var sDirection:String;
protected var nBubbleTime:Number;
protected var bInBubble:Boolean;
protected var nMaxSpeedX:Number;
protected var nEndPointY:Number;
protected var bOnGround:Boolean;
public static const sSTATE_JUMP_SWITCH:String = "JumpSwitch";
public static const sSTATE_BUBBLE_IDLE:String = "BubbleIdle";
public static const sSTATE_WALK:String = "Walk";
public static const sSTATE_ANGRY_BUBBLE:String = "AngryBubble";
public static const sSTATE_RUN:String = "Run";
public static const sDIR_LEFT:String = "Left";
public static const sSTATE_IDLE:String = "Idle";
public static const sSTATE_APPEAR:String = "Appear";
public static const sDIR_RIGHT:String = "Right";
public static const sSTATE_HIT_BUBBLE:String = "HitBubble";
public static const nDOWN_HITZONE_MOD:Number = -21;
public static const sSTATE_START_WALK:String = "StartWalk";
public static const sSTATE_HIDDEN:String = "Hidden";
public static const sSTATE_LAND:String = "Land";
public static const sSTATE_JUMP:String = "Jump";
public static const sSTATE_BRAKE:String = "Brake";
public static const sSTATE_FALL:String = "Fall";
public static const sSTATE_OUT_BUBBLE:String = "OutBubble";
public static const sSTATE_DIE:String = "Die";
public static var nTIME_BUBBLE_IDLE:Number = 350;
public function Enemy(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
nEndPointY = _arg4;
nPosY = 0;
mcRef.y = nPosY;
nBubbleTime = 0;
nMaxSpeedX = Data.nENEMY_BASE_SPEED_X;
bJumping = false;
nSpdX = 0;
nSpdY = 0;
bOnGround = false;
sDirection = sDIR_RIGHT;
bInBubble = false;
addState(sSTATE_IDLE, state_Idle);
addState(sSTATE_APPEAR, state_Appear);
addState(sSTATE_START_WALK, state_StartWalk);
addState(sSTATE_WALK, state_Walk);
addState(sSTATE_RUN, state_Run);
addState(sSTATE_BRAKE, state_Brake, state_Brake_init);
addState(sSTATE_JUMP, state_Jump, state_Jump_init);
addState(sSTATE_JUMP_SWITCH, state_JumpSwitch);
addState(sSTATE_FALL, state_Fall, state_Fall_init);
addState(sSTATE_LAND, state_Land, state_Land_init);
addState(sSTATE_HIT_BUBBLE, state_HitBubble);
addState(sSTATE_BUBBLE_IDLE, state_BubbleIdle, state_BubbleIdle_init);
addState(sSTATE_ANGRY_BUBBLE, state_AngryBubble, state_AngryBubble_init);
addState(sSTATE_OUT_BUBBLE, state_OutBubble, state_OutBubble_init);
addState(sSTATE_DIE, state_Die, state_Die_init);
addState(sSTATE_HIDDEN, state_Hidden);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
setDir(sDIR_RIGHT);
changeDirection();
setState(sSTATE_HIDDEN);
}
override public function destroy(_arg1:Event=null):void{
super.destroy(_arg1);
mcRef.y = 0;
Main.instance.gameManager.removeEnemy(this);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
protected function checkFallHole():void{
if ((nPosY - mcRef.height) > Data.iSTAGE_HEIGHT){
nPosY = 0;
setMinSpeedX();
};
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
oMovingItem = _arg3;
if ((oMovingItem is Character)){
doImpactResult();
} else {
if ((oMovingItem is Collectible)){
} else {
if ((oMovingItem is Bubble)){
if (!bInBubble){
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
} else {
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
};
};
}
override public function resume(_arg1:Event=null):void{
super.resume();
if (mcState != null){
if (mcState.mcBubble != null){
mcState.mcBubble.play();
if (mcState.mcBubble.mcInside != null){
mcState.mcBubble.mcInside.play();
};
};
};
}
public function doAppear():void{
setState(sSTATE_APPEAR);
}
protected function state_Brake_init():void{
Main.instance.oSoundPlayer.stopEnemyRun();
Main.instance.oSoundPlayer.playEnemyBrake();
}
protected function applyAppearGravity():void{
applyGravity(false);
if (nPosY >= nEndPointY){
nSpdY = 0;
nPosY = nEndPointY;
mcRef.y = nPosY;
bOnGround = true;
bJumping = false;
setState(sSTATE_IDLE);
dispatchEvent(new EventMoveRequest(EventMoveRequest.ATTACHREQUEST, nRealMoveX, nRealMoveY, this));
if (Main.instance.gameManager.sGameStep == Game.sSTEP_STARTGAME){
Main.instance.gameManager.enemyReady();
};
};
}
protected function setLeftSpeed():void{
setSpeedX();
if (nSpdX == 0){
nSpdX = (-1 * Data.nENEMY_MIN_SPEED_X);
} else {
if (nSpdX > 0){
nSpdX = 0;
} else {
if (nSpdX < -(nMaxSpeedX)){
nSpdX = -(nMaxSpeedX);
} else {
if (nSpdX > -(nMaxSpeedX)){
if (bOnGround){
nSpdX = (nSpdX * Data.nENEMY_ACCEL_X);
} else {
nSpdX = -(nMaxSpeedX);
nSpdX = -(nMaxSpeedX);
};
if (nSpdX < -(nMaxSpeedX)){
nSpdX = -(nMaxSpeedX);
};
};
};
};
};
}
protected function state_Jump_init():void{
bOnGround = false;
bJumping = true;
nSpdY = Data.nENEMY_JUMP_SPEED;
}
protected function state_OutBubble_init():void{
Main.instance.oSoundPlayer.stopEnemyAngryBubble();
Main.instance.oSoundPlayer.playEnemyDie();
}
override protected function setMaxMove():void{
nMaxMoveX = nSpdX;
nMaxMoveY = nSpdY;
nMaxMoveX = MathObj.roundNumber(nMaxMoveX);
nMaxMoveY = MathObj.roundNumber(nMaxMoveY);
if (state == sSTATE_APPEAR){
if ((nPosY + nMaxMoveY) > nEndPointY){
nMaxMoveY = (nEndPointY - nPosY);
};
};
nRealMoveX = nMaxMoveX;
nRealMoveY = nMaxMoveY;
}
protected function checkBubbleIdleTime():void{
nBubbleTime--;
if (nBubbleTime <= 0){
nBubbleTime = 0;
setState(sSTATE_ANGRY_BUBBLE);
};
}
protected function state_Land_init():void{
Main.instance.oSoundPlayer.playEnemyLand();
}
protected function state_Fall():void{
}
protected function state_AngryBubble_init():void{
nBubbleTime = Data.nENEMY_ANGRY_BUBBLE_TIME;
}
protected function doFall():void{
if (((((!((state == sSTATE_HIT_BUBBLE))) && (!((state == sSTATE_BUBBLE_IDLE))))) && (!((state == sSTATE_ANGRY_BUBBLE))))){
setState(sSTATE_FALL);
};
}
protected function doStartFall():void{
if (((((!((state == sSTATE_HIT_BUBBLE))) && (!((state == sSTATE_BUBBLE_IDLE))))) && (!((state == sSTATE_ANGRY_BUBBLE))))){
setState(sSTATE_JUMP_SWITCH);
};
}
override protected function setHitBorders():void{
var _local1:Number;
_local1 = 0;
if ((((state == sSTATE_ANGRY_BUBBLE)) || ((state == sSTATE_BUBBLE_IDLE)))){
_local1 = nDOWN_HITZONE_MOD;
};
nRightHitBorder = (nPosX + nRightBorder);
nLeftHitBorder = (nPosX + nLeftBorder);
nDownHitBorder = ((nPosY + nDownBorder) + _local1);
nUpHitBorder = (nPosY + nUpBorder);
nRightHitBorder = MathObj.roundNumber(nRightHitBorder);
nLeftHitBorder = MathObj.roundNumber(nLeftHitBorder);
nDownHitBorder = MathObj.roundNumber(nDownHitBorder);
nUpHitBorder = MathObj.roundNumber(nUpHitBorder);
}
public function startWalking():void{
setState(sSTATE_START_WALK);
}
public function reverseDirection(_arg1:String=""):void{
if ((((sDirection == _arg1)) || ((_arg1 == "")))){
if (bOnGround){
changeDirection();
};
};
}
override public function update(_arg1:Event=null):void{
if (state == sSTATE_APPEAR){
applyAppearGravity();
doMove();
} else {
if (((((((((((!((state == sSTATE_HIDDEN))) && (!((state == sSTATE_HIT_BUBBLE))))) && (!((state == sSTATE_BUBBLE_IDLE))))) && (!((state == sSTATE_ANGRY_BUBBLE))))) && (!((state == sSTATE_OUT_BUBBLE))))) && (!((state == sSTATE_DIE))))){
applyGravity();
if (((((!((state == sSTATE_IDLE))) && (!(bInBubble)))) && (!((state == sSTATE_BRAKE))))){
applySpeedX();
};
doMove();
checkFallHole();
checkPursuit();
} else {
if ((((state == sSTATE_BUBBLE_IDLE)) || ((state == sSTATE_ANGRY_BUBBLE)))){
applyFloatSpeed();
doMove();
};
};
};
super.update();
}
public function killEnemy():void{
if (state != sSTATE_DIE){
setState(sSTATE_DIE);
Main.instance.gameManager.getScoreManager.addPoints(Data.nPOINTS_ENEMY_BUBBLE);
};
}
protected function state_AngryBubble():void{
checkAngryBubbleTime();
Main.instance.oSoundPlayer.playEnemyAngryBubble();
}
override public function setHitGround():void{
if (((!((state == sSTATE_APPEAR))) && (!((state == sSTATE_HIT_BUBBLE))))){
nSpdY = 0;
bOnGround = true;
bInBubble = false;
bJumping = false;
if ((((((state == sSTATE_JUMP)) || ((state == sSTATE_JUMP_SWITCH)))) || ((state == sSTATE_FALL)))){
if (state != sSTATE_HIDDEN){
setState(sSTATE_LAND);
};
};
};
}
protected function slowDownXSpeed():void{
nSpdX = 0;
}
protected function state_Walk():void{
}
protected function setDir(_arg1:String):void{
sDirection = _arg1;
}
protected function state_Idle():void{
Main.instance.oSoundPlayer.playEnemyIdle();
}
protected function state_Land():void{
if (stateComplete){
setState(sSTATE_WALK);
};
}
protected function doMove():void{
setMaxMove();
applyMove();
}
protected function state_StartWalk():void{
Main.instance.oSoundPlayer.stopEnemyIdle();
if (stateComplete){
setState(sSTATE_WALK);
};
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
oMovingItem = _arg3;
if ((oMovingItem is Bubble)){
doImpactResult();
} else {
if ((oMovingItem is Player)){
(oMovingItem as Player).hurtPlayer();
};
};
}
protected function applyGravity(_arg1:Boolean=true):void{
if (_arg1){
if (bOnGround == false){
if ((((nSpdY > 0)) && ((((((((state == sSTATE_IDLE)) || ((state == sSTATE_WALK)))) || ((state == sSTATE_RUN)))) || ((state == sSTATE_BRAKE)))))){
doFall();
} else {
if ((((((nSpdY > 0)) && (!((state == sSTATE_JUMP_SWITCH))))) && (!((state == sSTATE_FALL))))){
doStartFall();
} else {
if ((((((((nSpdY == Data.nENEMY_MAX_SPEED_Y)) && (!((state == sSTATE_JUMP))))) && (!((state == sSTATE_JUMP_SWITCH))))) && (!((state == sSTATE_FALL))))){
doFall();
};
};
};
};
};
if (nSpdY > 0){
bOnGround = false;
};
if (nSpdY == 0){
if ((((((state == sSTATE_JUMP)) || ((state == sSTATE_JUMP_SWITCH)))) || ((state == sSTATE_FALL)))){
nSpdY = Data.nENEMY_MIN_SPEED_Y;
} else {
nSpdY = Data.nENEMY_MIN_FALL_SPEED_Y;
};
} else {
if (nSpdY < 0){
nSpdY = (nSpdY / Data.nENEMY_DECEL_Y);
if (Math.abs(nSpdY) < Data.nENEMY_MIN_SPEED_Y){
nSpdY = 0;
};
} else {
if (nSpdY < Data.nENEMY_MAX_SPEED_Y){
nSpdY = (nSpdY * Data.nENEMY_ACCEL_Y);
if (nSpdY > Data.nENEMY_MAX_SPEED_Y){
nSpdY = Data.nENEMY_MAX_SPEED_Y;
};
};
};
};
}
protected function state_Fall_init():void{
Main.instance.oSoundPlayer.stopEnemyRun();
}
protected function state_BubbleIdle():void{
checkBubbleIdleTime();
}
public function getBubbled():void{
if (((((!(bInBubble)) && (!((state == sSTATE_APPEAR))))) && (!((state == sSTATE_IDLE))))){
Main.instance.oSoundPlayer.playEnemyGetBubbled();
nSpdX = 0;
nSpdY = 0;
bInBubble = true;
setState(sSTATE_HIT_BUBBLE);
};
}
protected function state_Appear():void{
}
protected function state_OutBubble():void{
if (stateComplete){
setState(sSTATE_FALL);
};
}
override public function doImpactResult():void{
if ((oMovingItem is Bubble)){
if (((!(bInBubble)) || ((sImpactSide == sIMPACT_DOWN)))){
if (oMovingItem.state == Bubble.sSTATE_FLOATING){
(oMovingItem as Bubble).popBubble();
} else {
if (oMovingItem.state == Bubble.sSTATE_ATTACK){
(oMovingItem as Bubble).destroy();
getBubbled();
};
};
};
} else {
if ((oMovingItem is Player)){
if ((((((state == sSTATE_BUBBLE_IDLE)) || ((state == sSTATE_HIT_BUBBLE)))) || ((state == sSTATE_ANGRY_BUBBLE)))){
killEnemy();
} else {
if (((((!((state == sSTATE_APPEAR))) && (!((state == sSTATE_DIE))))) && (!((state == sSTATE_HIDDEN))))){
if ((oMovingItem as Player).state == Player.sSTATE_ATTACK){
getBubbled();
(oMovingItem as Player).setState(Player.sSTATE_IDLE);
} else {
(oMovingItem as Player).hurtPlayer();
};
};
};
};
};
}
public function makeJump(_arg1:String=""):void{
if (bOnGround){
if ((((_arg1 == "")) || ((_arg1 == sDirection)))){
if (state != sSTATE_JUMP){
setState(sSTATE_JUMP);
};
};
};
}
protected function state_Hidden():void{
}
protected function state_Jump():void{
}
public function get Bubbled():Boolean{
return (bInBubble);
}
protected function applyFloatSpeed():void{
if (nSpdY == 0){
nSpdY = Data.nENEMY_FLOAT_MIN_SPEED_Y;
} else {
nSpdY = (nSpdY * Data.nENEMY_FLOAT_ACCEL_Y);
};
if (nSpdY < Data.nENEMY_FLOAT_MAX_SPEED_Y){
nSpdY = Data.nENEMY_FLOAT_MAX_SPEED_Y;
};
}
protected function checkPursuit():void{
}
protected function state_Die_init():void{
Main.instance.gameManager.getCollectibleManager.addCollectible(CollectibleManager.sTYPE_COMB, nPosX, nPosY);
}
protected function setRightSpeed():void{
setSpeedX();
if (nSpdX == 0){
nSpdX = Data.nENEMY_MIN_SPEED_X;
} else {
if (nSpdX < 0){
nSpdX = 0;
} else {
if (nSpdX > nMaxSpeedX){
nSpdX = nMaxSpeedX;
} else {
if (nSpdX < nMaxSpeedX){
if (bOnGround){
nSpdX = (nSpdX * Data.nENEMY_ACCEL_X);
} else {
nSpdX = nMaxSpeedX;
};
if (nSpdX > nMaxSpeedX){
nSpdX = nMaxSpeedX;
};
};
};
};
};
}
protected function state_JumpSwitch():void{
if (stateComplete){
setState(sSTATE_FALL);
};
}
protected function setMinSpeedX():void{
if (nSpdX == 0){
if (sDirection == sDIR_RIGHT){
nSpdX = Data.nENEMY_MIN_SPEED_X;
} else {
nSpdX = (-1 * Data.nENEMY_MIN_SPEED_X);
};
};
}
protected function state_BubbleIdle_init():void{
nBubbleTime = nTIME_BUBBLE_IDLE;
dispatchEvent(new EventMoveRequest(EventMoveRequest.ATTACHREQUEST, nRealMoveX, nRealMoveY, this));
}
protected function changeDirection():void{
if (sDirection == sDIR_RIGHT){
sDirection = sDIR_LEFT;
} else {
sDirection = sDIR_RIGHT;
};
mcRef.scaleX = (-1 * mcRef.scaleX);
}
protected function state_HitBubble():void{
if (stateComplete){
setState(sSTATE_BUBBLE_IDLE);
};
}
protected function state_Die():void{
if (stateComplete){
setState(sSTATE_HIDDEN);
destroy();
};
}
protected function state_Run():void{
Main.instance.oSoundPlayer.playEnemyRun();
}
protected function checkAngryBubbleTime():void{
nBubbleTime--;
if (nBubbleTime <= 0){
nBubbleTime = 0;
setState(sSTATE_OUT_BUBBLE);
};
}
protected function state_Brake():void{
if (stateComplete){
setState(sSTATE_WALK);
};
}
protected function setSpeedX():void{
if (bJumping){
nMaxSpeedX = Data.nENEMY_JUMP_SPEED_X;
} else {
nMaxSpeedX = Data.nENEMY_BASE_SPEED_X;
};
}
override public function pause(_arg1:Event=null):void{
super.pause();
if (mcState != null){
if (mcState.mcBubble != null){
mcState.mcBubble.stop();
if (mcState.mcBubble.mcInside != null){
mcState.mcBubble.mcInside.stop();
};
};
};
}
protected function applySpeedX():void{
if (sDirection == sDIR_RIGHT){
if (state == sSTATE_IDLE){
setState(sSTATE_WALK);
} else {
setRightSpeed();
};
} else {
if (sDirection == sDIR_LEFT){
if (state == sSTATE_IDLE){
setState(sSTATE_WALK);
} else {
setLeftSpeed();
};
};
};
}
}
}//package collisions.basic_class
Section 10
//MathObj (collisions.basic_class.MathObj)
package collisions.basic_class {
public class MathObj {
public static function roundNumber(_arg1:Number):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = (_arg1 * 10);
_local3 = int(_local2);
_local4 = (_local2 - _local3);
_local5 = (_local2 - _local4);
_local5 = (_local5 / 10);
return (_local5);
}
}
}//package collisions.basic_class
Section 11
//Projectile (collisions.basic_class.Projectile)
package collisions.basic_class {
import flash.display.*;
import collisions.colliders.*;
import collisions.events.*;
public class Projectile extends AllSideBlocker {
protected var nSpdY:Number;
protected var nSpdX:Number;
public function Projectile(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
nSpdX = 0;
nSpdY = 0;
}
protected function applyMove():void{
while (((!((nMaxMoveX == 0))) || (!((nMaxMoveY == 0))))) {
dispatchEvent(new EventMoveRequest(EventMoveRequest.MOVEREQUEST, nRealMoveX, nRealMoveY, this));
nPosX = (nPosX + nRealMoveX);
nPosY = (nPosY + nRealMoveY);
checkLimits();
mcRef.x = nPosX;
mcRef.y = nPosY;
if (nMaxMoveX == nRealMoveX){
nMaxMoveX = 0;
} else {
if (nMaxMoveX != 0){
nMaxMoveX = (nMaxMoveX - nRealMoveX);
};
};
if (nMaxMoveY == nRealMoveY){
nMaxMoveY = 0;
} else {
if (nMaxMoveY != 0){
nMaxMoveY = (nMaxMoveY - nRealMoveY);
};
};
nMaxMoveX = MathObj.roundNumber(nMaxMoveX);
nMaxMoveY = MathObj.roundNumber(nMaxMoveY);
nRealMoveX = nMaxMoveX;
nRealMoveY = nMaxMoveY;
setHitBorders();
};
}
protected function checkLimits():void{
}
protected function setMaxMove():void{
nMaxMoveX = nSpdX;
nMaxMoveY = nSpdY;
nMaxMoveX = MathObj.roundNumber(nMaxMoveX);
nMaxMoveY = MathObj.roundNumber(nMaxMoveY);
nRealMoveX = nMaxMoveX;
nRealMoveY = nMaxMoveY;
}
}
}//package collisions.basic_class
Section 12
//ActivatedItem (collisions.colliders.ActivatedItem)
package collisions.colliders {
import flash.events.*;
import flash.display.*;
import collisions.basic_class.*;
public class ActivatedItem extends AttachItem {
protected var bActive:Boolean;
protected var bDeactivateVertical:Boolean;
protected var nMinBoundX:Number;
protected var nDistRightSide:Number;
protected var nMinBoundY:Number;
protected var nDistLeftSide:Number;
protected var bAnimatedItem:Boolean;
protected var bDestroyOnceInactive:Boolean;
protected var nDistUpSide:Number;
protected var nDistDownSide:Number;
public function ActivatedItem(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActive = false;
bDeactivateVertical = true;
bDestroyOnceInactive = false;
if (bActivatedItem){
};
}
public function setActive(_arg1:Boolean):void{
bActive = _arg1;
}
public function setDestroyable(_arg1:Boolean):void{
bDestroyOnceInactive = _arg1;
}
protected function checkDeactivate():void{
var _local1:Number;
var _local2:Number;
if (bActive){
if (bAnimatedItem == true){
setBounds();
};
_local1 = (nPosX + oLayer.parent.x);
_local2 = (nPosY + oLayer.parent.y);
if ((((_local1 <= (-1 * Data.nZONE_DEACTIVATE))) || ((_local1 >= (Data.iSTAGE_WIDTH + Data.nZONE_DEACTIVATE))))){
deactivateItem();
} else {
if ((((_local2 < 0)) && (bDeactivateVertical))){
deactivateItem();
} else {
if ((((_local2 > Data.iSTAGE_HEIGHT)) && (bDeactivateVertical))){
deactivateItem();
};
};
};
};
}
protected function deactivateItem():void{
oLayer.removeChild(mcRef);
if (bDestroyOnceInactive){
destroy();
};
}
protected function checkActivate():void{
}
protected function activateItem():void{
}
protected function setBounds():void{
}
override public function update(_arg1:Event=null):void{
super.update();
if (bActivatedItem){
checkDeactivate();
};
}
override public function destroy(_arg1:Event=null):void{
mcRef.removeEventListener(Event.ADDED, onAdded, false);
super.destroy(_arg1);
}
}
}//package collisions.colliders
Section 13
//AllSideBlocker (collisions.colliders.AllSideBlocker)
package collisions.colliders {
import flash.display.*;
import collisions.events.*;
public class AllSideBlocker extends ColliderItem {
public function AllSideBlocker(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
oMovingItem = _arg3;
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
}
}
}//package collisions.colliders
Section 14
//BottomBlocker (collisions.colliders.BottomBlocker)
package collisions.colliders {
import flash.display.*;
import collisions.events.*;
public class BottomBlocker extends ColliderItem {
public function BottomBlocker(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if (sImpactSide == sIMPACT_DOWN){
oMovingItem = _arg3;
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
}
}
}//package collisions.colliders
Section 15
//ColliderItem (collisions.colliders.ColliderItem)
package collisions.colliders {
import flash.events.*;
import flash.display.*;
import collisions.events.*;
import collisions.basic_class.*;
public class ColliderItem extends ActivatedItem implements IEventDispatcher {
protected var nRightBorder:Number;
protected var nLeftBorder:Number;
protected var nMaxMoveX:Number;
protected var nMaxMoveY:Number;
protected var nUpBorder:Number;
protected var nImpactXDistSq:Number;
protected var nImpactXDist:Number;
protected var bInReachX:Boolean;
protected var bInReachY:Boolean;
protected var oMovingItem:ColliderItem;
protected var nDownHitBorder:Number;
protected var nAllowedMoveY:Number;
protected var nAllowedMoveX:Number;
protected var nDownBorder:Number;
protected var nImpactYDistSq:Number;
protected var nLeftHitBorder:Number;
protected var sImpactSide:String;
private var oEventDisp:EventDispatcher;
protected var nImpactYDist:Number;
protected var nRealMoveX:Number;
protected var nRealMoveY:Number;
protected var nRightHitBorder:Number;
protected var nUpHitBorder:Number;
public static var sIMPACT_UP:String = "Up";
public static var sIMPACT_RIGHT:String = "Right";
public static var sIMPACT_DOWN:String = "Down";
public static var sIMPACT_LEFT:String = "Left";
public function ColliderItem(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
oEventDisp = new EventDispatcher(this);
setHitBorders();
bInReachX = false;
bInReachY = false;
sImpactSide = "";
}
public function get AllowedMoveY():Number{
return (nAllowedMoveY);
}
public function get RightHitBorder():Number{
return (nRightHitBorder);
}
public function get DownHitBorder():Number{
return (nDownHitBorder);
}
public function get ImpactXDistSq():Number{
return (nImpactXDistSq);
}
protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
}
public function onValidate(_arg1:EventValidate):void{
var _local2:Boolean;
_local2 = false;
sImpactSide = "";
if (_arg1.oMoving != this){
_local2 = checkInReach(_arg1.nMaxMoveX, _arg1.nMaxMoveY, _arg1.oMoving);
if (_local2){
checkIfCanBeHit(_arg1.nMaxMoveX, _arg1.nMaxMoveY, _arg1.oMoving);
};
};
}
override protected function attachItemMovie(_arg1:DisplayObjectContainer, _arg2:Class, _arg3:Array):void{
super.attachItemMovie(_arg1, _arg2, _arg3);
setAsCollider();
setHitBorders();
}
protected function checkIfInstantHit(_arg1:ColliderItem):Boolean{
var _local2:Boolean;
_local2 = false;
if ((((((((_arg1.RightHitBorder >= nLeftHitBorder)) && ((_arg1.LeftHitBorder <= nRightHitBorder)))) && ((_arg1.DownHitBorder >= nUpHitBorder)))) && ((_arg1.UpHitBorder <= nDownHitBorder)))){
_local2 = true;
};
return (_local2);
}
public function get UpHitBorder():Number{
return (nUpHitBorder);
}
public function applyNewMaxMoves(_arg1:Number, _arg2:Number):void{
nMaxMoveX = _arg1;
nMaxMoveY = _arg2;
nRealMoveX = nMaxMoveX;
nRealMoveY = nMaxMoveY;
}
public function get ImpactYDistSq():Number{
return (nImpactYDistSq);
}
public function get LeftHitBorder():Number{
return (nLeftHitBorder);
}
public function doImpactResult():void{
}
protected function checkInReach(_arg1:Number, _arg2:Number, _arg3:ColliderItem):Boolean{
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
setHitBorders();
_local4 = false;
bInReachX = false;
bInReachY = false;
nImpactXDist = 0;
nImpactYDist = 0;
nImpactXDistSq = 0;
nImpactYDistSq = 0;
nAllowedMoveX = 0;
nAllowedMoveY = 0;
if (_arg1 > 0){
_local5 = (_arg1 + _arg3.RightHitBorder);
_local6 = _arg3.RightHitBorder;
} else {
if (_arg1 < 0){
_local5 = _arg3.LeftHitBorder;
_local6 = (_arg1 + _arg3.LeftHitBorder);
} else {
_local5 = _arg3.RightHitBorder;
_local6 = _arg3.LeftHitBorder;
};
};
if (_arg2 > 0){
_local8 = (_arg2 + _arg3.DownHitBorder);
_local7 = _arg3.DownHitBorder;
} else {
if (_arg2 < 0){
_local8 = _arg3.UpHitBorder;
_local7 = (_arg2 + _arg3.UpHitBorder);
} else {
_local8 = _arg3.DownHitBorder;
_local7 = _arg3.UpHitBorder;
};
};
_local5 = MathObj.roundNumber(_local5);
_local6 = MathObj.roundNumber(_local6);
_local8 = MathObj.roundNumber(_local8);
_local7 = MathObj.roundNumber(_local7);
if (_arg1 > 0){
if ((((nLeftHitBorder >= _local6)) && ((nLeftHitBorder <= _local5)))){
bInReachX = true;
_local4 = true;
};
} else {
if (_arg1 < 0){
if ((((nRightHitBorder <= _local5)) && ((nRightHitBorder >= _local6)))){
bInReachX = true;
_local4 = true;
};
};
};
if (_arg2 > 0){
if ((((nUpHitBorder >= _local7)) && ((nUpHitBorder <= _local8)))){
bInReachY = true;
_local4 = true;
};
} else {
if (_arg2 < 0){
if ((((nDownHitBorder <= _local8)) && ((nDownHitBorder >= _local7)))){
bInReachY = true;
_local4 = true;
};
};
};
return (_local4);
}
public function dispatchEvent(_arg1:Event):Boolean{
return (oEventDisp.dispatchEvent(_arg1));
}
public function onValidateInstant(_arg1:EventValidate):void{
var _local2:Boolean;
_local2 = false;
sImpactSide = "";
if (_arg1.oMoving != this){
_local2 = checkIfInstantHit(_arg1.oMoving);
if (_local2){
resolveInstantHit(_arg1.nMaxMoveX, _arg1.nMaxMoveY, _arg1.oMoving);
};
};
}
public function get LeftBorder():Number{
return (nLeftBorder);
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
oEventDisp.removeEventListener(_arg1, _arg2, _arg3);
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
oEventDisp.addEventListener(_arg1, _arg2, _arg3, _arg4);
}
protected function setAsCollider():void{
nUpBorder = (mcRef.mcRightUpBorder.y * nScaleY);
nRightBorder = (mcRef.mcRightUpBorder.x * nScaleX);
nDownBorder = (mcRef.mcLeftDownBorder.y * nScaleY);
nLeftBorder = (mcRef.mcLeftDownBorder.x * nScaleX);
nUpBorder = MathObj.roundNumber(nUpBorder);
nRightBorder = MathObj.roundNumber(nRightBorder);
nDownBorder = MathObj.roundNumber(nDownBorder);
nLeftBorder = MathObj.roundNumber(nLeftBorder);
mcRef.mcLeftDownBorder.visible = false;
mcRef.mcRightUpBorder.visible = false;
}
protected function normaliseImpactDist(_arg1:Number):Number{
var _local2:Number;
var _local3:Number;
_local2 = _arg1;
_local3 = 1;
if (_local2 != 0){
if (_local2 > 0){
_local2 = (_local2 - _local3);
if (_local2 < 0){
_local2 = 0;
};
} else {
if (_local2 < 0){
_local2 = (_local2 + _local3);
if (_local2 > 0){
_local2 = 0;
};
};
};
};
return (_local2);
}
public function get RightBorder():Number{
return (nRightBorder);
}
public function get ImpactXDist():Number{
return (nImpactXDist);
}
protected function resolveHitAfterMove(_arg1:Object, _arg2:Object):void{
}
public function willTrigger(_arg1:String):Boolean{
return (oEventDisp.willTrigger(_arg1));
}
public function get DownBorder():Number{
return (nDownBorder);
}
protected function setHitBorders():void{
nRightHitBorder = (nPosX + nRightBorder);
nLeftHitBorder = (nPosX + nLeftBorder);
nDownHitBorder = (nPosY + nDownBorder);
nUpHitBorder = (nPosY + nUpBorder);
nRightHitBorder = MathObj.roundNumber(nRightHitBorder);
nLeftHitBorder = MathObj.roundNumber(nLeftHitBorder);
nDownHitBorder = MathObj.roundNumber(nDownHitBorder);
nUpHitBorder = MathObj.roundNumber(nUpHitBorder);
}
protected function checkIfCanBeHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
var _local4:Boolean;
var _local5:Boolean;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:String;
var _local11:String;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:String;
_local4 = false;
_local5 = false;
_local6 = 0;
_local7 = 0;
_local12 = 0;
_local13 = 0;
if (((bInReachX) && (!((_arg1 == 0))))){
if (_arg1 > 0){
_local6 = (nLeftHitBorder - _arg3.RightHitBorder);
_local6 = MathObj.roundNumber(_local6);
_local10 = sIMPACT_LEFT;
if (_local6 < 0){
_local6 = 0;
};
} else {
if (_arg1 < 0){
_local6 = (nRightHitBorder - _arg3.LeftHitBorder);
_local6 = MathObj.roundNumber(_local6);
_local10 = sIMPACT_RIGHT;
if (_local6 > 0){
_local6 = 0;
};
};
};
_local8 = (_local6 / _arg1);
if (_local8 < 0){
_local8 = 0;
};
_local13 = (_local8 * _arg2);
if (_local6 != 0){
_local7 = _local13;
} else {
_local7 = _arg2;
};
_local14 = (_arg3.PosX + _local6);
_local14 = MathObj.roundNumber(_local14);
_local15 = (_arg3.PosY + _local13);
_local15 = MathObj.roundNumber(_local15);
if (((((_local15 + _arg3.DownBorder) >= nUpHitBorder)) && (((_local15 + _arg3.UpBorder) <= nDownHitBorder)))){
_local4 = true;
};
if (_local6 == 0){
_local7 = 0;
};
};
if (((bInReachY) && (!((_arg2 == 0))))){
if (_arg2 > 0){
_local7 = (nUpHitBorder - _arg3.DownHitBorder);
_local7 = MathObj.roundNumber(_local7);
_local11 = sIMPACT_UP;
if (_local7 < 0){
_local7 = 0;
};
} else {
if (_arg2 < 0){
_local7 = (nDownHitBorder - _arg3.UpHitBorder);
_local7 = MathObj.roundNumber(_local7);
_local11 = sIMPACT_DOWN;
if (_local7 > 0){
_local7 = 0;
};
};
};
_local9 = (_local7 / _arg2);
if (_local9 < 0){
_local9 = 0;
};
_local12 = (_local9 * _arg1);
if (_local7 != 0){
_local6 = _local12;
} else {
_local6 = _arg1;
};
_local16 = (_arg3.PosY + _local7);
_local16 = MathObj.roundNumber(_local16);
_local17 = (_arg3.PosX + _local12);
_local17 = MathObj.roundNumber(_local17);
if (((((_local17 + _arg3.RightBorder) >= nLeftHitBorder)) && (((_local17 + _arg3.LeftBorder) <= nRightHitBorder)))){
_local5 = true;
};
if (_local7 == 0){
_local6 = 0;
};
};
if (((_local4) || (_local5))){
_local18 = "";
if (((_local4) && (_local5))){
if (_local7 < _local6){
_local7 = normaliseImpactDist(_local7);
nAllowedMoveY = _local7;
nAllowedMoveX = _arg1;
sImpactSide = _local11;
} else {
if (_local7 > _local6){
_local6 = normaliseImpactDist(_local6);
nAllowedMoveX = _local6;
nAllowedMoveY = _arg2;
sImpactSide = _local10;
} else {
if ((Math.random() * 100) < 50){
_local6 = normaliseImpactDist(_local6);
nAllowedMoveX = _local6;
nAllowedMoveY = _arg2;
sImpactSide = _local10;
} else {
_local7 = normaliseImpactDist(_local7);
nAllowedMoveY = _local7;
nAllowedMoveX = _arg1;
sImpactSide = _local11;
};
};
};
} else {
if (_local4){
_local6 = normaliseImpactDist(_local6);
nAllowedMoveX = _local6;
nAllowedMoveY = _arg2;
sImpactSide = _local10;
} else {
_local7 = normaliseImpactDist(_local7);
nAllowedMoveY = _local7;
nAllowedMoveX = _arg1;
sImpactSide = _local11;
};
};
nImpactXDist = _local6;
nImpactYDist = _local7;
if (_local6 != nImpactXDist){
nImpactXDistSq = (_local6 * _local6);
};
if (_local7 != nImpactYDist){
nImpactYDistSq = (_local7 * _local7);
};
resolveHit(_local6, _local7, _arg3);
};
}
public function get UpBorder():Number{
return (nUpBorder);
}
public function get ImpactSide():String{
return (sImpactSide);
}
public function hasEventListener(_arg1:String):Boolean{
return (oEventDisp.hasEventListener(_arg1));
}
public function get ImpactYDist():Number{
return (nImpactYDist);
}
override public function destroy(_arg1:Event=null):void{
Main.instance.gameManager.getCollisionManager.removeObject(this);
super.destroy();
}
protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
}
public function get AllowedMoveX():Number{
return (nAllowedMoveX);
}
}
}//package collisions.colliders
Section 16
//LeftBlocker (collisions.colliders.LeftBlocker)
package collisions.colliders {
import flash.display.*;
import collisions.events.*;
public class LeftBlocker extends ColliderItem {
public function LeftBlocker(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if (sImpactSide == sIMPACT_LEFT){
oMovingItem = _arg3;
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
}
override public function doImpactResult():void{
if (sImpactSide == sIMPACT_LEFT){
};
}
}
}//package collisions.colliders
Section 17
//NoBlockerCollider (collisions.colliders.NoBlockerCollider)
package collisions.colliders {
import flash.display.*;
public class NoBlockerCollider extends ColliderItem {
public function NoBlockerCollider(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
oMovingItem = _arg3;
doImpactResult();
}
override public function applyNewMaxMoves(_arg1:Number, _arg2:Number):void{
}
protected function checkInReachAfterMove(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Boolean{
var _local6:Boolean;
_local6 = false;
return (_local6);
}
override protected function resolveHitAfterMove(_arg1:Object, _arg2:Object):void{
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
resolveHit(_arg1, _arg2, _arg3);
}
}
}//package collisions.colliders
Section 18
//RightBlocker (collisions.colliders.RightBlocker)
package collisions.colliders {
import flash.display.*;
import collisions.events.*;
public class RightBlocker extends ColliderItem {
public function RightBlocker(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if (sImpactSide == sIMPACT_RIGHT){
oMovingItem = _arg3;
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
}
override public function doImpactResult():void{
if (sImpactSide == sIMPACT_RIGHT){
};
}
}
}//package collisions.colliders
Section 19
//TopBlocker (collisions.colliders.TopBlocker)
package collisions.colliders {
import flash.display.*;
import collisions.events.*;
import collisions.basic_class.*;
public class TopBlocker extends ColliderItem {
public function TopBlocker(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if (sImpactSide == sIMPACT_UP){
oMovingItem = _arg3;
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
}
override public function doImpactResult():void{
if ((oMovingItem is Character)){
(oMovingItem as Character).setHitGround();
};
}
}
}//package collisions.colliders
Section 20
//EventHit (collisions.events.EventHit)
package collisions.events {
import flash.events.*;
import collisions.colliders.*;
public class EventHit extends Event {
public var sImpactSide:String;
public var oObstacle:ColliderItem;
public var nMaxMoveX:Number;
public var nMaxMoveY:Number;
public static var HIT:String = "hit";
public function EventHit(_arg1:String, _arg2:Number, _arg3:Number, _arg4:ColliderItem, _arg5:String){
super(_arg1);
nMaxMoveX = _arg2;
nMaxMoveY = _arg3;
oObstacle = _arg4;
sImpactSide = _arg5;
}
override public function toString():String{
return ((((((((((((super.toString() + " [Event type=\"") + type) + "\" MaxX=\"") + nMaxMoveX) + "\" MaxY=\"") + nMaxMoveY) + "\" oObstacle=\"") + oObstacle) + "\" sImpactSide=\"") + sImpactSide) + "\"]"));
}
}
}//package collisions.events
Section 21
//EventMoveRequest (collisions.events.EventMoveRequest)
package collisions.events {
import flash.events.*;
import collisions.colliders.*;
public class EventMoveRequest extends Event {
public var nMaxMoveY:Number;
public var oMoving:ColliderItem;
public var nMaxMoveX:Number;
public static var ATTACHREQUEST:String = "requestAttach";
public static var MOVEREQUEST:String = "requestMove";
public function EventMoveRequest(_arg1:String, _arg2:Number, _arg3:Number, _arg4:ColliderItem){
super(_arg1);
nMaxMoveX = _arg2;
nMaxMoveY = _arg3;
oMoving = _arg4;
}
override public function toString():String{
return ((((((((((super.toString() + " [Event type=\"") + type) + "\" MaxX=\"") + nMaxMoveX) + "\" MaxY=\"") + nMaxMoveY) + "\" oMoving=\"") + oMoving) + "\"]"));
}
}
}//package collisions.events
Section 22
//EventValidate (collisions.events.EventValidate)
package collisions.events {
import flash.events.*;
import collisions.colliders.*;
public class EventValidate extends Event {
public var nMaxMoveY:Number;
public var oMoving:ColliderItem;
public var nMaxMoveX:Number;
public static var VALIDATEINSTANT:String = "validateInstantHit";
public static var VALIDATEMOVE:String = "validateMove";
public function EventValidate(_arg1:String, _arg2:Number, _arg3:Number, _arg4:ColliderItem){
super(_arg1);
nMaxMoveX = _arg2;
nMaxMoveY = _arg3;
oMoving = _arg4;
}
override public function toString():String{
return ((((((((((super.toString() + " [Event type=\"") + type) + "\" MaxX=\"") + nMaxMoveX) + "\" MaxY=\"") + nMaxMoveY) + "\" oMoving=\"") + oMoving) + "\"]"));
}
}
}//package collisions.events
Section 23
//CollisionManager (collisions.CollisionManager)
package collisions {
import flash.events.*;
import collisions.colliders.*;
import collisions.events.*;
import library.events.*;
public class CollisionManager implements IEventDispatcher {
private var aNearestObstaclesY:Array;
private var aColliders:Array;
private var oEventDisp:EventDispatcher;
private var nMaxMoveX:Number;
private var aNearestObstaclesX:Array;
private var nMaxMoveY:Number;
private var bEnabled:Boolean;
public function CollisionManager(){
oEventDisp = new EventDispatcher(this);
bEnabled = true;
aColliders = new Array();
aNearestObstaclesX = new Array();
aNearestObstaclesY = new Array();
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function addObject(_arg1:ColliderItem, _arg2:Boolean=false):void{
addEventListener(EventValidate.VALIDATEMOVE, _arg1.onValidate, false, 0, true);
addEventListener(EventValidate.VALIDATEINSTANT, _arg1.onValidateInstant, false, 0, true);
_arg1.addEventListener(EventMoveRequest.MOVEREQUEST, onMoveRequest, false, 0, true);
if (_arg2){
_arg1.addEventListener(EventMoveRequest.ATTACHREQUEST, onAttachRequest, false, 0, true);
};
_arg1.addEventListener(EventHit.HIT, onHit, false, 0, true);
aColliders.push(_arg1);
}
public function get MaxMoveY():Number{
return (nMaxMoveY);
}
private function getNearestY():Object{
var _local1:Object;
var _local2:Number;
var _local3:ColliderItem;
var _local4:Number;
var _local5:int;
_local1 = null;
_local2 = Number.MAX_VALUE;
_local4 = 0;
_local5 = 0;
while (_local5 < aNearestObstaclesY.length) {
_local4 = (aNearestObstaclesY[_local5].ImpactXDistSq + aNearestObstaclesY[_local5].ImpactYDistSq);
if (_local4 < _local2){
_local3 = aNearestObstaclesY[_local5];
_local2 = _local4;
};
_local5++;
};
if (_local2 < Number.MAX_VALUE){
_local1 = {oObs:_local3, nColl:_local2};
};
return (_local1);
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
oEventDisp.addEventListener(_arg1, _arg2, _arg3, _arg4);
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
oEventDisp.removeEventListener(_arg1, _arg2, _arg3);
}
public function get MaxMoveX():Number{
return (nMaxMoveX);
}
public function willTrigger(_arg1:String):Boolean{
return (oEventDisp.willTrigger(_arg1));
}
public function dispatchEvent(_arg1:Event):Boolean{
return (oEventDisp.dispatchEvent(_arg1));
}
public function onMoveRequest(_arg1:EventMoveRequest):void{
var _local2:Object;
var _local3:Object;
var _local4:Boolean;
aNearestObstaclesX.splice(0);
aNearestObstaclesY.splice(0);
nMaxMoveX = _arg1.nMaxMoveX;
nMaxMoveY = _arg1.nMaxMoveY;
_local4 = false;
dispatchEvent(new EventValidate(EventValidate.VALIDATEMOVE, _arg1.nMaxMoveX, _arg1.nMaxMoveY, _arg1.oMoving));
if ((((aNearestObstaclesX.length > 0)) || ((aNearestObstaclesY.length > 0)))){
_local2 = getNearestX();
_local3 = getNearestY();
if (((!((_local2 == null))) && (!((_local3 == null))))){
if (_local3.nColl < _local2.nColl){
nMaxMoveX = _local3.oObs.AllowedMoveX;
nMaxMoveY = _local3.oObs.AllowedMoveY;
_local3.oObs.doImpactResult();
} else {
_local4 = true;
nMaxMoveX = _local2.oObs.AllowedMoveX;
nMaxMoveY = _local2.oObs.AllowedMoveY;
_local2.oObs.doImpactResult();
};
} else {
if (_local2 != null){
_local4 = true;
nMaxMoveX = _local2.oObs.AllowedMoveX;
nMaxMoveY = _local2.oObs.AllowedMoveY;
_local2.oObs.doImpactResult();
} else {
if (_local3 != null){
nMaxMoveX = _local3.oObs.AllowedMoveX;
nMaxMoveY = _local3.oObs.AllowedMoveY;
_local3.oObs.doImpactResult();
};
};
};
aNearestObstaclesX.splice(0);
aNearestObstaclesY.splice(0);
_local2 = null;
_local3 = null;
dispatchEvent(new EventValidate(EventValidate.VALIDATEMOVE, nMaxMoveX, nMaxMoveY, _arg1.oMoving));
if ((((aNearestObstaclesX.length > 0)) || ((aNearestObstaclesY.length > 0)))){
if (_local4){
_local3 = getNearestY();
} else {
_local2 = getNearestX();
};
if (_local2 != null){
_local4 = true;
nMaxMoveX = _local2.oObs.AllowedMoveX;
nMaxMoveY = _local2.oObs.AllowedMoveY;
_local2.oObs.doImpactResult();
} else {
if (_local3 != null){
nMaxMoveX = _local3.oObs.AllowedMoveX;
nMaxMoveY = _local3.oObs.AllowedMoveY;
_local3.oObs.doImpactResult();
};
};
};
_arg1.oMoving.applyNewMaxMoves(nMaxMoveX, nMaxMoveY);
};
}
public function removeObject(_arg1:ColliderItem):void{
var _local2:int;
_local2 = -1;
_local2 = (aColliders.length - 1);
while (_local2 >= 0) {
if (aColliders[_local2] == _arg1){
_arg1.removeEventListener(EventMoveRequest.MOVEREQUEST, onMoveRequest, false);
_arg1.removeEventListener(EventMoveRequest.ATTACHREQUEST, onAttachRequest, false);
_arg1.removeEventListener(EventHit.HIT, onHit, false);
removeEventListener(EventValidate.VALIDATEMOVE, _arg1.onValidate, false);
removeEventListener(EventValidate.VALIDATEINSTANT, _arg1.onValidateInstant, false);
aColliders.splice(_local2, 1);
};
_local2--;
};
}
private function getNearestX():Object{
var _local1:Object;
var _local2:Number;
var _local3:ColliderItem;
var _local4:Number;
var _local5:int;
_local1 = null;
_local2 = Number.MAX_VALUE;
_local4 = 0;
_local5 = 0;
while (_local5 < aNearestObstaclesX.length) {
_local4 = (aNearestObstaclesX[_local5].ImpactXDistSq + aNearestObstaclesX[_local5].ImpactYDistSq);
if (_local4 < _local2){
_local3 = aNearestObstaclesX[_local5];
_local2 = _local4;
};
_local5++;
};
if (_local2 < Number.MAX_VALUE){
_local1 = {oObs:_local3, nColl:_local2};
};
return (_local1);
}
public function onAttachRequest(_arg1:EventMoveRequest):void{
var _local2:Number;
aNearestObstaclesX.splice(0);
nMaxMoveX = 0;
nMaxMoveY = 0;
dispatchEvent(new EventValidate(EventValidate.VALIDATEINSTANT, _arg1.nMaxMoveX, _arg1.nMaxMoveY, _arg1.oMoving));
if ((((aNearestObstaclesX.length > 0)) || ((aNearestObstaclesY.length > 0)))){
_arg1.oMoving.applyNewMaxMoves(nMaxMoveX, nMaxMoveY);
};
_local2 = 0;
_local2 = 0;
while (_local2 < aNearestObstaclesX.length) {
aNearestObstaclesX[_local2].doImpactResult();
_local2++;
};
_local2 = 0;
while (_local2 < aNearestObstaclesY.length) {
aNearestObstaclesY[_local2].doImpactResult();
_local2++;
};
}
public function onHit(_arg1:EventHit):void{
if ((((_arg1.sImpactSide == ColliderItem.sIMPACT_LEFT)) || ((_arg1.sImpactSide == ColliderItem.sIMPACT_RIGHT)))){
aNearestObstaclesX.push(_arg1.oObstacle);
} else {
if ((((_arg1.sImpactSide == ColliderItem.sIMPACT_UP)) || ((_arg1.sImpactSide == ColliderItem.sIMPACT_DOWN)))){
aNearestObstaclesY.push(_arg1.oObstacle);
};
};
}
public function destroy(_arg1:Event):void{
var _local2:int;
_local2 = -1;
_local2 = (aColliders.length - 1);
while (_local2 >= 0) {
aColliders[_local2].removeEventListener(EventMoveRequest.MOVEREQUEST, onMoveRequest, false);
aColliders[_local2].removeEventListener(EventHit.HIT, onHit, false);
removeEventListener(EventValidate.VALIDATEMOVE, aColliders[_local2].onValidate, false);
_local2--;
};
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
public function hasEventListener(_arg1:String):Boolean{
return (oEventDisp.hasEventListener(_arg1));
}
}
}//package collisions
Section 24
//AbstractResponder (com.nickonline.services.business.AbstractResponder)
package com.nickonline.services.business {
public class AbstractResponder implements IResponder {
private var validationEnabled:Boolean;// = true
public static const VERSION:String = "1";
public function allowValidation():Boolean{
return (this.validationEnabled);
}
public function onFault(_arg1:Object):void{
throw (new Error("AbstractResponder: onResult: Provide a concrete class."));
}
public function onStatus(_arg1:Object):void{
throw (new Error("AbstractResponder: onResult: Provide a concrete class."));
}
public function isValid(_arg1:String):Boolean{
return ((VERSION == _arg1));
}
public function onResult(_arg1:Object):void{
throw (new Error("AbstractResponder: onResult: Provide a concrete class."));
}
public function validate(_arg1:String):void{
if (((!(this.allowValidation())) || (this.isValid(_arg1)))){
return;
};
this.invalidate((((("Responder::invalid version: request:[" + AbstractResponder.VERSION) + "] - server:[") + _arg1) + "]"));
}
public function invalidate(_arg1:String):void{
if (!this.allowValidation()){
return;
};
throw (new Error(_arg1));
}
public function enableValidation(_arg1:Boolean):void{
this.validationEnabled = _arg1;
}
}
}//package com.nickonline.services.business
Section 25
//IResponder (com.nickonline.services.business.IResponder)
package com.nickonline.services.business {
public interface IResponder {
function onStatus(_arg1:Object):void;
function allowValidation():Boolean;
function onFault(_arg1:Object):void;
function validate(_arg1:String):void;
function isValid(_arg1:String):Boolean;
function invalidate(_arg1:String):void;
function enableValidation(_arg1:Boolean):void;
function onResult(_arg1:Object):void;
}
}//package com.nickonline.services.business
Section 26
//ProxyResponder (com.nickonline.services.business.ProxyResponder)
package com.nickonline.services.business {
public class ProxyResponder extends AbstractResponder {
private var proxyOnResult:Function;
private var proxyOnFault:Function;
private var proxyOnUpdate:Function;
private var proxyOnStatus:Function;
public function ProxyResponder(_arg1:Function, _arg2:Function, _arg3:Function=null){
this.proxyOnResult = _arg1;
this.proxyOnFault = _arg2;
this.proxyOnStatus = _arg3;
}
override public function onFault(_arg1:Object):void{
if (this.proxyOnFault != null){
this.proxyOnFault(_arg1);
};
}
override public function onResult(_arg1:Object):void{
if (this.proxyOnResult != null){
this.proxyOnResult(_arg1);
};
}
override public function onStatus(_arg1:Object):void{
if (this.proxyOnStatus != null){
this.proxyOnStatus(_arg1);
};
}
override public function invalidate(_arg1:String):void{
if (!this.allowValidation()){
return;
};
trace(("ProxyResponder: invalidate: " + _arg1));
}
}
}//package com.nickonline.services.business
Section 27
//ServiceLocator (com.nickonline.services.business.ServiceLocator)
package com.nickonline.services.business {
import flash.events.*;
import flash.display.*;
import flash.system.*;
import flash.utils.*;
import flash.net.*;
public final class ServiceLocator {
private var pManagerURI:String;
private var doServiceLoaded:Function;
private var managerLoader:Loader;
private var serviceEvents:Object;
private var managerLoaderContext:LoaderContext;
private var serviceManager;
private var pConfigURI:String;
private var pDefaultURI:String;
public static const DEFAULT_MANAGER_URI:String = "/common/flash/services/ServiceManager.swf";
public function ServiceLocator(_arg1:String=null, _arg2:String=null){
this.managerURI = _arg1;
this.configURI = _arg2;
this.serviceEvents = null;
}
private function loaded(_arg1:Event):void{
if (Event.INIT == _arg1.type){
} else {
if (Event.COMPLETE == _arg1.type){
this.serviceManager = _arg1.target.content;
this.serviceManager.defaultURI = this.defaultURI;
this.addEventToManager("EVENT_SERVICES_LOADED");
this.addEventToManager("EVENT_SERVICE_INVALID");
this.addEventToManager("EVENT_SERVICES_NOT_FOUND");
this.serviceManager.loadServices(this.configURI);
} else {
if (this.serviceEvents == null){
return;
};
var _local2 = this.serviceEvents;
_local2["EVENT_SERVICES_NOT_FOUND"](new Event("EVENT_SERVICES_NOT_FOUND"));
};
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
if (this.serviceManager == null){
return;
};
this.serviceManager.removeEventListener(_arg1, _arg2);
}
public function addEventListener(_arg1:String, _arg2:Function):void{
if (this.serviceEvents == null){
this.serviceEvents = new Object();
};
this.serviceEvents[_arg1] = _arg2;
}
public function get configURI():String{
return (this.pConfigURI);
}
public function set configURI(_arg1:String):void{
this.pConfigURI = _arg1;
}
public function set defaultURI(_arg1:String):void{
this.pDefaultURI = _arg1;
}
public function load():void{
this.managerLoader = new Loader();
this.managerLoader.contentLoaderInfo.addEventListener(Event.INIT, this.loaded);
this.managerLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.loaded);
this.managerLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.loaded);
this.managerLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.loaded);
this.managerLoaderContext = new LoaderContext(false, new ApplicationDomain(ApplicationDomain.currentDomain));
this.managerLoader.load(new URLRequest((this.defaultURI + this.managerURI)), this.managerLoaderContext);
}
public function get defaultURI():String{
return (((this.pDefaultURI == null)) ? "" : this.pDefaultURI);
}
public function execute(_arg1:String, _arg2:String, _arg3:Object, _arg4):void{
this.serviceManager.execute(_arg1, _arg2, _arg3, _arg4);
}
public function addEventToManager(_arg1:String):void{
if ((((((((this.serviceManager == null)) || ((_arg1 == null)))) || ((this.serviceEvents == null)))) || ((this.serviceEvents[_arg1] == null)))){
return;
};
this.serviceManager.addEventListener(_arg1, this.serviceEvents[_arg1]);
}
public function set managerURI(_arg1:String):void{
this.pManagerURI = _arg1;
}
public function get managerURI():String{
return (((this.pManagerURI == null)) ? DEFAULT_MANAGER_URI : this.pManagerURI);
}
}
}//package com.nickonline.services.business
Section 28
//wav (EnemyAngryBubble.wav)
package EnemyAngryBubble {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package EnemyAngryBubble
Section 29
//wav (EnemyBrake.wav)
package EnemyBrake {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package EnemyBrake
Section 30
//wav (EnemyDie.wav)
package EnemyDie {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package EnemyDie
Section 31
//wav (EnemyHitBubble.wav)
package EnemyHitBubble {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package EnemyHitBubble
Section 32
//wav (EnemyIdle.wav)
package EnemyIdle {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package EnemyIdle
Section 33
//wav (EnemyLand.wav)
package EnemyLand {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package EnemyLand
Section 34
//wav (EnemyRun.wav)
package EnemyRun {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package EnemyRun
Section 35
//BFFTattoo (gameplay.items.BFFTattoo)
package gameplay.items {
import flash.display.*;
import gameplay.*;
public class BFFTattoo extends Collectible {
public function BFFTattoo(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number, _arg8:String, _arg9:CollectibleManager){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
nPOINTS = Data.nPOINTS_BFF;
changeDirection();
}
override protected function state_Taken_init():void{
Main.instance.gameManager.getScoreManager.addPoints(nPOINTS);
Main.instance.gameManager.takeBFFTattoo();
Main.instance.oSoundPlayer.playBFFCollectible();
}
override protected function doDisappear():void{
oCollectibleManager.blockHearts();
}
override protected function state_Idle_init():void{
nDisappearTime = Data.nCOLLECTIBLE_BFF_DISAPPEAR_TIME;
}
}
}//package gameplay.items
Section 36
//Collectible (gameplay.items.Collectible)
package gameplay.items {
import flash.events.*;
import flash.display.*;
import gameplay.*;
import collisions.colliders.*;
import collisions.events.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class Collectible extends AllSideBlocker implements Idestroyable {
protected var nSpdY:Number;
protected var nSpdX:Number;
protected var sDirection:String;
protected var nDisappearTime:Number;
protected var oCollectibleManager:CollectibleManager;
protected var nMaxSpeedX:Number;
protected var bOnGround:Boolean;
public static const sSTATE_TAKEN:String = "Taken";
public static const sDIR_LEFT:String = "Left";
public static const sSTATE_IDLE:String = "Idle";
public static const sDIR_RIGHT:String = "Right";
public static const sSTATE_LAND:String = "Land";
public static const sSTATE_FALL:String = "Fall";
public static var nPOINTS:Number = 0;
public function Collectible(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number, _arg8:String, _arg9:CollectibleManager){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, 1, 1);
oCollectibleManager = _arg9;
nMaxSpeedX = Data.nCOLLECTIBLE_MAX_SPEED_X;
nSpdY = Data.nCOLLECTIBLE_BUMPUP_SPEED;
bOnGround = false;
sDirection = _arg8;
nDisappearTime = 0;
nMaxMoveX = nSpdX;
nMaxMoveY = nSpdY;
setMaxMove();
nSpdX = (Data.nCOLLECTIBLE_FRACTION_SPEED_X * _arg7);
addState(sSTATE_IDLE, state_Idle, state_Idle_init);
addState(sSTATE_FALL, state_Fall, state_Fall_init);
addState(sSTATE_LAND, state_Land, state_Land_init);
addState(sSTATE_TAKEN, state_Taken, state_Taken_init);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
setDir(_arg8);
setMinSpeedX();
setState(sSTATE_FALL);
}
protected function checkFallHole():void{
if ((nPosY - mcRef.height) > Data.iSTAGE_HEIGHT){
nPosY = 0;
setMinSpeedX();
};
}
protected function state_Fall_init():void{
dispatchEvent(new EventMoveRequest(EventMoveRequest.ATTACHREQUEST, nRealMoveX, nRealMoveY, this));
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
oMovingItem = _arg3;
if ((((oMovingItem is Character)) || ((oMovingItem is Bubble)))){
if ((oMovingItem is Player)){
doImpactResult();
};
} else {
if (!(oMovingItem is Collectible)){
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
};
}
protected function state_Land():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
protected function state_Taken_init():void{
Main.instance.gameManager.getScoreManager.addPoints(nPOINTS);
Main.instance.oSoundPlayer.playCollectible();
}
override public function doImpactResult():void{
if ((oMovingItem is Player)){
setTaken();
};
}
protected function applyGravity(_arg1:Boolean=true):void{
if (_arg1){
if (bOnGround == false){
doFall();
};
};
if (nSpdY > 0){
bOnGround = false;
};
if (nSpdY == 0){
if (state == sSTATE_FALL){
nSpdY = Data.nCOLLECTIBLE_MIN_SPEED_Y;
} else {
nSpdY = Data.nCOLLECTIBLE_MIN_FALL_SPEED_Y;
};
} else {
if (nSpdY < 0){
nSpdY = (nSpdY / Data.nCOLLECTIBLE_DECEL_Y);
if (Math.abs(nSpdY) < Data.nCOLLECTIBLE_MIN_SPEED_Y){
nSpdY = 0;
};
} else {
if (nSpdY < Data.nCOLLECTIBLE_MAX_SPEED_Y){
nSpdY = (nSpdY * Data.nCOLLECTIBLE_ACCEL_Y);
if (nSpdY > Data.nCOLLECTIBLE_MAX_SPEED_Y){
nSpdY = Data.nCOLLECTIBLE_MAX_SPEED_Y;
};
};
};
};
}
protected function applyMove():void{
while (((!((nMaxMoveX == 0))) || (!((nMaxMoveY == 0))))) {
dispatchEvent(new EventMoveRequest(EventMoveRequest.MOVEREQUEST, nRealMoveX, nRealMoveY, this));
nPosX = (nPosX + nRealMoveX);
nPosY = (nPosY + nRealMoveY);
mcRef.x = nPosX;
mcRef.y = nPosY;
if (nMaxMoveX == nRealMoveX){
nMaxMoveX = 0;
} else {
if (nMaxMoveX != 0){
nMaxMoveX = (nMaxMoveX - nRealMoveX);
};
};
if (nMaxMoveY == nRealMoveY){
nMaxMoveY = 0;
} else {
if (nMaxMoveY != 0){
nMaxMoveY = (nMaxMoveY - nRealMoveY);
};
};
nMaxMoveX = MathObj.roundNumber(nMaxMoveX);
nMaxMoveY = MathObj.roundNumber(nMaxMoveY);
nRealMoveX = nMaxMoveX;
nRealMoveY = nMaxMoveY;
setHitBorders();
};
}
protected function state_Idle_init():void{
nDisappearTime = Data.nCOLLECTIBLE_HAIRPIECE_DISAPPEAR_TIME;
}
protected function setSpeedXWhenJumping():void{
nMaxSpeedX = Data.nCOLLECTIBLE_MAX_SPEED_X;
}
protected function state_Taken():void{
if (stateComplete){
destroy();
};
}
protected function doDisappear():void{
}
public function setTaken():void{
if ((((((state == sSTATE_IDLE)) || ((state == sSTATE_LAND)))) && (!((state == sSTATE_TAKEN))))){
setState(sSTATE_TAKEN);
};
}
public function stopSpeedX():void{
nSpdX = 0;
}
protected function state_Land_init():void{
dispatchEvent(new EventMoveRequest(EventMoveRequest.ATTACHREQUEST, nRealMoveX, nRealMoveY, this));
}
protected function setMinSpeedX():void{
if (nSpdX == 0){
if (sDirection == sDIR_RIGHT){
nSpdX = Data.nCOLLECTIBLE_MIN_SPEED_X;
} else {
nSpdX = (-1 * Data.nCOLLECTIBLE_MIN_SPEED_X);
};
};
}
protected function setMaxMove():void{
nMaxMoveX = nSpdX;
nMaxMoveY = nSpdY;
nMaxMoveX = MathObj.roundNumber(nMaxMoveX);
nMaxMoveY = MathObj.roundNumber(nMaxMoveY);
nRealMoveX = nMaxMoveX;
nRealMoveY = nMaxMoveY;
}
protected function doFall():void{
setState(sSTATE_FALL);
}
protected function changeDirection():void{
if (sDirection == sDIR_RIGHT){
sDirection = sDIR_LEFT;
} else {
sDirection = sDIR_RIGHT;
};
nSpdX = (-1 * nSpdX);
}
protected function state_Fall():void{
}
override public function update(_arg1:Event=null):void{
if (((((!((state == sSTATE_TAKEN))) && (!((state == sSTATE_LAND))))) && (!((state == sSTATE_IDLE))))){
applyGravity();
doMove();
checkFallHole();
};
super.update(_arg1);
}
public function setHitGround():void{
nSpdY = 0;
nSpdX = 0;
if (state == sSTATE_FALL){
setState(sSTATE_LAND);
};
}
protected function setDir(_arg1:String):void{
sDirection = _arg1;
}
protected function slowDownXSpeed():void{
nSpdX = 0;
}
protected function checkDisappearTime():void{
nDisappearTime--;
if (nDisappearTime <= 0){
nDisappearTime = 0;
doDisappear();
destroy();
};
}
protected function state_Idle():void{
checkDisappearTime();
}
override public function destroy(_arg1:Event=null):void{
super.destroy(_arg1);
Main.instance.gameManager.getCollectibleManager.removeCollectible(this);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
protected function doMove():void{
setMaxMove();
applyMove();
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
}
}
}//package gameplay.items
Section 37
//Comb (gameplay.items.Comb)
package gameplay.items {
import flash.display.*;
import gameplay.*;
public class Comb extends Collectible {
public function Comb(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number, _arg8:String, _arg9:CollectibleManager){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
nPOINTS = Data.nPOINTS_COMB;
}
override protected function state_Idle_init():void{
nDisappearTime = Data.nCOLLECTIBLE_COMB_DISAPPEAR_TIME;
}
}
}//package gameplay.items
Section 38
//Hairpiece (gameplay.items.Hairpiece)
package gameplay.items {
import flash.display.*;
import gameplay.*;
public class Hairpiece extends Collectible {
public function Hairpiece(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number, _arg8:String, _arg9:CollectibleManager){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
nPOINTS = Data.nPOINTS_HAIRPIECE;
}
override protected function state_Idle_init():void{
nDisappearTime = Data.nCOLLECTIBLE_HAIRPIECE_DISAPPEAR_TIME;
}
}
}//package gameplay.items
Section 39
//Hairspray (gameplay.items.Hairspray)
package gameplay.items {
import flash.display.*;
import gameplay.*;
public class Hairspray extends Collectible {
public function Hairspray(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number, _arg8:String, _arg9:CollectibleManager){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9);
nPOINTS = Data.nPOINTS_HAIRSPRAY;
}
override protected function state_Idle_init():void{
nDisappearTime = Data.nCOLLECTIBLE_HAIRSPRAY_DISAPPEAR_TIME;
}
}
}//package gameplay.items
Section 40
//BGLevels (gameplay.Level.BGLevels)
package gameplay.Level {
import flash.events.*;
import flash.display.*;
import library.interfaces.*;
import library.events.*;
public class BGLevels implements Idestroyable {
private var mcBGLevel:MovieClip;
private var mcContainer:DisplayObjectContainer;
public function BGLevels(_arg1:DisplayObjectContainer){
mcContainer = _arg1;
Main.instance.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
addBG();
}
public function destroy(_arg1:Event=null):void{
mcContainer.removeChild(mcBGLevel);
mcBGLevel = null;
Main.instance.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
public function addBG():void{
switch (Data.nLEVEL){
case 1:
mcBGLevel = new mcBGLevel1();
break;
case 2:
mcBGLevel = new mcBGLevel2();
break;
case 3:
mcBGLevel = new mcBGLevel3();
break;
case 4:
mcBGLevel = new mcBGLevel4();
break;
case 5:
mcBGLevel = new mcBGLevel5();
break;
case 6:
mcBGLevel = new mcBGLevel6();
break;
};
mcBGLevel.name = "mcBGLevel";
mcContainer.addChild(mcBGLevel);
}
}
}//package gameplay.Level
Section 41
//Ceiling (gameplay.Level.Ceiling)
package gameplay.Level {
import flash.display.*;
import gameplay.*;
import collisions.colliders.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class Ceiling extends BottomBlocker implements Idestroyable {
public function Ceiling(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override public function doImpactResult():void{
switch (sImpactSide){
case sIMPACT_DOWN:
if ((oMovingItem is Character)){
(oMovingItem as Character).SpeedY = 0;
} else {
if ((oMovingItem is Bubble)){
(oMovingItem as Bubble).popBubble();
};
};
break;
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if ((_arg3 is Bubble)){
(_arg3 as Bubble).popBubble();
};
}
}
}//package gameplay.Level
Section 42
//Ground (gameplay.Level.Ground)
package gameplay.Level {
import flash.display.*;
import gameplay.items.*;
import collisions.colliders.*;
import collisions.events.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class Ground extends TopBlocker implements Idestroyable {
public function Ground(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if (sImpactSide == sIMPACT_UP){
oMovingItem = _arg3;
if ((oMovingItem is Enemy)){
if (oMovingItem.state != Enemy.sSTATE_APPEAR){
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
} else {
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
} else {
if (sImpactSide == sIMPACT_DOWN){
oMovingItem = _arg3;
if ((oMovingItem is Enemy)){
if ((((oMovingItem.state == Enemy.sSTATE_BUBBLE_IDLE)) || ((oMovingItem.state == Enemy.sSTATE_ANGRY_BUBBLE)))){
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
};
};
};
}
override public function doImpactResult():void{
if (sImpactSide == sIMPACT_UP){
if ((oMovingItem is Character)){
(oMovingItem as Character).setHitGround();
} else {
if ((oMovingItem is Collectible)){
(oMovingItem as Collectible).setHitGround();
};
};
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
}
}
}//package gameplay.Level
Section 43
//JumpLeft (gameplay.Level.JumpLeft)
package gameplay.Level {
import flash.display.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class JumpLeft extends JumpPoint implements Idestroyable {
public function JumpLeft(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override public function doImpactResult():void{
if ((oMovingItem is Enemy)){
(oMovingItem as Enemy).makeJump(Enemy.sDIR_LEFT);
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
}
}//package gameplay.Level
Section 44
//JumpPoint (gameplay.Level.JumpPoint)
package gameplay.Level {
import flash.display.*;
import collisions.colliders.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class JumpPoint extends NoBlockerCollider implements Idestroyable {
public function JumpPoint(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override public function doImpactResult():void{
if ((oMovingItem is Enemy)){
(oMovingItem as Enemy).makeJump();
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
}
}
}//package gameplay.Level
Section 45
//JumpRight (gameplay.Level.JumpRight)
package gameplay.Level {
import flash.display.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class JumpRight extends JumpPoint implements Idestroyable {
public function JumpRight(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override public function doImpactResult():void{
if ((oMovingItem is Enemy)){
(oMovingItem as Enemy).makeJump(Enemy.sDIR_RIGHT);
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
}
}//package gameplay.Level
Section 46
//ReverseLeftPoint (gameplay.Level.ReverseLeftPoint)
package gameplay.Level {
import flash.display.*;
import collisions.colliders.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class ReverseLeftPoint extends NoBlockerCollider implements Idestroyable {
public function ReverseLeftPoint(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override public function doImpactResult():void{
if ((oMovingItem is Enemy)){
(oMovingItem as Enemy).reverseDirection(Enemy.sDIR_LEFT);
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
}
}
}//package gameplay.Level
Section 47
//ReverseRightPoint (gameplay.Level.ReverseRightPoint)
package gameplay.Level {
import flash.display.*;
import collisions.colliders.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class ReverseRightPoint extends NoBlockerCollider implements Idestroyable {
public function ReverseRightPoint(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override public function doImpactResult():void{
if ((oMovingItem is Enemy)){
(oMovingItem as Enemy).reverseDirection(Enemy.sDIR_RIGHT);
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
}
}
}//package gameplay.Level
Section 48
//WallAll (gameplay.Level.WallAll)
package gameplay.Level {
import flash.display.*;
import gameplay.*;
import gameplay.items.*;
import collisions.colliders.*;
import collisions.events.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class WallAll extends AllSideBlocker implements Idestroyable {
public function WallAll(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
oMovingItem = _arg3;
if (sImpactSide == sIMPACT_UP){
if ((oMovingItem is Enemy)){
if (oMovingItem.state != Enemy.sSTATE_APPEAR){
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
} else {
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
} else {
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
}
override public function doImpactResult():void{
switch (sImpactSide){
case sIMPACT_LEFT:
if ((oMovingItem is Bubble)){
(oMovingItem as Bubble).stopBubbleInX();
} else {
if ((oMovingItem is Enemy)){
(oMovingItem as Enemy).reverseDirection();
};
};
break;
case sIMPACT_RIGHT:
if ((oMovingItem is Bubble)){
(oMovingItem as Bubble).stopBubbleInX();
} else {
if ((oMovingItem is Enemy)){
(oMovingItem as Enemy).reverseDirection();
};
};
break;
case sIMPACT_UP:
if ((oMovingItem is Character)){
(oMovingItem as Character).setHitGround();
} else {
if ((oMovingItem is Collectible)){
(oMovingItem as Collectible).setHitGround();
};
};
break;
case sIMPACT_DOWN:
if ((oMovingItem is Character)){
(oMovingItem as Character).SpeedY = 0;
} else {
if ((oMovingItem is Bubble)){
(oMovingItem as Bubble).popBubble();
};
};
break;
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if ((_arg3 is Bubble)){
(_arg3 as Bubble).popBubble();
} else {
if ((_arg3 is Collectible)){
(_arg3 as Collectible).stopSpeedX();
};
};
}
}
}//package gameplay.Level
Section 49
//WallBottom (gameplay.Level.WallBottom)
package gameplay.Level {
import flash.display.*;
import gameplay.*;
import collisions.colliders.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class WallBottom extends BottomBlocker implements Idestroyable {
public function WallBottom(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override public function doImpactResult():void{
if (sImpactSide == sIMPACT_DOWN){
if ((oMovingItem is Character)){
(oMovingItem as Character).SpeedY = 0;
} else {
if ((oMovingItem is Bubble)){
(oMovingItem as Bubble).popBubble();
};
};
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if ((_arg3 is Bubble)){
(_arg3 as Bubble).popBubble();
};
}
}
}//package gameplay.Level
Section 50
//WallLeft (gameplay.Level.WallLeft)
package gameplay.Level {
import flash.display.*;
import gameplay.*;
import gameplay.items.*;
import collisions.colliders.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class WallLeft extends LeftBlocker implements Idestroyable {
public function WallLeft(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override public function doImpactResult():void{
if (sImpactSide == sIMPACT_LEFT){
if ((oMovingItem is Bubble)){
(oMovingItem as Bubble).stopBubbleInX();
} else {
if ((oMovingItem is Enemy)){
(oMovingItem as Enemy).reverseDirection();
};
};
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if ((_arg3 is Bubble)){
(_arg3 as Bubble).popBubble();
} else {
if ((_arg3 is Collectible)){
(_arg3 as Collectible).stopSpeedX();
};
};
}
}
}//package gameplay.Level
Section 51
//WallRight (gameplay.Level.WallRight)
package gameplay.Level {
import flash.display.*;
import gameplay.*;
import gameplay.items.*;
import collisions.colliders.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class WallRight extends RightBlocker implements Idestroyable {
public function WallRight(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:Number=1, _arg8:Number=1){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
bActivatedItem = true;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
}
override public function doImpactResult():void{
if (sImpactSide == sIMPACT_RIGHT){
if ((oMovingItem is Bubble)){
(oMovingItem as Bubble).stopBubbleInX();
} else {
if ((oMovingItem is Enemy)){
(oMovingItem as Enemy).reverseDirection();
};
};
};
}
override protected function checkDeactivate():void{
deactivateItem();
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
if ((_arg3 is Bubble)){
(_arg3 as Bubble).popBubble();
} else {
if ((_arg3 is Collectible)){
(_arg3 as Collectible).stopSpeedX();
};
};
}
}
}//package gameplay.Level
Section 52
//Bubble (gameplay.Bubble)
package gameplay {
import flash.events.*;
import flash.display.*;
import collisions.colliders.*;
import collisions.events.*;
import collisions.basic_class.*;
import library.interfaces.*;
import library.events.*;
public class Bubble extends Projectile implements Idestroyable {
private var bMovingX:Boolean;
private var oBubbleGenerator:BubbleGenerator;
private var nDirection:Number;
public static const sSTATE_POP:String = "Pop";
public static const sSTATE_INIT:String = "init";
public static const sSTATE_BUMP:String = "Bump";
public static const sSTATE_FLOATING:String = "Floating";
public static const sSTATE_ATTACK:String = "Attack";
public function Bubble(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array, _arg7:BubbleGenerator, _arg8:Number){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
nDirection = _arg8;
oBubbleGenerator = _arg7;
bActivatedItem = false;
bDestroyOnceInactive = false;
bActive = true;
bDeactivateVertical = false;
bMovingX = true;
nSpdX = (nDirection * Data.nBUBBLE_MAX_SPEED_X);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
addState(sSTATE_INIT, state_Init);
addState(sSTATE_ATTACK, state_Attack, state_Attack_init);
addState(sSTATE_FLOATING, state_Floating, state_Floating_init);
addState(sSTATE_POP, state_Pop, state_Pop_init);
addState(sSTATE_BUMP, state_Bump, state_Bump_init);
setState(sSTATE_INIT);
}
override public function pause(_arg1:Event=null):void{
super.pause();
if (mcState != null){
if (mcState.mcBubble != null){
mcState.mcBubble.stop();
};
};
}
override protected function resolveHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
oMovingItem = _arg3;
if ((oMovingItem is Bubble)){
} else {
if ((oMovingItem is Player)){
if (state == sSTATE_FLOATING){
if (sImpactSide == sIMPACT_UP){
(oMovingItem as Player).makePlayerJump();
popBubble(true, true);
} else {
popBubble(true, false);
};
};
} else {
if ((oMovingItem is Enemy)){
if (((!((oMovingItem as Enemy).Bubbled)) || ((sImpactSide == sIMPACT_UP)))){
if (state == sSTATE_FLOATING){
popBubble();
} else {
if (state == sSTATE_ATTACK){
(oMovingItem as Enemy).getBubbled();
destroy();
};
};
};
} else {
dispatchEvent(new EventHit(EventHit.HIT, _arg1, _arg2, this, sImpactSide));
};
};
};
}
protected function state_Init():void{
setState(sSTATE_ATTACK);
}
protected function state_Floating():void{
applyFloatSpeed();
}
override public function resume(_arg1:Event=null):void{
super.resume();
if (mcState != null){
if (mcState.mcBubble != null){
mcState.mcBubble.play();
};
};
}
override public function doImpactResult():void{
}
protected function state_Bump_init():void{
Main.instance.oSoundPlayer.playBubbleBump();
}
protected function state_Pop_init():void{
Main.instance.oSoundPlayer.playBubblePopping();
}
public function popBubble(_arg1:Boolean=false, _arg2:Boolean=false):void{
if (((!((state == sSTATE_POP))) && (!((state == sSTATE_BUMP))))){
nSpdX = 0;
if (_arg2){
setState(sSTATE_BUMP);
} else {
setState(sSTATE_POP);
};
if (_arg1){
Main.instance.gameManager.getScoreManager.addPoints(Data.nPOINTS_EMPTY_BUBBLE);
};
};
}
protected function state_Floating_init():void{
nSpdX = 0;
}
protected function state_Bump():void{
if (stateComplete){
destroy();
};
}
private function applyFloatSpeed():void{
if (nSpdY == 0){
nSpdY = Data.nBUBBLE_MIN_SPEED_Y;
} else {
nSpdY = (nSpdY * Data.nBUBBLE_ACCEL_Y);
};
if (nSpdY < Data.nBUBBLE_MAX_SPEED_Y){
nSpdY = Data.nBUBBLE_MAX_SPEED_Y;
};
}
private function applyDecelX():void{
if (bMovingX){
nSpdX = (nSpdX / Data.nBUBBLE_DECEL_X);
};
if (Math.abs(nSpdX) < Data.nBUBBLE_MIN_SPEED_X){
nSpdX = (nDirection * Data.nBUBBLE_MIN_SPEED_X);
setState(sSTATE_FLOATING);
};
}
protected function state_Pop():void{
if (stateComplete){
destroy();
};
}
override public function update(_arg1:Event=null):void{
if (state != sSTATE_INIT){
doMove();
};
super.update(_arg1);
}
public function stopBubbleInX():void{
nSpdX = 0;
bMovingX = false;
}
protected function state_Attack():void{
applyDecelX();
}
protected function state_Attack_init():void{
dispatchEvent(new EventMoveRequest(EventMoveRequest.ATTACHREQUEST, nRealMoveX, nRealMoveY, this));
}
override public function destroy(_arg1:Event=null):void{
oBubbleGenerator.removeBubble(this);
super.destroy(_arg1);
if (((!((oLayer == null))) && (!((mcRef == null))))){
if (oLayer.contains(mcRef)){
oLayer.removeChild(mcRef);
};
};
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
private function doMove():void{
setMaxMove();
applyMove();
}
}
}//package gameplay
Section 53
//BubbleGenerator (gameplay.BubbleGenerator)
package gameplay {
import flash.events.*;
import flash.display.*;
import library.events.*;
public class BubbleGenerator {
private const nMAX_BUBBLES:Number = 10;
private var aBubbles:Array;
private var aPoolBubbles:Array;
private var mcContainer:DisplayObjectContainer;
private var oPlayer:Player;
public function BubbleGenerator(_arg1:DisplayObjectContainer, _arg2:Player){
mcContainer = _arg1;
oPlayer = _arg2;
aBubbles = new Array();
aPoolBubbles = new Array();
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function addBubble():void{
var _local1:Number;
var _local2:Number;
var _local3:Bubble;
var _local4:int;
_local1 = 0;
_local2 = 0;
if (aBubbles.length >= nMAX_BUBBLES){
_local4 = 0;
while (_local4 < aBubbles.length) {
if (aBubbles[_local4].state != Bubble.sSTATE_POP){
aBubbles[_local4].popBubble();
break;
};
_local4++;
};
};
_local1 = ((oPlayer.mcRef.scaleX * oPlayer.mcRef.mcBubbleGenerator.x) + oPlayer.mcRef.x);
_local2 = (oPlayer.mcRef.mcBubbleGenerator.y + oPlayer.mcRef.y);
_local3 = new Bubble(null, mcContainer, _local1, _local2, mcBubble, aPoolBubbles, this, oPlayer.mcRef.scaleX);
aBubbles.push(_local3);
Main.instance.gameManager.getCollisionManager.addObject(_local3, true);
}
public function removeBubble(_arg1:Bubble):void{
var _local2:int;
_local2 = (aBubbles.length - 1);
while (_local2 >= 0) {
if (aBubbles[_local2] == _arg1){
aBubbles.splice(_local2, 1);
break;
};
_local2--;
};
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
}
}//package gameplay
Section 54
//Camera (gameplay.Camera)
package gameplay {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import library.events.*;
public class Camera {
private var mcTarget:MovieClip;
private var nMIN_Y_POS:Number;// = 0
public var mcRef:MovieClip;
private var nSLOW_DOWN_RATIO:Number;// = 4
private var nMAX_X_POS:Number;// = 0
private var nMAX_Y_POS:Number;// = 0
private var nSPEED_MIN:Number;// = 0.5
private var bZooming:Boolean;
private var bPaused:Boolean;
private var nScale:Number;
private var mcLastTarget:MovieClip;
private var aMIN_X_POS:Array;
public function Camera(_arg1:MovieClip, _arg2:MovieClip){
nSLOW_DOWN_RATIO = 4;
nSPEED_MIN = 0.5;
nMAX_X_POS = 0;
aMIN_X_POS = [0, 0, -600, -600, -1200, -1200];
nMIN_Y_POS = 0;
nMAX_Y_POS = 0;
super();
mcRef = _arg1;
mcTarget = _arg2;
mcLastTarget = new MovieClip();
nScale = mcRef.scaleX;
bZooming = false;
bPaused = false;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
private function getMainGameCoord():Point{
var _local1:Point;
_local1 = new Point();
_local1.x = 0;
_local1.y = 0;
_local1.x = mcTarget.x;
_local1.y = mcTarget.y;
_local1 = mcRef.localToGlobal(_local1);
return (_local1);
}
private function update(_arg1:Event=null):void{
if (!bPaused){
checkTargetPos();
};
}
private function move(_arg1:Number, _arg2:Number):void{
mcRef.x = (mcRef.x + _arg1);
mcRef.y = (mcRef.y + _arg2);
if (mcRef.x < aMIN_X_POS[(Data.nLEVEL - 1)]){
mcRef.x = aMIN_X_POS[(Data.nLEVEL - 1)];
} else {
if (mcRef.x > nMAX_X_POS){
mcRef.x = nMAX_X_POS;
};
};
if (mcRef.y < nMIN_Y_POS){
mcRef.y = nMIN_Y_POS;
} else {
if (mcRef.y > nMAX_Y_POS){
mcRef.y = nMAX_Y_POS;
};
};
}
public function destroy(_arg1:Event=null):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
public function get mc():MovieClip{
return (mcRef);
}
private function checkTargetPos():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = 0;
_local2 = 0;
_local3 = (Data.iSTAGE_WIDTH / 2);
_local4 = (Data.iSTAGE_HEIGHT / 2);
_local5 = getMainGameCoord().x;
_local6 = getMainGameCoord().y;
_local7 = 0;
if (bZooming){
if (mcRef.scaleX < nScale){
_local7 = (nScale - mcRef.scaleX);
if (_local7 < 0.5){
mcRef.scaleX = nScale;
} else {
mcRef.scaleX = (mcRef.scaleX + _local7);
};
mcRef.scaleY = mcRef.scaleX;
} else {
if (mcRef.scaleX > (nScale + 1)){
_local7 = ((mcRef.scaleX - nScale) / nSLOW_DOWN_RATIO);
if (_local7 < 0.5){
mcRef.scaleX = (nScale + 1);
} else {
mcRef.scaleX = (mcRef.scaleX - _local7);
};
mcRef.scaleY = mcRef.scaleX;
};
};
if (mcRef.scaleX == nScale){
bZooming = false;
};
};
if ((((_local5 < _local3)) && ((mcRef.x < nMAX_X_POS)))){
_local1 = ((_local3 - _local5) / nSLOW_DOWN_RATIO);
} else {
if ((((_local5 > _local3)) && ((mcRef.x > aMIN_X_POS[(Data.nLEVEL - 1)])))){
_local1 = (-((_local5 - _local3)) / nSLOW_DOWN_RATIO);
};
};
if ((((_local1 > 0)) && ((_local1 <= nSPEED_MIN)))){
_local1 = 0;
} else {
if ((((_local1 < 0)) && ((_local1 >= -(nSPEED_MIN))))){
_local1 = 0;
};
};
if ((((_local6 < _local4)) && ((mcRef.y < nMAX_Y_POS)))){
_local2 = ((_local4 - _local6) / nSLOW_DOWN_RATIO);
} else {
if ((((_local6 > _local4)) && ((mcRef.y > nMIN_Y_POS)))){
_local2 = (-((_local6 - _local4)) / nSLOW_DOWN_RATIO);
};
};
if ((((_local2 > 0)) && ((_local2 <= nSPEED_MIN)))){
_local2 = 0;
} else {
if ((((_local2 < 0)) && ((_local2 >= -(nSPEED_MIN))))){
_local2 = 0;
};
};
if (((!((_local1 == 0))) || (!((_local2 == 0))))){
move(_local1, _local2);
};
}
public function zoomIn():void{
mcLastTarget = mcTarget;
mcTarget = mcRef.centerMc;
nScale = 14;
bZooming = true;
}
public function changeTarget(_arg1:MovieClip):void{
mcTarget = _arg1;
}
private function resume(_arg1:Event=null):void{
bPaused = false;
}
private function pause(_arg1:Event=null):void{
bPaused = true;
}
public function zoomOut():void{
mcTarget = mcLastTarget;
nScale = 100;
bZooming = true;
}
}
}//package gameplay
Section 55
//CameraShaker (gameplay.CameraShaker)
package gameplay {
import flash.events.*;
import flash.display.*;
import library.interfaces.*;
import library.events.*;
public class CameraShaker implements Idestroyable {
private var nShakeAmp:Number;
private var nAngleStep:Number;
private var mcRef:MovieClip;
public static const nANGLE_DIVIDER:Number = 2;
public static const nMIN_AMPLITUDE:Number = 2;
public static const nMAX_AMPLITUDE:Number = 20;
public static const nAMPLITUDE_DECEL:Number = 0.8;
public function CameraShaker(_arg1:MovieClip){
mcRef = _arg1;
nShakeAmp = 0;
nAngleStep = 0;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function startShaking():void{
nShakeAmp = nMAX_AMPLITUDE;
nAngleStep = 1;
}
public function update(_arg1:Event):void{
if (nShakeAmp > 0){
moveBG();
setAmplitude();
nAngleStep++;
} else {
mcRef.y = 0;
};
}
private function setAmplitude():void{
nShakeAmp = (nShakeAmp * nAMPLITUDE_DECEL);
if (nShakeAmp < nMIN_AMPLITUDE){
nShakeAmp = 0;
};
}
public function destroy(_arg1:Event=null):void{
mcRef.y = 0;
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
private function moveBG():void{
var _local1:Number;
_local1 = 0;
_local1 = (Math.cos(((nAngleStep * Math.PI) / nANGLE_DIVIDER)) * nShakeAmp);
mcRef.y = _local1;
}
}
}//package gameplay
Section 56
//CollectibleManager (gameplay.CollectibleManager)
package gameplay {
import flash.events.*;
import flash.display.*;
import gameplay.items.*;
import library.events.*;
public class CollectibleManager {
private var aPoolBFF:Array;
private var oHud:Hud;
private var mcContainer:DisplayObjectContainer;
private var aPoolBFF2:Array;
private var nBFFTaken:Number;
private var aBFFWaves:Array;
private var nBFFAppeared:Number;
private var aPoolHairspray:Array;
private var aPoolHairpiece:Array;
private var oPlayer:Player;
private var aCollectibles:Array;
private var aPoolComb:Array;
public static const sTYPE_BFF:String = "bff";
public static const sTYPE_COMB:String = "comb";
public static const sTYPE_HAIRSPRAY:String = "hairspray";
public static const sTYPE_HAIRPIECE:String = "hairpiece";
public static const nSPAWN_SHIFT_UP:Number = -20;
public function CollectibleManager(_arg1:DisplayObjectContainer, _arg2:Hud, _arg3:Player){
mcContainer = _arg1;
oHud = _arg2;
oPlayer = _arg3;
aCollectibles = new Array();
aPoolComb = new Array();
aPoolHairpiece = new Array();
aPoolHairspray = new Array();
aPoolBFF = new Array();
aPoolBFF2 = new Array();
nBFFTaken = 0;
nBFFAppeared = 0;
aBFFWaves = new Array();
initBFFWaves();
oHud.setHeartState(Hud.sSTATE_HEART_IDLE);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function removeCollectible(_arg1:Collectible):void{
var _local2:int;
_local2 = (aCollectibles.length - 1);
while (_local2 >= 0) {
if (aCollectibles[_local2] == _arg1){
aCollectibles.splice(_local2, 1);
break;
};
_local2--;
};
}
public function addCollectible(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
var _local5:Collectible;
var _local6:Number;
_local5 = null;
_local6 = 0;
switch (_arg1){
case sTYPE_COMB:
_local5 = new Comb(null, mcContainer, _arg2, (_arg3 + nSPAWN_SHIFT_UP), mcCollectComb, aPoolComb, oPlayer.SpeedX, oPlayer.Direction, this);
break;
case sTYPE_HAIRPIECE:
_local5 = new Hairpiece(null, mcContainer, _arg2, (_arg3 + nSPAWN_SHIFT_UP), mcCollectHairPiece, aPoolHairpiece, oPlayer.SpeedX, oPlayer.Direction, this);
break;
case sTYPE_HAIRSPRAY:
_local5 = new Hairspray(null, mcContainer, _arg2, (_arg3 + nSPAWN_SHIFT_UP), mcCollectHairSpray, aPoolHairspray, oPlayer.SpeedX, oPlayer.Direction, this);
break;
};
aCollectibles.push(_local5);
Main.instance.gameManager.getCollisionManager.addObject(_local5, true);
if (_arg4){
if ((((nBFFAppeared < Data.nCOLLECTIBLE_MAX_BFF_PER_LEVEL)) && ((nBFFAppeared == nBFFTaken)))){
if (Main.instance.gameManager.WaveNo == aBFFWaves[nBFFAppeared]){
nBFFAppeared++;
if (nBFFTaken > 0){
_local5 = new BFFTattoo(null, mcContainer, _arg2, (_arg3 + nSPAWN_SHIFT_UP), mcCollectBFF2, aPoolBFF2, oPlayer.SpeedX, oPlayer.Direction, this);
} else {
_local5 = new BFFTattoo(null, mcContainer, _arg2, (_arg3 + nSPAWN_SHIFT_UP), mcCollectBFF, aPoolBFF, oPlayer.SpeedX, oPlayer.Direction, this);
};
aCollectibles.push(_local5);
Main.instance.gameManager.getCollisionManager.addObject(_local5, true);
};
};
};
}
public function blockHearts():void{
oHud.setHeartState(Hud.sSTATE_HEART_NOHEART);
}
public function takeBFFTattoo(_arg1:Array):void{
var _local2:int;
nBFFTaken++;
if (nBFFTaken == 1){
oHud.setHeartState(Hud.sSTATE_HEART_ONE);
};
if (nBFFTaken >= Data.nCOLLECTIBLE_MAX_BFF_PER_LEVEL){
Main.instance.oSoundPlayer.playBFFPowerUp();
oHud.setHeartState(Hud.sSTATE_HEART_BOTH);
Main.instance.gameManager.shakeCamera();
nBFFTaken = 0;
_local2 = 0;
while (_local2 < _arg1.length) {
_arg1[_local2].getBubbled();
_local2++;
};
};
}
private function initBFFWaves():void{
var _local1:Array;
var _local2:int;
var _local3:Number;
_local1 = new Array();
_local2 = 0;
_local3 = 0;
if (Data.nLEVEL_WAVES[(Data.nLEVEL - 1)] <= 1){
_local1.push(1);
_local1.push(1);
} else {
_local2 = 1;
while (_local2 <= Data.nLEVEL_WAVES[(Data.nLEVEL - 1)]) {
_local1.push(_local2);
_local2++;
};
};
_local2 = 0;
while (_local2 <= 1) {
_local3 = Math.floor((Math.random() * _local1.length));
aBFFWaves.push(_local1[_local3]);
_local1.splice(_local3, 1);
_local2++;
};
aBFFWaves.sort();
}
public function destroy(_arg1:Event):void{
aCollectibles.splice(0);
aPoolComb.splice(0);
aPoolHairpiece.splice(0);
aPoolHairspray.splice(0);
aPoolBFF.splice(0);
aPoolBFF2.splice(0);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
}
}//package gameplay
Section 57
//Enemy1 (gameplay.Enemy1)
package gameplay {
import flash.display.*;
import collisions.basic_class.*;
import library.interfaces.*;
public class Enemy1 extends Enemy implements Idestroyable {
public function Enemy1(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
nTIME_BUBBLE_IDLE = Data.nENEMY1_BUBBLE_TIME;
}
override public function makeJump(_arg1:String=""):void{
}
override protected function state_Die_init():void{
Main.instance.oSoundPlayer.stopEnemyAngryBubble();
Main.instance.oSoundPlayer.playEnemyDie();
Main.instance.gameManager.getCollectibleManager.addCollectible(CollectibleManager.sTYPE_HAIRPIECE, nPosX, nPosY);
}
}
}//package gameplay
Section 58
//Enemy2 (gameplay.Enemy2)
package gameplay {
import flash.display.*;
import collisions.basic_class.*;
import library.interfaces.*;
public class Enemy2 extends Enemy implements Idestroyable {
public function Enemy2(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
nTIME_BUBBLE_IDLE = Data.nENEMY2_BUBBLE_TIME;
}
override protected function state_Die_init():void{
Main.instance.oSoundPlayer.stopEnemyAngryBubble();
Main.instance.oSoundPlayer.playEnemyDie();
Main.instance.gameManager.getCollectibleManager.addCollectible(CollectibleManager.sTYPE_HAIRSPRAY, nPosX, nPosY);
}
}
}//package gameplay
Section 59
//Enemy2BFF (gameplay.Enemy2BFF)
package gameplay {
import flash.display.*;
import collisions.basic_class.*;
import library.interfaces.*;
public class Enemy2BFF extends Enemy implements Idestroyable {
public function Enemy2BFF(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
nTIME_BUBBLE_IDLE = Data.nENEMY2_BUBBLE_TIME;
}
override protected function state_Die_init():void{
Main.instance.oSoundPlayer.stopEnemyAngryBubble();
Main.instance.oSoundPlayer.playEnemyDie();
Main.instance.gameManager.getCollectibleManager.addCollectible(CollectibleManager.sTYPE_HAIRSPRAY, nPosX, nPosY, true);
}
}
}//package gameplay
Section 60
//Enemy3 (gameplay.Enemy3)
package gameplay {
import flash.display.*;
import collisions.basic_class.*;
import library.interfaces.*;
public class Enemy3 extends Enemy implements Idestroyable {
private var oPlayer:Player;
private var bChasing:Boolean;
public function Enemy3(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Class, _arg6:Array){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
nTIME_BUBBLE_IDLE = Data.nENEMY3_BUBBLE_TIME;
oPlayer = Main.instance.gameManager.getPlayer;
bChasing = false;
}
private function startChasing():void{
if (!bChasing){
bChasing = true;
setState(sSTATE_RUN);
};
}
override public function reverseDirection(_arg1:String=""):void{
if ((((sDirection == _arg1)) || ((_arg1 == "")))){
if (((((((bOnGround) && (!((state == sSTATE_JUMP))))) && (!(bChasing)))) && (!((state == sSTATE_BRAKE))))){
changeDirection();
};
};
}
override protected function state_Walk():void{
bChasing = false;
}
private function stopChasing():void{
if (bChasing){
bChasing = false;
if (state == sSTATE_RUN){
setState(sSTATE_BRAKE);
};
};
}
override protected function state_Fall_init():void{
bChasing = false;
Main.instance.oSoundPlayer.stopEnemyRun();
}
override public function makeJump(_arg1:String=""):void{
if (bOnGround){
if ((((_arg1 == "")) || ((_arg1 == sDirection)))){
if (((((!((state == sSTATE_JUMP))) && (!(bChasing)))) && (!((state == sSTATE_BRAKE))))){
setState(sSTATE_JUMP);
};
};
};
}
override protected function checkPursuit():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Boolean;
var _local5:Boolean;
if (bOnGround){
_local1 = Data.nENEMY3_PURSUIT_RANGE_X;
_local2 = 0;
_local3 = 0;
_local4 = false;
_local5 = false;
if (sDirection == sDIR_LEFT){
_local1 = (-1 * _local1);
};
_local3 = (nPosX + _local1);
_local2 = (nPosY - (mcRef.height / 2));
if (sDirection == sDIR_LEFT){
if ((((oPlayer.PosX <= nPosX)) && ((oPlayer.PosX >= _local3)))){
_local4 = true;
};
} else {
if ((((oPlayer.PosX >= nPosX)) && ((oPlayer.PosX <= _local3)))){
_local4 = true;
};
};
if ((((oPlayer.PosY <= (_local2 + Data.nENEMY3_PURSUIT_RANGE_Y))) && ((oPlayer.PosY >= (_local2 - Data.nENEMY3_PURSUIT_RANGE_Y))))){
_local5 = true;
};
if (((_local4) && (_local5))){
startChasing();
} else {
stopChasing();
};
};
}
override protected function state_Die_init():void{
Main.instance.oSoundPlayer.stopEnemyAngryBubble();
Main.instance.oSoundPlayer.playEnemyDie();
Main.instance.gameManager.getCollectibleManager.addCollectible(CollectibleManager.sTYPE_COMB, nPosX, nPosY);
}
override protected function state_Run():void{
super.state_Run();
checkPursuit();
}
override protected function state_Brake():void{
applyBrakeSpeed();
}
private function applyBrakeSpeed():void{
nSpdX = (nSpdX / Data.nENEMY_BRAKE_X);
if (Math.abs(nSpdX) < Data.nENEMY_MIN_SPEED_X){
nSpdX = 0;
};
if (nSpdX == 0){
setState(sSTATE_WALK);
};
}
override protected function setSpeedX():void{
if (bJumping){
nMaxSpeedX = Data.nENEMY_JUMP_SPEED_X;
} else {
if (bChasing){
nMaxSpeedX = Data.nENEMY_RUN_SPEED_X;
} else {
nMaxSpeedX = Data.nENEMY_BASE_SPEED_X;
};
};
}
}
}//package gameplay
Section 61
//Game (gameplay.Game)
package gameplay {
import flash.events.*;
import flash.display.*;
import collisions.basic_class.*;
import collisions.*;
import library.interfaces.*;
import library.utils.*;
import library.events.*;
import gameplay.Level.*;
public class Game extends EventDispatcher implements Idestroyable {
private var aEnemies:Array;
private var oHud:Hud;
private var aPoolEnemies2:Array;
private var aPoolEnemies3:Array;
private var oLevelBuilder:LevelBuilder;
private var aPoolEnemies1:Array;
private var mcRef:MovieClip;
private var oBGLevels:BGLevels;
private var oCollisionManager:CollisionManager;
private var nEnemiesReady:Number;
private var oPlayer:Player;
private var oTimeManager:TimeManager;
private var bmPauseData:BitmapData;
private var bUserQuit:Boolean;
private var oCameraShaker:CameraShaker;
private var aPoolEnemies2BFF:Array;
private var oCollectibleManager:CollectibleManager;
private var bmPause:Bitmap;
private var oLevelTimer:LevelTimer;
public var sGameStep:String;
private var oCamera:Camera;
private var oScoreManager:ScoreManager;
private var oDepthManager:DepthManager;
private var nEnemyWaveNo:Number;
public static const sDEPTH_COLLECTIBLES:String = "collectibles";
public static const sDEPTH_PAUSEBITMAP:String = "pauseBitmap";
public static const sDEPTH_ENEMIES:String = "enemies";
public static const sDEPTH_BUBBLES:String = "bubbles";
public static const sDEPTH_HUD:String = "hud";
public static const sDEPTH_PLAYER:String = "player";
public static const sDEPTH_BACKGROUND:String = "bg";
public static const sDEPTH_LEVELS:String = "levels";
public static var sSTEP_INITGAME:String = "step_initGame";
public static var sSTEP_WIN:String = "step_win";
public static var sSTEP_LOSELIFE:String = "step_loseLife";
public static var sSTEP_LOSE:String = "step_lose";
public static var sSTEP_CLOSE_POPUP:String = "step_closeLevelPopup";
public static var sSTEP_LEVELEND:String = "step_levelEnd";
public static var sSTEP_LETSPOPPIN_POPUP:String = "step_showLetsPoppinPopup";
public static var sSTEP_DROP:String = "step_dropEnemies";
public static var sSTEP_INIT_ENEMYWAVE:String = "step_initEnemyWave";
public static var sSTEP_STARTGAME:String = "step_startGame";
public static var sSTEP_SHOWTIPS:String = "step_showTips";
public static var sSTEP_LEVELUP:String = "step_levelUp";
public function Game(_arg1:MovieClip){
mcRef = _arg1;
oDepthManager = new DepthManager();
oDepthManager.addDepthLayer(sDEPTH_BACKGROUND, mcRef.mcGameContainer);
oDepthManager.addDepthLayer(sDEPTH_LEVELS, mcRef.mcGameContainer);
oDepthManager.addDepthLayer(sDEPTH_COLLECTIBLES, mcRef.mcGameContainer);
oDepthManager.addDepthLayer(sDEPTH_ENEMIES, mcRef.mcGameContainer);
oDepthManager.addDepthLayer(sDEPTH_BUBBLES, mcRef.mcGameContainer);
oDepthManager.addDepthLayer(sDEPTH_PLAYER, mcRef.mcGameContainer);
oDepthManager.addDepthLayer(sDEPTH_PAUSEBITMAP, mcRef);
oDepthManager.addDepthLayer(sDEPTH_HUD, mcRef);
sGameStep = sSTEP_INITGAME;
Main.instance.stage.focus = Main.instance.stage;
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_RESUME, resume, false, 0, true);
}
public function enemyReady():void{
nEnemiesReady++;
if (nEnemiesReady >= aEnemies.length){
nEnemiesReady = 0;
manageGameStep();
};
}
private function step_win():void{
Main.instance.transitTo(Main.sSTATE_WIN);
}
public function get getCollectibleManager():CollectibleManager{
return (oCollectibleManager);
}
public function get getCollisionManager():CollisionManager{
return (oCollisionManager);
}
private function step_showLetsPoppinPopup():void{
Main.instance.addPopup(Main.sPOPUP_POPPIN);
sGameStep = sSTEP_CLOSE_POPUP;
}
public function destroy(_arg1:Event=null):void{
dispatchEvent(new GameEvent(GameEvent.EVENT_DESTROY, false, false));
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
oCollectibleManager = null;
oCollisionManager = null;
oCamera = null;
destroyBitmap();
oDepthManager.destroy(null);
oDepthManager = null;
oScoreManager = null;
oTimeManager = null;
oCameraShaker = null;
oPlayer = null;
oHud = null;
mcRef = null;
}
private function step_showTips():void{
sGameStep = sSTEP_STARTGAME;
if ((((Data.nLEVEL >= 1)) && ((Data.nLEVEL <= 4)))){
pause();
Main.instance.addPopup(Main.sPOPUP_TIPS);
} else {
manageGameStep();
};
}
public function get WaveNo():Number{
return (nEnemyWaveNo);
}
private function step_lose():void{
pause(null, true);
Main.instance.oSoundPlayer.stopAllSFX();
Main.instance.transitTo(Main.sSTATE_LOSE);
}
private function step_closeLevelPopup():void{
Main.instance.popupLevel.close();
sGameStep = sSTEP_SHOWTIPS;
}
private function addHUD():void{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_HUD);
_local2 = new mcHUD();
_local1.addChild(_local2);
oHud = new Hud(_local2);
}
private function resume(_arg1:Event=null):void{
dispatchEvent(new GameEvent(GameEvent.EVENT_RESUME, false, false));
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
}
private function dropEnemies():void{
var _local1:int;
_local1 = 0;
while (_local1 < aEnemies.length) {
aEnemies[_local1].doAppear();
_local1++;
};
}
private function addLevelBuilder():void{
var _local1:DisplayObjectContainer;
_local1 = oDepthManager.getDepthLayer(sDEPTH_LEVELS);
oLevelBuilder = new LevelBuilder(_local1);
}
private function step_levelEnd():void{
if (nEnemyWaveNo < Data.nLEVEL_WAVES[(Data.nLEVEL - 1)]){
sGameStep = sSTEP_INIT_ENEMYWAVE;
} else {
oTimeManager.stopTimer();
oScoreManager.addTimeBonus(oTimeManager.Time);
sGameStep = sSTEP_LEVELUP;
};
oLevelTimer.startTimer();
}
private function step_initEnemyWave():void{
nEnemyWaveNo++;
oLevelBuilder.addEnemyWave();
sGameStep = sSTEP_STARTGAME;
dropEnemies();
}
private function step_startGame():void{
resume();
oPlayer.unlockControls();
startEnemies();
oTimeManager.startTimer();
sGameStep = sSTEP_LOSELIFE;
}
private function step_initGame():void{
initObject();
Main.instance.addPopup(Main.sPOPUP_LEVEL);
oTimeManager.setTimer(Data.nLEVEL_TIME[(Data.nLEVEL - 1)]);
}
public function takeBFFTattoo():void{
oCollectibleManager.takeBFFTattoo(aEnemies);
}
private function destroyBitmap():void{
var _local1:DisplayObjectContainer;
if (bmPauseData != null){
bmPauseData.dispose();
bmPauseData = null;
};
_local1 = oDepthManager.getDepthLayer(sDEPTH_PAUSEBITMAP);
if (bmPause != null){
if (_local1.contains(bmPause)){
_local1.removeChild(bmPause);
};
bmPause = null;
};
}
public function shakeCamera():void{
oCameraShaker.startShaking();
}
private function step_levelUp():void{
pause(null, true);
Main.instance.oSoundPlayer.stopAllSFX();
if (Data.nLEVEL >= Data.nMAX_LEVEL){
sGameStep = sSTEP_WIN;
manageGameStep();
} else {
Data.nLEVEL++;
Main.instance.transitTo(Main.sSTATE_GAME);
};
}
private function update(_arg1:Event):void{
dispatchEvent(new GameEvent(GameEvent.EVENT_UPDATE, false, false));
}
private function createBitmap():void{
var _local1:DisplayObjectContainer;
bmPauseData = new BitmapData(600, 400, false);
bmPauseData.draw(mcRef);
bmPause = new Bitmap(bmPauseData);
_local1 = oDepthManager.getDepthLayer(sDEPTH_PAUSEBITMAP);
_local1.addChild(bmPause);
}
private function step_dropEnemies():void{
if (oCollectibleManager == null){
oCollectibleManager = new CollectibleManager(oDepthManager.getDepthLayer(sDEPTH_COLLECTIBLES), oHud, oPlayer);
};
dropEnemies();
Main.instance.addPopup(Main.sPOPUP_READY);
sGameStep = sSTEP_LETSPOPPIN_POPUP;
}
public function get getPlayer():Player{
return (oPlayer);
}
public function get getScoreManager():ScoreManager{
return (oScoreManager);
}
public function killPlayer():void{
sGameStep = sSTEP_LOSE;
oPlayer.killPlayer();
}
public function quitGame():void{
bUserQuit = true;
Main.instance.transitTo(Main.sSTATE_LOSE);
}
public function manageGameStep():void{
var _local1 = this;
_local1[sGameStep]();
}
public function removeEnemy(_arg1:Enemy):void{
var _local2:int;
_local2 = (aEnemies.length - 1);
while (_local2 >= 0) {
if (aEnemies[_local2] == _arg1){
aEnemies.splice(_local2, 1);
break;
};
_local2--;
};
if (aEnemies.length <= 0){
if (((!(bUserQuit)) && ((Data.nPLAYER_LIVES > 0)))){
sGameStep = sSTEP_LEVELEND;
manageGameStep();
};
};
}
private function step_loseLife():void{
Data.nPLAYER_LIVES--;
if (Data.nPLAYER_LIVES <= 0){
Data.nPLAYER_LIVES = 0;
killPlayer();
};
}
public function addEnemy(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:DisplayObjectContainer;
var _local5:Enemy;
_local4 = oDepthManager.getDepthLayer(sDEPTH_ENEMIES);
_local5 = null;
switch (_arg1){
case 1:
_local5 = new Enemy1(null, _local4, _arg2, _arg3, mcEnemy1, aPoolEnemies1);
break;
case 2:
_local5 = new Enemy2(null, _local4, _arg2, _arg3, mcEnemy2, aPoolEnemies2);
break;
case 20:
_local5 = new Enemy2BFF(null, _local4, _arg2, _arg3, mcEnemy2BFF, aPoolEnemies2BFF);
break;
case 3:
_local5 = new Enemy3(null, _local4, _arg2, _arg3, mcEnemy3, aPoolEnemies3);
break;
};
oCollisionManager.addObject(_local5, true);
aEnemies.push(_local5);
}
private function startEnemies():void{
var _local1:int;
_local1 = 0;
while (_local1 < aEnemies.length) {
aEnemies[_local1].startWalking();
_local1++;
};
}
private function initObject():void{
aEnemies = new Array();
aPoolEnemies1 = new Array();
aPoolEnemies2 = new Array();
aPoolEnemies2BFF = new Array();
aPoolEnemies3 = new Array();
oLevelTimer = new LevelTimer();
nEnemyWaveNo = 1;
oCameraShaker = new CameraShaker(mcRef);
nEnemiesReady = 0;
bUserQuit = false;
addHUD();
oTimeManager = new TimeManager(oHud);
oScoreManager = new ScoreManager(oHud);
oBGLevels = new BGLevels(oDepthManager.getDepthLayer(sDEPTH_BACKGROUND));
oCollisionManager = new CollisionManager();
addLevelBuilder();
sGameStep = sSTEP_DROP;
}
public function addPlayer(_arg1:Number, _arg2:Number):void{
var _local3:DisplayObjectContainer;
_local3 = oDepthManager.getDepthLayer(sDEPTH_PLAYER);
oPlayer = new Player(null, _local3, oDepthManager.getDepthLayer(sDEPTH_BUBBLES), _arg1, _arg2, mcPlayer);
oCollisionManager.addObject(oPlayer, true);
oCamera = new Camera(mcRef.mcGameContainer, oPlayer.mcRef);
}
private function pause(_arg1:Event=null, _arg2:Boolean=false):void{
dispatchEvent(new GameEvent(GameEvent.EVENT_PAUSE, false, false));
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
if (_arg2){
createBitmap();
};
}
}
}//package gameplay
Section 62
//Hud (gameplay.Hud)
package gameplay {
import flash.events.*;
import flash.display.*;
import library.interfaces.*;
import library.utils.*;
import library.events.*;
public class Hud implements Idestroyable {
public var mcRef:MovieClip;
public static const sSTATE_HEART_NOHEART:String = "NoHeart";
public static const sSTATE_HEART_BOTH:String = "Both";
public static const sSTATE_HEART_ONE:String = "One";
public static const sSTATE_HEART_IDLE:String = "Idle";
public function Hud(_arg1:MovieClip){
mcRef = _arg1;
mcRef.btnMenu.addEventListener(MouseEvent.CLICK, onClick, false, 0, true);
mcRef.btnMenu.addEventListener(MouseEvent.ROLL_OVER, onRollOver, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function updateScore(_arg1:Number):void{
mcRef.txtScore.text = Tools.getFormatedNumber(_arg1, 0);
}
private function showLives():void{
mcRef.mcHudLives.txtLives.text = Data.nPLAYER_LIVES;
}
public function update(_arg1:Event):void{
showLives();
}
public function setHeartState(_arg1:String):void{
mcRef.mcHudBFF.mcHudBFFHearts.gotoAndStop(_arg1);
}
public function onRollOver(_arg1:MouseEvent):void{
Main.instance.oSoundPlayer.playButtonOver();
switch (_arg1.target){
default:
break;
};
}
public function destroy(_arg1:Event=null):void{
mcRef.btnMenu.removeEventListener(MouseEvent.CLICK, onClick, false);
mcRef.btnMenu.removeEventListener(MouseEvent.ROLL_OVER, onRollOver, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
public function updateTime(_arg1:String):void{
mcRef.txtTime.text = _arg1;
}
public function onClick(_arg1:MouseEvent):void{
Main.instance.oSoundPlayer.playButtonClick();
switch (_arg1.target){
case mcRef.btnMenu:
Main.instance.addPopup(Main.sPOPUP_MENU);
Main.instance.pauseGame();
break;
};
}
}
}//package gameplay
Section 63
//LevelBuilder (gameplay.LevelBuilder)
package gameplay {
import flash.events.*;
import flash.display.*;
import collisions.colliders.*;
import library.interfaces.*;
import library.events.*;
import gameplay.Level.*;
public class LevelBuilder implements Idestroyable {
private var aEnemiesProp:Array;
private var mcContainer:DisplayObjectContainer;
private var aPoolWalls:Array;
private var aPoolJumpLeft:Array;
private var aPoolCeilings:Array;
private var aPoolReverseRightPoints:Array;
private var aLevelItems:Array;
private var mcLevelsContainer:MovieClip;
private var aPoolJumpPoints:Array;
private var aPoolReverseLeftPoints:Array;
private var aPoolJumpRight:Array;
private var aPoolGrounds:Array;
public function LevelBuilder(_arg1:DisplayObjectContainer){
mcContainer = _arg1;
aPoolCeilings = new Array();
aPoolWalls = new Array();
aPoolGrounds = new Array();
aPoolReverseLeftPoints = new Array();
aPoolReverseRightPoints = new Array();
aPoolJumpPoints = new Array();
aPoolJumpLeft = new Array();
aPoolJumpRight = new Array();
aLevelItems = new Array();
aEnemiesProp = new Array();
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
buildLevel();
}
public function addEnemyWave():void{
var _local1:Number;
var _local2:int;
_local1 = 0;
_local2 = 0;
while (_local2 < aEnemiesProp.length) {
if (aEnemiesProp[_local2][0] == 0){
_local1 = getRandomEnemyType(Data.nLEVEL);
Main.instance.gameManager.addEnemy(_local1, aEnemiesProp[_local2][1], aEnemiesProp[_local2][2]);
} else {
if (aEnemiesProp[_local2][0] == 1){
Main.instance.gameManager.addEnemy(1, aEnemiesProp[_local2][1], aEnemiesProp[_local2][2]);
} else {
if (aEnemiesProp[_local2][0] == 2){
Main.instance.gameManager.addEnemy(2, aEnemiesProp[_local2][1], aEnemiesProp[_local2][2]);
} else {
if (aEnemiesProp[_local2][0] == 20){
Main.instance.gameManager.addEnemy(20, aEnemiesProp[_local2][1], aEnemiesProp[_local2][2]);
} else {
if (aEnemiesProp[_local2][0] == 3){
Main.instance.gameManager.addEnemy(3, aEnemiesProp[_local2][1], aEnemiesProp[_local2][2]);
};
};
};
};
};
_local2++;
};
}
public function destroy(_arg1:Event=null):void{
aEnemiesProp.splice(0);
aLevelItems.splice(0);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
private function readLevel():void{
var _local1:MovieClip;
var _local2:MovieClip;
var _local3:int;
_local1 = null;
_local2 = (mcLevelsContainer.getChildByName("mcLevel") as MovieClip);
_local3 = 0;
while (_local3 < _local2.numChildren) {
_local1 = (_local2.getChildAt(_local3) as MovieClip);
createItem(_local1);
_local3++;
};
mcLevelsContainer = null;
}
private function onLevelAdded(_arg1:Event):void{
if (_arg1.target == mcLevelsContainer.getChildByName("mcLevel")){
mcLevelsContainer.removeEventListener(Event.ADDED, onLevelAdded, false);
readLevel();
};
}
private function getRandomEnemyType(_arg1:Number):Number{
var _local2:Number;
var _local3:Array;
_local2 = 0;
_local3 = new Array();
switch (_arg1){
case 1:
_local3.push(1);
break;
case 2:
_local3.push(2);
_local3.push(20);
break;
case 3:
_local3.push(1);
_local3.push(2);
_local3.push(20);
break;
case 4:
_local3.push(1);
_local3.push(3);
break;
case 5:
_local3.push(2);
_local3.push(20);
_local3.push(3);
break;
case 6:
_local3.push(1);
_local3.push(2);
_local3.push(20);
_local3.push(3);
break;
};
_local2 = _local3[Math.floor((Math.random() * _local3.length))];
return (_local2);
}
private function buildLevel():void{
mcLevelsContainer = new mcLevels();
mcLevelsContainer.name = "mcLevelsContainer";
if (Data.nLEVEL > 1){
mcLevelsContainer.addEventListener(Event.ADDED, onLevelAdded, false, 0, true);
};
mcLevelsContainer.gotoAndStop(("level" + Data.nLEVEL));
if (Data.nLEVEL <= 1){
readLevel();
};
}
private function createItem(_arg1:MovieClip):void{
var _local2:ColliderItem;
var _local3:Number;
_local3 = 0;
if ((_arg1 is mcAllSideBlocker)){
_local2 = new WallAll(null, mcContainer, _arg1.x, _arg1.y, mcAllSideBlocker, aPoolWalls, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcWallLeft)){
_local2 = new WallLeft(null, mcContainer, _arg1.x, _arg1.y, mcWallLeft, aPoolWalls, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcWallRight)){
_local2 = new WallRight(null, mcContainer, _arg1.x, _arg1.y, mcWallRight, aPoolWalls, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcWallBottom)){
_local2 = new WallBottom(null, mcContainer, _arg1.x, _arg1.y, mcWallBottom, aPoolWalls, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcGround)){
_local2 = new Ground(null, mcContainer, _arg1.x, _arg1.y, mcGround, aPoolGrounds, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcCeiling)){
_local2 = new Ceiling(null, mcContainer, _arg1.x, _arg1.y, mcCeiling, aPoolCeilings, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcPlayerStart)){
Main.instance.gameManager.addPlayer(_arg1.x, _arg1.y);
} else {
if ((_arg1 is mcEnemyRandomStart)){
_local3 = getRandomEnemyType(Data.nLEVEL);
Main.instance.gameManager.addEnemy(_local3, _arg1.x, _arg1.y);
aEnemiesProp.push([0, _arg1.x, _arg1.y]);
} else {
if ((_arg1 is mcEnemy1Start)){
Main.instance.gameManager.addEnemy(1, _arg1.x, _arg1.y);
aEnemiesProp.push([1, _arg1.x, _arg1.y]);
} else {
if ((_arg1 is mcEnemy2Start)){
Main.instance.gameManager.addEnemy(2, _arg1.x, _arg1.y);
aEnemiesProp.push([2, _arg1.x, _arg1.y]);
} else {
if ((_arg1 is mcEnemy2BFFStart)){
Main.instance.gameManager.addEnemy(20, _arg1.x, _arg1.y);
aEnemiesProp.push([20, _arg1.x, _arg1.y]);
} else {
if ((_arg1 is mcEnemy3Start)){
Main.instance.gameManager.addEnemy(3, _arg1.x, _arg1.y);
aEnemiesProp.push([3, _arg1.x, _arg1.y]);
} else {
if ((_arg1 is mcReverseRightPoint)){
_local2 = new ReverseRightPoint(null, mcContainer, _arg1.x, _arg1.y, mcReverseRightPoint, aPoolReverseRightPoints, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcReverseLeftPoint)){
_local2 = new ReverseLeftPoint(null, mcContainer, _arg1.x, _arg1.y, mcReverseLeftPoint, aPoolReverseLeftPoints, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcJumpPoint)){
_local2 = new JumpPoint(null, mcContainer, _arg1.x, _arg1.y, mcJumpPoint, aPoolJumpPoints, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcJumpRight)){
_local2 = new JumpRight(null, mcContainer, _arg1.x, _arg1.y, mcJumpRight, aPoolJumpRight, _arg1.scaleX, _arg1.scaleY);
} else {
if ((_arg1 is mcJumpLeft)){
_local2 = new JumpLeft(null, mcContainer, _arg1.x, _arg1.y, mcJumpLeft, aPoolJumpLeft, _arg1.scaleX, _arg1.scaleY);
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
};
if (_local2 != null){
aLevelItems.push(_local2);
Main.instance.gameManager.getCollisionManager.addObject(_local2, true);
};
}
}
}//package gameplay
Section 64
//LevelTimer (gameplay.LevelTimer)
package gameplay {
import flash.events.*;
import library.interfaces.*;
import library.events.*;
public class LevelTimer implements Idestroyable {
private var nTime:Number;
public function LevelTimer(){
nTime = 0;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function destroy(_arg1:Event=null):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
public function update(_arg1:Event=null):void{
if (nTime > 0){
nTime--;
if (nTime <= 0){
Main.instance.gameManager.manageGameStep();
};
};
}
public function startTimer():void{
nTime = Data.nEND_LEVEL_TIME;
}
}
}//package gameplay
Section 65
//Player (gameplay.Player)
package gameplay {
import flash.events.*;
import flash.display.*;
import gameplay.items.*;
import collisions.colliders.*;
import collisions.events.*;
import collisions.basic_class.*;
import library.keys.*;
import library.interfaces.*;
import library.events.*;
public class Player extends Character implements Idestroyable {
private var bInvincible:Boolean;
private var bIsAttacked:Boolean;
private var bJumping:Boolean;
private var sDirection:String;
private var nMaxSpeedX:Number;
private var bOnGround:Boolean;
protected var oKeys:KeysManager;
private var oBubbleGenerator:BubbleGenerator;
private var nInvincibleTime:Number;
private var oSkinGenerator:SkinGenerator;
public static const sSTATE_JUMP_SWITCH:String = "JumpSwitch";
public static const sSTATE_ATTACK:String = "Attack";
public static const sSTATE_RUN:String = "Run";
public static const sDIR_LEFT:String = "Left";
public static const sSTATE_START_RUN:String = "StartRun";
public static const sSTATE_IDLE:String = "Idle";
public static const sDIR_RIGHT:String = "Right";
public static const sSTATE_HIDDEN:String = "Hidden";
public static const sSTATE_LAND:String = "Land";
public static const sSTATE_JUMP:String = "Jump";
private static const nFALL_RESET_Y:Number = -5;
public static const sSTATE_FALL:String = "Fall";
public static const sSTATE_DIE:String = "Die";
public function Player(_arg1:MovieClip, _arg2:DisplayObjectContainer, _arg3:DisplayObjectContainer, _arg4:Number, _arg5:Number, _arg6:Class){
super(_arg1, _arg2, _arg4, _arg5, _arg6);
oKeys = new KeysManager(mcRef);
oKeys.addKey(KeysManager.LEFT);
oKeys.addKey(KeysManager.RIGHT);
oKeys.addKey(KeysManager.UP);
oKeys.addKey(KeysManager.SPACE);
oKeys.addEventListener(KeyEvent.KEY_DOWN, onKeyDown, false, 0, true);
oKeys.addEventListener(KeyEvent.KEY_PRESSED, onKeyPressed, false, 0, true);
oKeys.addEventListener(KeyEvent.KEY_RELEASED, onKeyReleased, false, 0, true);
oKeys.disable();
oBubbleGenerator = new BubbleGenerator(_arg3, this);
oSkinGenerator = new SkinGenerator(this);
nMaxSpeedX = Data.nPLAYER_MAX_SPEED_X;
bJumping = false;
nSpdX = 0;
nSpdY = 0;
bOnGround = false;
sDirection = sDIR_RIGHT;
bIsAttacked = false;
nInvincibleTime = 0;
if (Data.bCHEATS){
bInvincible = true;
oSkinGenerator.activateInvincible();
} else {
bInvincible = false;
};
addState(sSTATE_IDLE, state_Idle, state_Idle_init);
addState(sSTATE_START_RUN, state_StartRun);
addState(sSTATE_RUN, state_Run);
addState(sSTATE_JUMP, state_Jump, state_Jump_init);
addState(sSTATE_JUMP_SWITCH, state_JumpSwitch);
addState(sSTATE_FALL, state_Fall, state_Fall_init);
addState(sSTATE_LAND, state_Land, state_Land_init);
addState(sSTATE_DIE, state_Die, state_Die_init);
addState(sSTATE_ATTACK, state_Attack, state_Attack_init);
addState(sSTATE_HIDDEN, state_Hidden);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
setDir(sDIR_RIGHT);
setState(sSTATE_IDLE);
}
override public function destroy(_arg1:Event=null):void{
super.destroy(_arg1);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
oKeys.removeEventListener(KeyEvent.KEY_DOWN, onKeyDown, false);
oKeys.removeEventListener(KeyEvent.KEY_PRESSED, onKeyPressed, false);
oKeys.removeEventListener(KeyEvent.KEY_RELEASED, onKeyReleased, false);
oKeys = null;
}
protected function onKeyPressed(_arg1:KeyEvent):void{
if (_arg1.nKey == KeysManager.SPACE){
reactToAttack();
};
}
private function checkFallHole():void{
if ((nPosY - mcRef.height) > Data.iSTAGE_HEIGHT){
nPosY = nFALL_RESET_Y;
};
}
public function unlockControls():void{
oKeys.enable();
}
override public function resume(_arg1:Event=null):void{
super.resume();
oKeys.enable();
}
private function setLeftSpeed():void{
setSpeedXWhenJumping();
if (nSpdX == 0){
nSpdX = (-1 * Data.nPLAYER_MIN_SPEED_X);
} else {
if (nSpdX > 0){
nSpdX = 0;
} else {
if (nSpdX < -(nMaxSpeedX)){
nSpdX = -(nMaxSpeedX);
} else {
if (nSpdX > -(nMaxSpeedX)){
if (bOnGround){
nSpdX = (nSpdX * Data.nPLAYER_ACCEL_X);
} else {
nSpdX = -(nMaxSpeedX);
};
if (nSpdX < -(nMaxSpeedX)){
nSpdX = -(nMaxSpeedX);
};
};
};
};
};
}
private function state_Jump_init():void{
bOnGround = false;
bJumping = true;
nSpdY = Data.nPLAYER_JUMP_SPEED;
Main.instance.oSoundPlayer.stopPlayerSFX();
}
private function state_Idle_init():void{
Main.instance.oSoundPlayer.stopPlayerSFX();
}
private function setSpeedXWhenJumping():void{
if (bJumping){
nMaxSpeedX = Data.nPLAYER_JUMP_SPEED_X;
} else {
nMaxSpeedX = Data.nPLAYER_MAX_SPEED_X;
};
}
private function state_Land_init():void{
Main.instance.oSoundPlayer.playPlayerLand();
}
private function state_Fall():void{
reactToLeftRight();
}
private function doFall():void{
if (state != sSTATE_ATTACK){
setState(sSTATE_FALL);
};
}
private function doStartFall():void{
if (state != sSTATE_ATTACK){
setState(sSTATE_JUMP_SWITCH);
};
}
private function checkInvincibleTime():void{
nInvincibleTime--;
if (nInvincibleTime <= 0){
nInvincibleTime = 0;
bInvincible = false;
oSkinGenerator.deactivateInvincible();
dispatchEvent(new EventMoveRequest(EventMoveRequest.ATTACHREQUEST, nRealMoveX, nRealMoveY, this));
};
}
protected function onKeyDown(_arg1:KeyEvent):void{
}
override public function update(_arg1:Event=null):void{
if (((!((state == sSTATE_HIDDEN))) && (!((state == sSTATE_DIE))))){
applyGravity();
doMove();
checkFallHole();
};
if (bInvincible){
if (!Data.bCHEATS){
checkInvincibleTime();
};
};
super.update(_arg1);
}
override public function setHitGround():void{
nSpdY = 0;
bOnGround = true;
if (((bInvincible) && ((nInvincibleTime <= 0)))){
if (!Data.bCHEATS){
bInvincible = false;
};
};
if ((((((state == sSTATE_JUMP)) || ((state == sSTATE_JUMP_SWITCH)))) || ((state == sSTATE_FALL)))){
if (((!((state == sSTATE_HIDDEN))) && (!((state == sSTATE_DIE))))){
bJumping = false;
setState(sSTATE_LAND);
};
};
}
private function setDir(_arg1:String):void{
sDirection = _arg1;
}
private function state_StartRun():void{
reactToControls();
if (stateComplete){
setState(sSTATE_RUN);
};
}
private function slowDownXSpeed():void{
nSpdX = 0;
}
private function state_Idle():void{
reactToControls();
}
private function state_Land():void{
reactToControls();
if (stateComplete){
setState(sSTATE_IDLE);
};
}
private function doMove():void{
setMaxMove();
applyMove();
}
override protected function resolveInstantHit(_arg1:Number, _arg2:Number, _arg3:ColliderItem):void{
oMovingItem = _arg3;
if ((((oMovingItem is Enemy)) || ((oMovingItem is Collectible)))){
doImpactResult();
};
}
private function applyGravity():void{
if (bOnGround == false){
if ((((nSpdY > 0)) && ((((((state == sSTATE_IDLE)) || ((state == sSTATE_START_RUN)))) || ((state == sSTATE_RUN)))))){
doFall();
} else {
if ((((((nSpdY > 0)) && (!((state == sSTATE_JUMP_SWITCH))))) && (!((state == sSTATE_FALL))))){
doStartFall();
} else {
if ((((((((nSpdY == Data.nPLAYER_MAX_SPEED_Y)) && (!((state == sSTATE_JUMP))))) && (!((state == sSTATE_JUMP_SWITCH))))) && (!((state == sSTATE_FALL))))){
doFall();
};
};
};
};
if (nSpdY > 0){
bOnGround = false;
};
if (nSpdY == 0){
if ((((((state == sSTATE_JUMP)) || ((state == sSTATE_JUMP_SWITCH)))) || ((state == sSTATE_FALL)))){
nSpdY = Data.nPLAYER_MIN_SPEED_Y;
} else {
nSpdY = Data.nPLAYER_MIN_FALL_SPEED_Y;
};
} else {
if (nSpdY < 0){
nSpdY = (nSpdY / Data.nPLAYER_DECEL_Y);
if (Math.abs(nSpdY) < Data.nPLAYER_MIN_SPEED_Y){
nSpdY = 0;
};
} else {
if (nSpdY < Data.nPLAYER_MAX_SPEED_Y){
nSpdY = (nSpdY * Data.nPLAYER_ACCEL_Y);
if (nSpdY > Data.nPLAYER_MAX_SPEED_Y){
nSpdY = Data.nPLAYER_MAX_SPEED_Y;
};
};
};
};
}
private function state_Fall_init():void{
Main.instance.oSoundPlayer.stopPlayerSFX();
}
public function get IsInvincible():Boolean{
return (bInvincible);
}
public function get SpeedX():Number{
return (nSpdX);
}
private function reactToLeftRight():void{
if (oKeys.isKeyDown(KeysManager.RIGHT)){
if (sDirection == "Left"){
changeDirection();
};
if (state == sSTATE_IDLE){
setState(sSTATE_START_RUN);
} else {
setRightSpeed();
};
} else {
if (oKeys.isKeyDown(KeysManager.LEFT)){
if (sDirection == "Right"){
changeDirection();
};
if (state == sSTATE_IDLE){
setState(sSTATE_START_RUN);
} else {
setLeftSpeed();
};
} else {
slowDownXSpeed();
if ((((state == sSTATE_START_RUN)) || ((state == sSTATE_RUN)))){
setState(sSTATE_IDLE);
};
};
};
}
override public function doImpactResult():void{
if ((oMovingItem is Bubble)){
if (sImpactSide == sIMPACT_DOWN){
if ((((state == sSTATE_JUMP_SWITCH)) || ((state == sSTATE_FALL)))){
makePlayerJump();
(oMovingItem as Bubble).popBubble(true, true);
} else {
(oMovingItem as Bubble).popBubble(true, false);
};
} else {
(oMovingItem as Bubble).popBubble(true, false);
};
} else {
if ((oMovingItem is Enemy)){
if ((((((oMovingItem.state == Enemy.sSTATE_BUBBLE_IDLE)) || ((oMovingItem.state == Enemy.sSTATE_HIT_BUBBLE)))) || ((oMovingItem.state == Enemy.sSTATE_ANGRY_BUBBLE)))){
(oMovingItem as Enemy).killEnemy();
} else {
if (oMovingItem.state != Enemy.sSTATE_APPEAR){
if (state == sSTATE_ATTACK){
(oMovingItem as Enemy).getBubbled();
setState(sSTATE_IDLE);
} else {
hurtPlayer();
};
};
};
} else {
if ((oMovingItem is Collectible)){
(oMovingItem as Collectible).setTaken();
};
};
};
}
private function reactToControls():void{
switch (state){
case sSTATE_ATTACK:
if (oKeys.isKeyDown(KeysManager.UP)){
setState(sSTATE_JUMP);
} else {
reactToLeftRight();
};
break;
case sSTATE_IDLE:
if (bOnGround){
if (oKeys.isKeyDown(KeysManager.UP)){
setState(sSTATE_JUMP);
} else {
reactToLeftRight();
};
};
break;
case sSTATE_START_RUN:
if (bOnGround){
if (oKeys.isKeyDown(KeysManager.UP)){
setState(sSTATE_JUMP);
} else {
reactToLeftRight();
};
};
break;
case sSTATE_RUN:
if (bOnGround){
if (oKeys.isKeyDown(KeysManager.UP)){
setState(sSTATE_JUMP);
} else {
reactToLeftRight();
};
};
break;
case sSTATE_LAND:
if (bOnGround){
if (oKeys.isKeyDown(KeysManager.UP)){
setState(sSTATE_JUMP);
};
};
break;
default:
break;
};
}
private function state_Jump():void{
reactToLeftRight();
}
public function makePlayerJump():void{
if ((((state == sSTATE_JUMP_SWITCH)) || ((state == sSTATE_FALL)))){
setState(sSTATE_JUMP);
};
}
private function state_Hidden():void{
}
private function reactToAttack():void{
setState(sSTATE_ATTACK);
}
protected function onKeyReleased(_arg1:KeyEvent):void{
}
public function get Direction():String{
return (sDirection);
}
private function state_Die_init():void{
Main.instance.oSoundPlayer.playPlayerDie();
}
private function setRightSpeed():void{
setSpeedXWhenJumping();
if (nSpdX == 0){
nSpdX = Data.nPLAYER_MIN_SPEED_X;
} else {
if (nSpdX < 0){
nSpdX = 0;
} else {
if (nSpdX > nMaxSpeedX){
nSpdX = nMaxSpeedX;
} else {
if (nSpdX < nMaxSpeedX){
if (bOnGround){
nSpdX = (nSpdX * Data.nPLAYER_ACCEL_X);
} else {
nSpdX = nMaxSpeedX;
};
if (nSpdX > nMaxSpeedX){
nSpdX = nMaxSpeedX;
};
};
};
};
};
}
private function state_JumpSwitch():void{
reactToLeftRight();
if (stateComplete){
setState(sSTATE_FALL);
};
}
private function changeDirection():void{
if (sDirection == sDIR_RIGHT){
sDirection = sDIR_LEFT;
} else {
sDirection = sDIR_RIGHT;
};
mcRef.scaleX = (-1 * mcRef.scaleX);
}
private function state_Die():void{
if (stateComplete){
Main.instance.gameManager.manageGameStep();
setState(sSTATE_HIDDEN);
};
}
private function state_Run():void{
reactToControls();
Main.instance.oSoundPlayer.playPlayerRun();
}
public function hurtPlayer():void{
if (((((!(bInvincible)) && (!((state == sSTATE_HIDDEN))))) && (!((state == sSTATE_DIE))))){
Main.instance.gameManager.manageGameStep();
if (Data.nPLAYER_LIVES > 0){
bInvincible = true;
Main.instance.oSoundPlayer.playPlayerHurt();
nInvincibleTime = Data.nPLAYER_INVINCIBLE_TIME;
oSkinGenerator.activateHurt();
};
};
}
private function state_Attack():void{
if (stateComplete){
oBubbleGenerator.addBubble();
if (bOnGround){
setState(sSTATE_IDLE);
} else {
setState(sSTATE_FALL);
};
} else {
if (bOnGround){
reactToControls();
} else {
reactToLeftRight();
};
};
}
private function state_Attack_init():void{
Main.instance.oSoundPlayer.playPlayerAttack();
}
public function killPlayer():void{
if (((!((state == sSTATE_DIE))) && (!((state == sSTATE_HIDDEN))))){
oKeys.disable();
setState(sSTATE_DIE);
};
}
override public function pause(_arg1:Event=null):void{
super.pause();
if (mcState != null){
mcState.stop();
};
oKeys.disable();
}
}
}//package gameplay
Section 66
//ScoreManager (gameplay.ScoreManager)
package gameplay {
import flash.events.*;
import library.interfaces.*;
import library.events.*;
public class ScoreManager implements Idestroyable {
protected var oHud:Hud;
public function ScoreManager(_arg1:Hud){
oHud = _arg1;
oHud.updateScore(Data.nSCORE);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function addPoints(_arg1:Number):void{
Data.nSCORE = (Data.nSCORE + _arg1);
if (Data.nSCORE < 0){
Data.nSCORE = 0;
};
if (oHud != null){
oHud.updateScore(Data.nSCORE);
};
}
public function addTimeBonus(_arg1:Number):void{
var _local2:Number;
if (_arg1 > 0){
_local2 = Math.floor((_arg1 / Data.iSTAGE_FPS));
Data.nSCORE = (Data.nSCORE + (Data.nPOINTS_BONUS_TIME * _local2));
if (oHud != null){
oHud.updateScore(Data.nSCORE);
};
};
}
public function destroy(_arg1:Event=null):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
oHud = null;
}
}
}//package gameplay
Section 67
//SkinGenerator (gameplay.SkinGenerator)
package gameplay {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import library.events.*;
public class SkinGenerator {
private var oWhiteColor:ColorTransform;
private var nHurtTime:Number;
private var nPatternFrame:Number;
private var oNormalColor:ColorTransform;
private var bActivated:Boolean;
private var mcContainer:MovieClip;
private var oRedColor:ColorTransform;
private var nPatternNo:Number;
private var aPatterns:Array;
private var oPlayer:Player;
public static const nINVINCIBLE_PATTERN:Number = 1;
public static const nHURT_PATTERN:Number = 0;
public function SkinGenerator(_arg1:Player){
oPlayer = _arg1;
mcContainer = oPlayer.mcRef;
aPatterns = new Array();
bActivated = false;
nPatternFrame = 0;
nPatternNo = -1;
nHurtTime = 0;
initColors();
initPatterns();
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function update(_arg1:Event):void{
if (bActivated){
playPattern();
checkHurtTime();
} else {
nPatternFrame = 0;
};
}
private function initPatterns():void{
var _local1:Array;
var _local2:Array;
_local1 = new Array();
_local1.push(oRedColor);
_local1.push(oRedColor);
_local1.push(oRedColor);
_local1.push(oNormalColor);
_local1.push(oNormalColor);
_local1.push(oNormalColor);
aPatterns.push(_local1);
_local2 = new Array();
_local2.push(oWhiteColor);
_local2.push(oWhiteColor);
_local2.push(oNormalColor);
_local2.push(oNormalColor);
_local2.push(oNormalColor);
aPatterns.push(_local2);
}
private function applyColor(_arg1:ColorTransform):void{
mcContainer.transform.colorTransform = _arg1;
}
public function destroy(_arg1:Event):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
public function activateHurt():void{
bActivated = true;
nHurtTime = Data.nPLAYER_HURTING_TIME;
nPatternNo = nHURT_PATTERN;
}
private function checkHurtTime():void{
nHurtTime--;
if (nHurtTime <= 0){
activateInvincible();
};
}
private function initColors():void{
oNormalColor = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
oRedColor = new ColorTransform(1, 0, 0, 1, 0, 0, 0, 0);
oWhiteColor = new ColorTransform(0.34, 0.34, 0.34, 1, 168, 168, 168, 0);
}
public function activateInvincible():void{
bActivated = true;
nPatternNo = nINVINCIBLE_PATTERN;
}
public function deactivateInvincible():void{
bActivated = false;
applyColor(oNormalColor);
}
private function playPattern():void{
if ((((nPatternNo >= 0)) && ((nPatternNo < aPatterns.length)))){
applyColor(aPatterns[nPatternNo][nPatternFrame]);
nPatternFrame++;
if (nPatternFrame >= aPatterns[nPatternNo].length){
nPatternFrame = 0;
};
};
}
}
}//package gameplay
Section 68
//TimeManager (gameplay.TimeManager)
package gameplay {
import flash.events.*;
import library.interfaces.*;
import library.events.*;
public class TimeManager implements Idestroyable {
private var oHud:Hud;
private var nTime:Number;
private var bGameEnded:Boolean;
private var nSECONDS_BY_MINUTE:Number;// = 60
private var bPaused:Boolean;
private var bStarted:Boolean;
public function TimeManager(_arg1:Hud){
nSECONDS_BY_MINUTE = 60;
super();
oHud = _arg1;
bStarted = false;
bPaused = false;
nTime = 0;
bGameEnded = false;
Main.instance.gameManager.addEventListener(GameEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_PAUSE, pause, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_RESUME, resume, false, 0, true);
Main.instance.gameManager.addEventListener(GameEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function setTimer(_arg1:Number):void{
nTime = _arg1;
showTime();
}
private function updateTime():void{
nTime--;
showTime();
if ((((nTime <= 0)) && (!(bGameEnded)))){
nTime = 0;
bGameEnded = true;
Main.instance.gameManager.killPlayer();
};
}
public function update(_arg1:Event):void{
if (((bStarted) && (!(bPaused)))){
updateTime();
};
}
public function startTimer():void{
bStarted = true;
}
public function stopTimer():void{
bStarted = false;
}
private function formatTime(_arg1:Number):String{
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:String;
_local2 = "";
_local3 = Math.floor((_arg1 / nSECONDS_BY_MINUTE));
_local4 = Math.floor((_arg1 - (_local3 * nSECONDS_BY_MINUTE)));
_local5 = "";
if (_local4 < 10){
_local5 = ("0" + _local4);
} else {
_local5 = _local4.toString();
};
_local2 = ((_local3 + ":") + _local5);
return (_local2);
}
private function showTime():void{
var _local1:Number;
_local1 = Math.floor((nTime / Data.iSTAGE_FPS));
if (_local1 >= 0){
if (oHud != null){
oHud.updateTime(formatTime(_local1));
};
};
}
private function resume(_arg1:Event=null):void{
bPaused = false;
}
public function get Time():Number{
return (nTime);
}
private function pause(_arg1:Event=null):void{
bPaused = true;
}
public function destroy(_arg1:Event=null):void{
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_UPDATE, update, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_PAUSE, pause, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_RESUME, resume, false);
Main.instance.gameManager.removeEventListener(GameEvent.EVENT_DESTROY, destroy, false);
}
}
}//package gameplay
Section 69
//wav (in_game.wav)
package in_game {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package in_game
Section 70
//ButtonWrapper (library.basic.ButtonWrapper)
package library.basic {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import library.interfaces.*;
public class ButtonWrapper extends StateManaged implements Idestroyable {
private var oNormalColor:ColorTransform;
private var oGreyColor:ColorTransform;
public function ButtonWrapper(_arg1:MovieClip):void{
super(_arg1);
oNormalColor = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
oGreyColor = new ColorTransform(0.36, 0.3, 0.32, 1, 100, 100, 100, 0);
}
public function enableButton(_arg1:DisplayObject, _arg2:Boolean):void{
if (_arg2){
_arg1.transform.colorTransform = oNormalColor;
(_arg1 as SimpleButton).enabled = true;
} else {
_arg1.transform.colorTransform = oGreyColor;
(_arg1 as SimpleButton).enabled = false;
};
}
public function onClick(_arg1:MouseEvent):void{
Main.instance.oSoundPlayer.playButtonClick();
}
protected function setButton(_arg1:DisplayObject, _arg2:Function, _arg3:Function, _arg4:Boolean=false):void{
if (_arg4 == false){
_arg1.addEventListener(MouseEvent.CLICK, _arg2, false, 0, true);
_arg1.addEventListener(MouseEvent.ROLL_OVER, _arg3, false, 0, true);
} else {
if (_arg1.stage != null){
_arg1.stage.focus = null;
};
_arg1.removeEventListener(MouseEvent.CLICK, _arg2, false);
_arg1.removeEventListener(MouseEvent.ROLL_OVER, _arg3, false);
};
}
public function onRollOver(_arg1:MouseEvent):void{
Main.instance.oSoundPlayer.playButtonOver();
}
public function destroy(_arg1:Event=null):void{
mcRef = null;
}
}
}//package library.basic
Section 71
//Popup (library.basic.Popup)
package library.basic {
import flash.display.*;
public class Popup extends ButtonWrapper {
public static const sSTATE_IDLE:String = "idle";
public static const sSTATE_APPEAR:String = "appear";
public static const sSTATE_DISAPPEAR:String = "disappear";
public function Popup(_arg1:MovieClip){
super(_arg1);
}
protected function state_idle():void{
}
protected function state_appear():void{
if (stateComplete){
setState(sSTATE_IDLE);
};
}
protected function state_disappear():void{
if (stateComplete){
Main.instance.removePopup(this);
};
}
public function close():void{
if (state == sSTATE_IDLE){
setState(sSTATE_DISAPPEAR);
};
}
}
}//package library.basic
Section 72
//Screen (library.basic.Screen)
package library.basic {
import flash.display.*;
public class Screen extends ButtonWrapper {
public function Screen(_arg1:MovieClip){
super(_arg1);
}
protected function initButton():void{
}
}
}//package library.basic
Section 73
//StateManaged (library.basic.StateManaged)
package library.basic {
import flash.events.*;
import flash.display.*;
public class StateManaged {
private var oStateFunction:Object;
private var sState:String;
private var bPaused:Boolean;
private var mcAsset:MovieClip;
public function StateManaged(_arg1:MovieClip){
mcAsset = _arg1;
bPaused = false;
oStateFunction = new Object();
}
public function set mcRef(_arg1:MovieClip):void{
mcAsset = _arg1;
}
public function update(_arg1:Event=null):void{
if (state != null){
if (oStateFunction[state].state != null){
oStateFunction[state].state();
};
};
}
public function get state():String{
return (sState);
}
public function setState(_arg1:String):void{
if (state != _arg1){
if (((!((state == null))) && (!((oStateFunction[state].unload == null))))){
oStateFunction[state].unload();
};
sState = _arg1;
if (mcRef != null){
mcRef.gotoAndStop(sState);
};
if (oStateFunction[state].load != null){
if (mcRef.getChildByName("mcState") == null){
mcRef.addEventListener(Event.ADDED, onAdded);
} else {
oStateFunction[sState].load();
};
};
};
}
public function get mcState():MovieClip{
return ((mcRef.getChildByName("mcState") as MovieClip));
}
public function set paused(_arg1:Boolean):void{
bPaused = _arg1;
}
public function get mcRef():MovieClip{
return (mcAsset);
}
protected function onAdded(_arg1:Event):void{
if (oStateFunction[sState].load != null){
if (_arg1.target == mcRef.getChildByName("mcState")){
mcRef.removeEventListener(Event.ADDED, onAdded);
oStateFunction[sState].load();
};
};
}
public function get stateComplete():Boolean{
var _local1:Boolean;
_local1 = false;
if (mcRef.mcState != null){
if (mcRef.mcState.currentFrame >= mcRef.mcState.totalFrames){
_local1 = true;
};
};
return (_local1);
}
public function resume(_arg1:Event=null):void{
bPaused = false;
if (mcState != null){
mcState.play();
};
}
public function get paused():Boolean{
return (bPaused);
}
public function pause(_arg1:Event=null):void{
bPaused = true;
if (mcState != null){
mcState.stop();
};
}
public function addState(_arg1:String, _arg2:Function, _arg3:Function=null, _arg4:Function=null):void{
oStateFunction[_arg1] = {load:_arg3, state:_arg2, unload:_arg4};
}
}
}//package library.basic
Section 74
//Transition (library.basic.Transition)
package library.basic {
import flash.events.*;
import flash.display.*;
import library.events.*;
public class Transition extends StateManaged implements IEventDispatcher {
private var oEventDisp:EventDispatcher;
private static const sSTATE_DISAPPEAR:String = "disappear";
private static const sSTATE_APPEAR:String = "appear";
public function Transition(_arg1:MovieClip){
super(_arg1);
oEventDisp = new EventDispatcher(this);
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
setState(sSTATE_APPEAR);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
}
public function dispatchEvent(_arg1:Event):Boolean{
return (oEventDisp.dispatchEvent(_arg1));
}
private function state_appear():void{
if (stateComplete){
dispatchEvent(new TransitionEvent(TransitionEvent.EVENT_FULL_SCREEN, false));
setState(sSTATE_DISAPPEAR);
};
}
public function willTrigger(_arg1:String):Boolean{
return (oEventDisp.willTrigger(_arg1));
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
oEventDisp.removeEventListener(_arg1, _arg2, _arg3);
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
Main.instance.oSoundPlayer.playTransitionIn();
break;
case sSTATE_DISAPPEAR:
Main.instance.oSoundPlayer.playTransitionOut();
break;
};
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
oEventDisp.addEventListener(_arg1, _arg2, _arg3, _arg4);
}
private function state_disappear():void{
if (stateComplete){
dispatchEvent(new TransitionEvent(TransitionEvent.EVENT_COMPLETE, false));
};
}
public function destroy(_arg1:Event):void{
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
mcRef = null;
}
public function hasEventListener(_arg1:String):Boolean{
return (oEventDisp.hasEventListener(_arg1));
}
}
}//package library.basic
Section 75
//GameEvent (library.events.GameEvent)
package library.events {
import flash.events.*;
public class GameEvent extends Event {
public static const EVENT_PAUSE:String = "pause";
public static const EVENT_DESTROY:String = "destroy";
public static const EVENT_RESUME:String = "resume";
public static const EVENT_UPDATE:String = "update";
public function GameEvent(_arg1:String, _arg2:Boolean, _arg3:Boolean){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("GameEvent", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new GameEvent(type, bubbles, cancelable));
}
}
}//package library.events
Section 76
//MainEvent (library.events.MainEvent)
package library.events {
import flash.events.*;
public class MainEvent extends Event {
public static const EVENT_PAUSE:String = "pause";
public static const EVENT_DESTROY:String = "destroy";
public static const EVENT_RESUME:String = "resume";
public static const EVENT_UPDATE:String = "update";
public function MainEvent(_arg1:String, _arg2:Boolean, _arg3:Boolean){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("MainEvent", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new MainEvent(type, bubbles, cancelable));
}
}
}//package library.events
Section 77
//TransitionEvent (library.events.TransitionEvent)
package library.events {
import flash.events.*;
public class TransitionEvent extends Event {
public static const EVENT_COMPLETE:String = "complete";
public static const EVENT_FULL_SCREEN:String = "full";
public function TransitionEvent(_arg1:String, _arg2:Boolean, _arg3:Boolean=true){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("TransitionEvent", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
return (new TransitionEvent(type, bubbles, cancelable));
}
}
}//package library.events
Section 78
//Idestroyable (library.interfaces.Idestroyable)
package library.interfaces {
import flash.events.*;
public interface Idestroyable {
function destroy(_arg1:Event=null):void;
}
}//package library.interfaces
Section 79
//KeyEvent (library.keys.KeyEvent)
package library.keys {
import flash.events.*;
public class KeyEvent extends Event {
public var nKey:Number;
public static const KEY_PRESSED:String = "pressed";
public static const KEY_DOWN:String = "down";
public static const KEY_RELEASED:String = "released";
public function KeyEvent(_arg1:String, _arg2:Number){
super(_arg1);
nKey = _arg2;
}
override public function toString():String{
return (formatToString("KeyEvent", "type", "bubbles", "cancelable", "eventPhase", "nKey"));
}
override public function clone():Event{
return (new KeyEvent(type, nKey));
}
}
}//package library.keys
Section 80
//KeysManager (library.keys.KeysManager)
package library.keys {
import flash.events.*;
import flash.display.*;
public class KeysManager extends EventDispatcher {
private var aKeyMap:Array;
private var iNumKeyOn:int;
private var aKeyDown:Array;
private var nKeyNextId:Number;
private var spParent:Sprite;
private var bAnyKeyPress:Boolean;
private var aKeyId:Array;
private var bEnabled:Boolean;
public static const COMA:Number = 188;
public static const PAUSE:uint = 19;
public static const ESCAPE:Number = 27;
public static const LEFT:uint = 37;
public static const NUMBER_3_NUMPAD:uint = 99;
public static const CIRC:Number = 219;
public static const PGDOWN:uint = 34;
public static const DASH:Number = 189;
public static const NUMBER_2_NUMPAD:uint = 98;
public static const NUMPAD_DOT:Number = 110;
public static const PRINTSCREEN:uint = 44;
public static const A:uint = 65;
public static const B:uint = 66;
public static const C:uint = 67;
public static const D:uint = 68;
public static const E:uint = 69;
public static const F:uint = 70;
public static const G:uint = 71;
public static const H:uint = 72;
public static const I:uint = 73;
public static const J:uint = 74;
public static const K:uint = 75;
public static const L:uint = 76;
public static const M:uint = 77;
public static const N:uint = 78;
public static const O:uint = 79;
public static const P:uint = 80;
public static const Q:uint = 81;
public static const R:uint = 82;
public static const S:uint = 83;
public static const T:uint = 84;
public static const U:uint = 85;
public static const V:uint = 86;
public static const W:uint = 87;
public static const X:uint = 88;
public static const Y:uint = 89;
public static const Z:uint = 90;
public static const NUMPAD_PLUS:Number = 107;
public static const NUMBER_1_NUMPAD:uint = 97;
public static const NUMBER_9_NUMPAD:uint = 105;
public static const NUMBER_8_NUMPAD:uint = 104;
public static const CTRL:uint = 17;
public static const NUMBER_0_NUMPAD:uint = 96;
public static const TAB:uint = 9;
public static const QUOTES:Number = 226;
public static const AGRAVE:Number = 220;
public static const BACKSPACE:uint = 8;
public static const CAPSLOCK:uint = 20;
public static const UP:uint = 38;
public static const WINDOWS_L:Number = 91;
public static const NUMBER_7_NUMPAD:uint = 103;
public static const SCROLLLOCK:uint = 145;
public static const NUMPAD_DIVIDE:Number = 111;
public static const F3:uint = 114;
public static const F5:uint = 116;
public static const F7:uint = 118;
public static const F4:uint = 115;
public static const SHIFT:uint = 16;
public static const F6:uint = 117;
public static const ENTER:uint = 13;
public static const F8:uint = 119;
public static const NUMBER_0:uint = 48;
public static const NUMBER_6_NUMPAD:uint = 102;
public static const NUMBER_2:uint = 50;
public static const NUMBER_3:uint = 51;
public static const NUMBER_4:uint = 52;
public static const NUMBER_5:uint = 53;
public static const NUMBER_6:uint = 54;
public static const NUMBER_7:uint = 55;
public static const NUMBER_1:uint = 49;
public static const NUMBER_9:uint = 57;
public static const F2:uint = 113;
public static const CEDIL:Number = 221;
public static const EGRAVE:Number = 192;
public static const PERIOD:Number = 190;
public static const NUMBER_8:uint = 56;
public static const NUMBER_5_NUMPAD:uint = 101;
public static const DOWN:uint = 40;
public static const INSERT:uint = 45;
public static const PGUP:uint = 33;
public static const END:uint = 35;
public static const F9:uint = 120;
public static const NUMPAD_MULTIPLY:Number = 106;
public static const SEMICOLON:Number = 186;
public static const F1:uint = 112;
public static const NUMPAD_MINUS:Number = 109;
public static const HOME:uint = 36;
public static const EQUALS:Number = 187;
public static const SHARP:Number = 222;
public static const MENU:Number = 93;
public static const F10:uint = 121;
public static const F11:uint = 122;
public static const F12:uint = 123;
public static const WINDOWS_R:Number = 92;
public static const ALT:uint = 18;
public static const SPACE:uint = 32;
public static const NUMBER_4_NUMPAD:uint = 100;
public static const DELETE:uint = 46;
public static const NUMLOCK:uint = 144;
public static const RIGHT:uint = 39;
public static const EACUTE:Number = 191;
public function KeysManager(_arg1:Sprite){
spParent = _arg1;
nKeyNextId = 0;
bAnyKeyPress = false;
aKeyId = new Array();
aKeyMap = new Array();
aKeyDown = new Array();
iNumKeyOn = 0;
spParent.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown, false, 0, true);
spParent.stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp, false, 0, true);
enable();
}
public function enable():void{
bEnabled = true;
}
public function addSpecialKeys():void{
addKey(KeysManager.SPACE);
addKey(KeysManager.BACKSPACE);
addKey(KeysManager.ENTER);
addKey(KeysManager.END);
addKey(KeysManager.HOME);
addKey(KeysManager.INSERT);
addKey(KeysManager.DELETE);
addKey(KeysManager.PGDOWN);
addKey(KeysManager.PGUP);
addKey(KeysManager.ALT);
addKey(KeysManager.CTRL);
addKey(KeysManager.CAPSLOCK);
addKey(KeysManager.SHIFT);
addKey(KeysManager.ESCAPE);
addKey(KeysManager.TAB);
addKey(KeysManager.WINDOWS_R);
addKey(KeysManager.WINDOWS_L);
addKey(KeysManager.MENU);
addKey(KeysManager.PRINTSCREEN);
addKey(KeysManager.SCROLLLOCK);
addKey(KeysManager.NUMLOCK);
addKey(KeysManager.PAUSE);
}
private function onKeyDown(_arg1:KeyboardEvent):void{
var _local2:Number;
var _local3:String;
var _local4:Number;
_local2 = _arg1.keyCode;
_local3 = String(_local2);
_local4 = aKeyId[_local3];
if (bEnabled){
if (aKeyId[_local3] != null){
if (aKeyDown[_local4] == null){
aKeyDown[_local4] = false;
};
if (!aKeyDown[_local4]){
dispatchEvent(new KeyEvent(KeyEvent.KEY_PRESSED, _local2));
iNumKeyOn++;
};
aKeyDown[_local4] = true;
dispatchEvent(new KeyEvent(KeyEvent.KEY_DOWN, _local2));
};
};
}
public function addArrowKeys():void{
addKey(KeysManager.UP);
addKey(KeysManager.DOWN);
addKey(KeysManager.LEFT);
addKey(KeysManager.RIGHT);
}
public function addLetterKeys():void{
addKey(KeysManager.A);
addKey(KeysManager.B);
addKey(KeysManager.C);
addKey(KeysManager.D);
addKey(KeysManager.E);
addKey(KeysManager.F);
addKey(KeysManager.G);
addKey(KeysManager.H);
addKey(KeysManager.I);
addKey(KeysManager.J);
addKey(KeysManager.K);
addKey(KeysManager.L);
addKey(KeysManager.M);
addKey(KeysManager.N);
addKey(KeysManager.O);
addKey(KeysManager.P);
addKey(KeysManager.Q);
addKey(KeysManager.R);
addKey(KeysManager.S);
addKey(KeysManager.T);
addKey(KeysManager.U);
addKey(KeysManager.V);
addKey(KeysManager.W);
addKey(KeysManager.X);
addKey(KeysManager.Y);
addKey(KeysManager.Z);
}
public function isKeyDown(_arg1:uint):Boolean{
var _local2:Boolean;
var _local3:String;
var _local4:Number;
_local2 = false;
if (bEnabled){
_local3 = String(_arg1);
_local4 = aKeyId[_local3];
if (aKeyId[_local3] != null){
if (aKeyDown[_local4]){
_local2 = true;
};
};
};
return (_local2);
}
public function deleteObject():void{
spParent.stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown, false);
spParent.stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp, false);
clearAllKeys();
}
public function addOperatorKeys():void{
addKey(KeysManager.NUMPAD_DIVIDE);
addKey(KeysManager.NUMPAD_MULTIPLY);
addKey(KeysManager.NUMPAD_MINUS);
addKey(KeysManager.NUMPAD_PLUS);
addKey(KeysManager.NUMPAD_DOT);
addKey(KeysManager.SHARP);
addKey(KeysManager.DASH);
addKey(KeysManager.EQUALS);
}
private function onKeyUp(_arg1:KeyboardEvent):void{
var _local2:Number;
var _local3:String;
var _local4:Number;
_local2 = _arg1.keyCode;
_local3 = String(_local2);
_local4 = aKeyId[_local3];
if (bEnabled){
if (aKeyId[_local3] != null){
aKeyDown[_local4] = false;
iNumKeyOn--;
dispatchEvent(new KeyEvent(KeyEvent.KEY_RELEASED, _local2));
};
};
}
public function addNumericKeys():void{
addKey(KeysManager.NUMBER_0_NUMPAD);
addKey(KeysManager.NUMBER_1_NUMPAD);
addKey(KeysManager.NUMBER_2_NUMPAD);
addKey(KeysManager.NUMBER_3_NUMPAD);
addKey(KeysManager.NUMBER_4_NUMPAD);
addKey(KeysManager.NUMBER_5_NUMPAD);
addKey(KeysManager.NUMBER_6_NUMPAD);
addKey(KeysManager.NUMBER_7_NUMPAD);
addKey(KeysManager.NUMBER_8_NUMPAD);
addKey(KeysManager.NUMBER_9_NUMPAD);
addKey(KeysManager.NUMBER_0);
addKey(KeysManager.NUMBER_1);
addKey(KeysManager.NUMBER_2);
addKey(KeysManager.NUMBER_3);
addKey(KeysManager.NUMBER_4);
addKey(KeysManager.NUMBER_5);
addKey(KeysManager.NUMBER_6);
addKey(KeysManager.NUMBER_7);
addKey(KeysManager.NUMBER_8);
addKey(KeysManager.NUMBER_9);
}
public function addAllKeys():void{
addLetterKeys();
addSpecialKeys();
addOperatorKeys();
addPunctuationKeys();
addFunctionKeys();
addNumericKeys();
addArrowKeys();
}
public function addPunctuationKeys():void{
addKey(KeysManager.CIRC);
addKey(KeysManager.CEDIL);
addKey(KeysManager.SEMICOLON);
addKey(KeysManager.EGRAVE);
addKey(KeysManager.AGRAVE);
addKey(KeysManager.COMA);
addKey(KeysManager.PERIOD);
addKey(KeysManager.EACUTE);
addKey(KeysManager.QUOTES);
}
public function disable():void{
var _local1:int;
bEnabled = false;
_local1 = 0;
while (_local1 < aKeyDown.length) {
aKeyDown[_local1] = false;
_local1++;
};
}
public function addKey(_arg1:uint):void{
aKeyId[String(_arg1)] = nKeyNextId;
aKeyMap[nKeyNextId] = _arg1;
aKeyDown[nKeyNextId] = false;
nKeyNextId++;
}
public function addFunctionKeys():void{
addKey(KeysManager.F1);
addKey(KeysManager.F2);
addKey(KeysManager.F3);
addKey(KeysManager.F4);
addKey(KeysManager.F5);
addKey(KeysManager.F6);
addKey(KeysManager.F7);
addKey(KeysManager.F8);
addKey(KeysManager.F9);
addKey(KeysManager.F10);
addKey(KeysManager.F11);
addKey(KeysManager.F12);
}
public function clearAllKeys():void{
aKeyMap.splice(0);
aKeyId.splice(0);
aKeyDown.splice(0);
iNumKeyOn = 0;
}
}
}//package library.keys
Section 81
//SoundItem (library.sounds.SoundItem)
package library.sounds {
import flash.events.*;
import flash.media.*;
public class SoundItem extends Sound {
private var nFadeRate:Number;
private var sCategory:String;
private var oSndTransform:SoundTransform;
private var bMustRestartAfterLooped:Boolean;
private var nCurrentTime:Number;
private var nTargetVolume:Number;
private var nCurrentVolume:Number;
private var bMuted:Boolean;
private var oSndChannel:SoundChannel;
private var fLaunchAfterEnd:Function;
private var nLoop:Number;
private var bPaused:Boolean;
private var bStopAfterPan:Boolean;
private var sndObj:Sound;
private var nPanRate:Number;
private var bStopAfterFade:Boolean;
public var bIsPlaying:Boolean;
public var sLinkage:String;
private var nCurrentPan:Number;
private var nTargetPan:Number;
private static const FADE_RATE:Number = 0.08;
private static const PAN_RATE:Number = 0.08;
private static const FADE_AT_END_TIME:Number = 800;
public function SoundItem(_arg1:Sound, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:Function=null){
sndObj = _arg1;
bIsPlaying = false;
sLinkage = _arg2;
nLoop = _arg4;
nFadeRate = FADE_RATE;
nPanRate = PAN_RATE;
sCategory = _arg6;
nCurrentVolume = _arg3;
nTargetVolume = _arg3;
oSndTransform = new SoundTransform(returnComputedVolume(nCurrentVolume));
oSndTransform.pan = _arg5;
nCurrentPan = _arg5;
nTargetPan = _arg5;
fLaunchAfterEnd = _arg7;
bStopAfterFade = false;
bStopAfterPan = false;
bMuted = false;
bPaused = false;
bMustRestartAfterLooped = false;
}
public function get category():String{
return (sCategory);
}
private function manageFade():void{
if (nCurrentVolume != nTargetVolume){
nCurrentVolume = getReachNum(nCurrentVolume, nTargetVolume, nFadeRate);
updateSound();
};
if ((((nCurrentVolume <= 0)) && (bStopAfterFade))){
doStop();
};
}
private function getReachNum(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
_local4 = _arg1;
if (_local4 != _arg2){
if (_local4 < _arg2){
_local4 = (_local4 + _arg3);
if (_local4 > _arg2){
_local4 = _arg2;
};
} else {
_local4 = (_local4 - _arg3);
if (_local4 < _arg2){
_local4 = _arg2;
};
};
};
return (_local4);
}
public function unMute():void{
bMuted = false;
updateSound();
}
public function panTo(_arg1:Number, _arg2:Boolean=true):void{
bStopAfterPan = _arg2;
nTargetPan = _arg1;
}
public function setFadeRate(_arg1:Number=0.08):void{
nFadeRate = _arg1;
}
public function fadeTo(_arg1:Number, _arg2:Boolean=true):void{
bStopAfterFade = _arg2;
nTargetVolume = _arg1;
}
public function get volume():Number{
return (oSndTransform.volume);
}
public function get pan():Number{
return (oSndTransform.pan);
}
public function doStop():void{
oSndChannel.stop();
bIsPlaying = false;
SoundManager.cleanUpSound(this);
}
public function mute():void{
bMuted = true;
updateSound();
}
public function set pan(_arg1:Number):void{
oSndTransform.pan = _arg1;
}
public function set volume(_arg1:Number):void{
oSndTransform.volume = returnComputedVolume(_arg1);
oSndChannel.soundTransform = oSndTransform;
}
public function resume():void{
if (bPaused){
bPaused = false;
if (bMustRestartAfterLooped){
if (nCurrentTime > sndObj.length){
nCurrentTime = (nCurrentTime - sndObj.length);
};
oSndChannel = sndObj.play(nCurrentTime, 1, oSndTransform);
} else {
oSndChannel = sndObj.play(nCurrentTime, nLoop, oSndTransform);
};
oSndChannel.addEventListener(Event.SOUND_COMPLETE, onSoundCompleted);
};
}
private function managePan():void{
if (nCurrentPan != nTargetPan){
nCurrentPan = getReachNum(nCurrentPan, nTargetPan, nPanRate);
updateSound();
} else {
if (bStopAfterPan){
doStop();
};
};
}
private function onSoundCompleted(_arg1:Event):void{
if (bMustRestartAfterLooped){
doPlay();
} else {
if (fLaunchAfterEnd != null){
fLaunchAfterEnd();
};
bIsPlaying = false;
SoundManager.cleanUpSound(this);
};
}
public function updateSound():void{
oSndTransform.volume = returnComputedVolume(nCurrentVolume);
oSndTransform.pan = nCurrentPan;
oSndChannel.soundTransform = oSndTransform;
}
public function update():void{
if (!bPaused){
manageFade();
managePan();
};
}
public function get linkage():String{
return (sLinkage);
}
private function returnComputedVolume(_arg1:Number):Number{
var _local2:Number;
if (((!(bMuted)) && (!(SoundManager.isCategoryMuted(sCategory))))){
_local2 = _arg1;
_local2 = (_local2 * SoundManager.getCategoryVolume(sCategory));
_local2 = (_local2 * SoundManager.MasterVolume);
} else {
_local2 = 0;
};
return (_local2);
}
public function doPlay():void{
bIsPlaying = true;
oSndChannel = sndObj.play(0, nLoop, oSndTransform);
oSndChannel.addEventListener(Event.SOUND_COMPLETE, onSoundCompleted, false, 0, true);
}
public function setPanRate(_arg1:Number=0.08):void{
nPanRate = _arg1;
}
public function pause():void{
if (!bPaused){
nCurrentTime = oSndChannel.position;
if (nLoop > 1){
bMustRestartAfterLooped = true;
};
oSndChannel.stop();
bPaused = true;
};
}
}
}//package library.sounds
Section 82
//SoundManager (library.sounds.SoundManager)
package library.sounds {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class SoundManager {
private static var aSounds:Array;
private static var aAvailableSounds:Array;
private static var sDEFAULT_CATEGORY:String = "sfx";
private static var mcRef:Sprite;
private static var nSoundNum:Number;
private static var aSoundCategories:Array;
private static var bInited:Boolean = false;
private static var nMasterVolume:Number;
public static function resumeAllSoundsInCat(_arg1:String):void{
var _local2:String;
for (_local2 in aSounds) {
if (aSounds[_local2].category == _arg1){
aSounds[_local2].resume();
};
};
}
public static function pauseAllSoundsInCat(_arg1:String):void{
var _local2:String;
for (_local2 in aSounds) {
if (aSounds[_local2].category == _arg1){
aSounds[_local2].pause();
};
};
}
public static function isCategoryMuted(_arg1:String):Boolean{
var _local2:Boolean;
var _local3:String;
for (_local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == _arg1){
_local2 = aSoundCategories[_local3].bMuted;
};
};
return (_local2);
}
public static function doMuteCategory(_arg1:String):void{
var _local2:String;
for (_local2 in aSoundCategories) {
if (aSoundCategories[_local2].sName == _arg1){
aSoundCategories[_local2].bMuted = true;
};
};
updateAllSoundsVolume();
}
public static function update(_arg1:Event):void{
var _local2:String;
for (_local2 in aSounds) {
aSounds[_local2].update();
};
}
public static function init():void{
if (!bInited){
bInited = true;
nSoundNum = 0;
aSounds = new Array();
aSoundCategories = new Array();
nMasterVolume = 1;
addCategory(sDEFAULT_CATEGORY, nMasterVolume);
mcRef = new Sprite();
mcRef.addEventListener(Event.ENTER_FRAME, update);
};
}
private static function getSoundItem(_arg1:String):SoundItem{
var _local2:SoundItem;
var _local3:String;
_local2 = null;
for (_local3 in aSounds) {
if (aSounds[_local3].sLinkage == _arg1){
_local2 = aSounds[_local3];
break;
};
};
return (_local2);
}
public static function setMasterVolume(_arg1:Number):void{
nMasterVolume = _arg1;
updateAllSoundsVolume();
}
public static function cleanUpSound(_arg1:SoundItem):void{
var _local2:String;
for (_local2 in aSounds) {
if (aSounds[_local2] == _arg1){
delete aSounds[_local2];
aSounds.splice(_local2, 1);
};
};
}
public static function getCategoryVolume(_arg1:String):Number{
var _local2:Number;
var _local3:String;
for (_local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == _arg1){
_local2 = aSoundCategories[_local3].nVolume;
};
};
return (_local2);
}
public static function doUnMuteCategory(_arg1:String):void{
var _local2:String;
for (_local2 in aSoundCategories) {
if (aSoundCategories[_local2].sName == _arg1){
aSoundCategories[_local2].bMuted = false;
};
};
updateAllSoundsVolume();
}
public static function playSoundInCat(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Boolean=false, _arg7:Function=null):SoundItem{
var _local8:SoundItem;
var _local9:Boolean;
var _local10:Class;
var _local11:String;
_local8 = null;
_local9 = false;
_local10 = (getDefinitionByName(_arg2) as Class);
if (_arg6){
_local9 = true;
for (_local11 in aSounds) {
if (aSounds[_local11].linkage == _arg2){
_local9 = false;
_local8 = aSounds[_local11];
};
};
} else {
_local9 = true;
};
if (_local9){
_local8 = new SoundItem(new (_local10), _arg2, _arg3, _arg4, _arg5, _arg1, _arg7);
_local8.doPlay();
aSounds.push(_local8);
};
return (_local8);
}
public static function setCategoryVolume(_arg1:String, _arg2:Number):void{
var _local3:String;
for (_local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == _arg1){
aSoundCategories[_local3].nVolume = _arg2;
};
};
updateAllSoundsVolume();
}
public static function playSound(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number=0, _arg5:Boolean=false, _arg6:Function=null):SoundItem{
return (playSoundInCat(sDEFAULT_CATEGORY, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6));
}
public static function get MasterVolume():Number{
return (nMasterVolume);
}
private static function updateAllSoundsVolume():void{
var _local1:String;
for (_local1 in aSounds) {
aSounds[_local1].updateSound();
};
}
public static function addCategory(_arg1:String, _arg2:Number):void{
var _local3:Object;
_local3 = new Object();
_local3.sName = _arg1;
_local3.nVolume = _arg2;
_local3.bMuted = false;
aSoundCategories.push(_local3);
}
}
}//package library.sounds
Section 83
//SoundSlider (library.sounds.SoundSlider)
package library.sounds {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class SoundSlider {
protected var oEndPoint:Point;
protected var oStartPoint:Point;
protected var sSoundCategory:String;
protected var mcRef:MovieClip;
public function SoundSlider(_arg1:MovieClip, _arg2:String){
mcRef = _arg1;
sSoundCategory = _arg2;
setPoints();
setAnchor();
mcRef.mcAnchor.addEventListener(MouseEvent.MOUSE_DOWN, onClick, false, 0, true);
}
public function onRelease(_arg1:MouseEvent):void{
manageSoundVolume();
Main.instance.removeEventListener(MouseEvent.MOUSE_UP, onRelease, false);
Main.instance.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMove, false);
mcRef.mcAnchor.addEventListener(MouseEvent.MOUSE_DOWN, onClick, false, 0, true);
}
protected function setPoints():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local1 = mcRef.mcSlideBar.rotation;
_local2 = mcRef.mcSlideBar.width;
_local3 = (mcRef.mcSlideBar.x + (_local2 * Math.cos(((_local1 * Math.PI) / 180))));
_local4 = (mcRef.mcSlideBar.y + (_local2 * Math.sin(((_local1 * Math.PI) / 180))));
_local5 = mcRef.mcSlideBar.x;
_local6 = mcRef.mcSlideBar.y;
oStartPoint = new Point(_local3, _local4);
oEndPoint = new Point(_local5, _local6);
}
public function manageSoundVolume():void{
var _local1:Point;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = new Point(mcRef.mcAnchor.x, mcRef.mcAnchor.y);
_local2 = Point.distance(oStartPoint, oEndPoint);
_local3 = Point.distance(oEndPoint, _local1);
_local4 = (_local3 / _local2);
SoundManager.setCategoryVolume(sSoundCategory, _local4);
}
public function onClick(_arg1:MouseEvent):void{
mcRef.mcAnchor.removeEventListener(MouseEvent.MOUSE_DOWN, onClick, false);
Main.instance.addEventListener(MouseEvent.MOUSE_UP, onRelease, false, 0, true);
Main.instance.stage.addEventListener(MouseEvent.MOUSE_MOVE, onMove, false, 0, true);
}
protected function setAnchor():void{
var _local1:Number;
var _local2:Number;
_local1 = Point.distance(oStartPoint, oEndPoint);
_local2 = SoundManager.getCategoryVolume(sSoundCategory);
mcRef.mcAnchor.x = (oEndPoint.x + (_local2 * _local1));
}
public function destroy(_arg1:Event=null):void{
mcRef.mcAnchor.removeEventListener(MouseEvent.MOUSE_DOWN, onClick, false);
Main.instance.removeEventListener(MouseEvent.MOUSE_UP, onRelease, false);
Main.instance.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMove, false);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
mcRef = null;
}
protected function onMove(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Point;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Point;
_local2 = Main.instance.stage.mouseX;
_local3 = Main.instance.stage.mouseY;
if ((((((((_local2 < 0)) || ((_local2 > Data.iSTAGE_WIDTH)))) || ((_local3 < 0)))) || ((_local3 > Data.iSTAGE_HEIGHT)))){
onRelease(null);
} else {
_local2 = mcRef.mouseX;
_local4 = (_local2 - oEndPoint.x);
_local5 = new Point(mcRef.mcAnchor.x, mcRef.mcAnchor.y);
_local6 = Point.distance(oStartPoint, oEndPoint);
_local7 = Point.distance(_local5, oStartPoint);
_local8 = Math.floor(((_local7 * 100) / _local6));
_local9 = (_local4 / Point.distance(oStartPoint, oEndPoint));
if (_local9 < 0){
_local10 = oEndPoint;
} else {
if (_local9 > 1){
_local10 = oStartPoint;
} else {
_local10 = Point.interpolate(oStartPoint, oEndPoint, _local9);
};
};
mcRef.mcAnchor.x = _local10.x;
mcRef.mcAnchor.y = _local10.y;
manageSoundVolume();
};
}
}
}//package library.sounds
Section 84
//SoundSliderAnimated (library.sounds.SoundSliderAnimated)
package library.sounds {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class SoundSliderAnimated extends SoundSlider {
public function SoundSliderAnimated(_arg1:MovieClip, _arg2:String){
super(_arg1, _arg2);
setGaryAnchor();
}
override protected function onMove(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Point;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Point;
_local2 = Main.instance.stage.mouseX;
_local3 = Main.instance.stage.mouseY;
if ((((((((_local2 < 0)) || ((_local2 > Data.iSTAGE_WIDTH)))) || ((_local3 < 0)))) || ((_local3 > Data.iSTAGE_HEIGHT)))){
onRelease(null);
} else {
_local2 = mcRef.mouseX;
_local4 = (_local2 - oEndPoint.x);
_local5 = new Point(mcRef.mcAnchor.x, mcRef.mcAnchor.y);
_local6 = Point.distance(oStartPoint, oEndPoint);
_local7 = Point.distance(_local5, oStartPoint);
_local8 = Math.floor(((_local7 * 100) / _local6));
_local9 = (_local4 / Point.distance(oStartPoint, oEndPoint));
if (_local9 < 0){
_local10 = oEndPoint;
} else {
if (_local9 > 1){
_local10 = oStartPoint;
} else {
_local10 = Point.interpolate(oStartPoint, oEndPoint, _local9);
};
};
mcRef.mcAnchor.x = _local10.x;
mcRef.mcAnchor.y = _local10.y;
setGaryAnchor();
manageSoundVolume();
};
}
private function setGaryAnchor():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Point.distance(oStartPoint, oEndPoint);
_local2 = (mcRef.mcAnchor.x - oEndPoint.x);
_local3 = (Math.floor(((_local2 / _local1) * 9)) + 1);
mcRef.mcGary.gotoAndStop(_local3);
mcRef.mcAnchor.gotoAndStop(_local3);
}
}
}//package library.sounds
Section 85
//DepthManager (library.utils.DepthManager)
package library.utils {
import flash.events.*;
import flash.display.*;
import library.interfaces.*;
public class DepthManager implements Idestroyable {
private var oLayers:Object;
public function DepthManager(){
oLayers = new Object();
}
public function getDepthLayer(_arg1:String):DisplayObjectContainer{
return (oLayers[_arg1]);
}
public function addDepthLayer(_arg1:String, _arg2:DisplayObjectContainer):void{
var _local3:Sprite;
if (oLayers[_arg1] == null){
_local3 = new Sprite();
oLayers[_arg1] = _local3;
_arg2.addChild(_local3);
};
}
public function destroy(_arg1:Event=null):void{
var _local2:String;
for (_local2 in oLayers) {
oLayers[_local2].parent.removeChild(oLayers[_local2]);
};
oLayers = null;
}
}
}//package library.utils
Section 86
//Tools (library.utils.Tools)
package library.utils {
public class Tools {
private static const sTHOUSANDS_SEPARATOR:String = " ";
public static function getFormatedTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=true):String{
var _local4:Boolean;
var _local5:Number;
var _local6:String;
var _local7:Number;
var _local8:Number;
var _local9:String;
var _local10:String;
var _local11:String;
var _local12:Number;
_local4 = false;
if (_arg1 < 0){
_local4 = true;
_arg1 = Math.abs(_arg1);
};
_local5 = Math.floor((_arg1 / 1000));
if (_arg2){
if (_arg1 >= 1000){
_local12 = (_arg1 % (_local5 * 1000));
} else {
_local12 = _arg1;
};
_local6 = String(_local12).substr(0, 2);
if (_local6.length <= 1){
_local6 = ("0" + _local6);
};
};
_local7 = Math.floor((_local5 / 60));
_local8 = Math.floor((_local5 % 60));
_local9 = "";
_local10 = "";
if (_local8 < 10){
_local10 = "0";
};
if (_local7 < 10){
_local9 = "0";
};
_local11 = "";
if (_arg3){
_local11 = (_local11 + String(((_local9 + _local7) + ":")));
};
_local11 = (_local11 + (_local10 + _local8));
if (_arg2){
_local11 = (_local11 + (":" + _local6));
};
if (_local4){
_local11 = ("-" + _local11);
};
return (_local11);
}
public static function getFormatedNumber(_arg1:Number, _arg2:Number):String{
return (returnFormatedNumber(_arg1, _arg2));
}
public static function doCopyArray(_arg1:Array):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
_local3 = 0;
while (_local3 < _arg1.length) {
if ((_arg1[_local3] is Array)){
_local2.push(Tools.doCopyArray(_arg1[_local3]));
} else {
_local2.push(_arg1[_local3]);
};
_local3++;
};
return (_local2);
}
public static function getTrimmedString(_arg1:String):String{
while (_arg1.charAt(0) == " ") {
_arg1 = _arg1.substring(1, _arg1.length);
};
while (_arg1.charAt((_arg1.length - 1)) == " ") {
_arg1 = _arg1.substring(0, (_arg1.length - 1));
};
return (_arg1);
}
public static function returnFormatedNumber(_arg1:Number, _arg2:Number):String{
var _local3:String;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:String;
_local3 = String(_arg1);
_local4 = sTHOUSANDS_SEPARATOR;
while (_local3.length < _arg2) {
_local3 = ("0" + _local3);
};
_local5 = new Array();
_local6 = (_local3.length - 1);
_local7 = 0;
while (_local7 <= _local6) {
_local9 = _local3.charAt(_local7);
_local5.push(_local9);
_local7++;
};
_local3 = "";
_local8 = 0;
_local7 = (_local5.length - 1);
while (_local7 >= 0) {
if (((((_local8 % 3) == 0)) && (!((_local8 == 0))))){
_local3 = (_local4 + _local3);
};
_local3 = (_local5[_local7] + _local3);
_local8++;
_local7--;
};
return (_local3);
}
}
}//package library.utils
Section 87
//wav (Lose_jingle.wav)
package Lose_jingle {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package Lose_jingle
Section 88
//Anim_InstructionBubble_iddle_779 (main_fla.Anim_InstructionBubble_iddle_779)
package main_fla {
import flash.display.*;
public dynamic class Anim_InstructionBubble_iddle_779 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 89
//Anim_InstructionBubble_In_769 (main_fla.Anim_InstructionBubble_In_769)
package main_fla {
import flash.display.*;
public dynamic class Anim_InstructionBubble_In_769 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 90
//Anim_InstructionBubble_Out_780 (main_fla.Anim_InstructionBubble_Out_780)
package main_fla {
import flash.display.*;
public dynamic class Anim_InstructionBubble_Out_780 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 91
//Anim_LevelIdle_762 (main_fla.Anim_LevelIdle_762)
package main_fla {
import flash.display.*;
public dynamic class Anim_LevelIdle_762 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 92
//Anim_LevelIn_759 (main_fla.Anim_LevelIn_759)
package main_fla {
import flash.display.*;
public dynamic class Anim_LevelIn_759 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 93
//Anim_LevelOut_763 (main_fla.Anim_LevelOut_763)
package main_fla {
import flash.display.*;
public dynamic class Anim_LevelOut_763 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 94
//Anim_SB_Greaser01_AngryBubble01_146 (main_fla.Anim_SB_Greaser01_AngryBubble01_146)
package main_fla {
import flash.display.*;
public dynamic class Anim_SB_Greaser01_AngryBubble01_146 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 95
//Anim_SB_Greaser01_Bubble01_142 (main_fla.Anim_SB_Greaser01_Bubble01_142)
package main_fla {
import flash.display.*;
public dynamic class Anim_SB_Greaser01_Bubble01_142 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 96
//Anim_SB_Greaser02_AngryBubble01_443 (main_fla.Anim_SB_Greaser02_AngryBubble01_443)
package main_fla {
import flash.display.*;
public dynamic class Anim_SB_Greaser02_AngryBubble01_443 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 97
//Anim_SB_Greaser02_Bubble01_439 (main_fla.Anim_SB_Greaser02_Bubble01_439)
package main_fla {
import flash.display.*;
public dynamic class Anim_SB_Greaser02_Bubble01_439 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 98
//Anim_SB_Greaser03_AngryBubble01_594 (main_fla.Anim_SB_Greaser03_AngryBubble01_594)
package main_fla {
import flash.display.*;
public dynamic class Anim_SB_Greaser03_AngryBubble01_594 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 99
//Anim_SB_Greaser04_AngryBubble01_295 (main_fla.Anim_SB_Greaser04_AngryBubble01_295)
package main_fla {
import flash.display.*;
public dynamic class Anim_SB_Greaser04_AngryBubble01_295 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 100
//Btn_BackRollOver01_716 (main_fla.Btn_BackRollOver01_716)
package main_fla {
import flash.display.*;
public dynamic class Btn_BackRollOver01_716 extends MovieClip {
public function Btn_BackRollOver01_716(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package main_fla
Section 101
//Btn_HowtoPlayRollOver01_637 (main_fla.Btn_HowtoPlayRollOver01_637)
package main_fla {
import flash.display.*;
public dynamic class Btn_HowtoPlayRollOver01_637 extends MovieClip {
public function Btn_HowtoPlayRollOver01_637(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package main_fla
Section 102
//Btn_NextRollOver01_776 (main_fla.Btn_NextRollOver01_776)
package main_fla {
import flash.display.*;
public dynamic class Btn_NextRollOver01_776 extends MovieClip {
public function Btn_NextRollOver01_776(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package main_fla
Section 103
//Btn_PlayAgainRollOver01_658 (main_fla.Btn_PlayAgainRollOver01_658)
package main_fla {
import flash.display.*;
public dynamic class Btn_PlayAgainRollOver01_658 extends MovieClip {
public function Btn_PlayAgainRollOver01_658(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package main_fla
Section 104
//Btn_PlayRollOver01_632 (main_fla.Btn_PlayRollOver01_632)
package main_fla {
import flash.display.*;
public dynamic class Btn_PlayRollOver01_632 extends MovieClip {
public function Btn_PlayRollOver01_632(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package main_fla
Section 105
//Btn_SubmitScoreRollOver01_654 (main_fla.Btn_SubmitScoreRollOver01_654)
package main_fla {
import flash.display.*;
public dynamic class Btn_SubmitScoreRollOver01_654 extends MovieClip {
public function Btn_SubmitScoreRollOver01_654(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package main_fla
Section 106
//Btn_TryAgainRollOver01_670 (main_fla.Btn_TryAgainRollOver01_670)
package main_fla {
import flash.display.*;
public dynamic class Btn_TryAgainRollOver01_670 extends MovieClip {
public function Btn_TryAgainRollOver01_670(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package main_fla
Section 107
//Btn_ViewHighScoresRollOver01_641 (main_fla.Btn_ViewHighScoresRollOver01_641)
package main_fla {
import flash.display.*;
public dynamic class Btn_ViewHighScoresRollOver01_641 extends MovieClip {
public function Btn_ViewHighScoresRollOver01_641(){
addFrameScript(22, frame23);
}
function frame23(){
stop();
}
}
}//package main_fla
Section 108
//mcAnchorLimits_752 (main_fla.mcAnchorLimits_752)
package main_fla {
import flash.display.*;
public dynamic class mcAnchorLimits_752 extends MovieClip {
public function mcAnchorLimits_752(){
addFrameScript(0, frame1);
}
function frame1(){
this.visible = false;
}
}
}//package main_fla
Section 109
//mcBubbleFloating_983 (main_fla.mcBubbleFloating_983)
package main_fla {
import flash.display.*;
public dynamic class mcBubbleFloating_983 extends MovieClip {
public var mcBubble:MovieClip;
}
}//package main_fla
Section 110
//mcBubbleGenerator_799 (main_fla.mcBubbleGenerator_799)
package main_fla {
import flash.display.*;
public dynamic class mcBubbleGenerator_799 extends MovieClip {
public function mcBubbleGenerator_799(){
addFrameScript(0, frame1);
}
function frame1(){
this.visible = false;
}
}
}//package main_fla
Section 111
//mcButtonHelp_718 (main_fla.mcButtonHelp_718)
package main_fla {
import flash.display.*;
public dynamic class mcButtonHelp_718 extends MovieClip {
public var btnPlay:SimpleButton;
}
}//package main_fla
Section 112
//mcEnemy1AngryBubble_145 (main_fla.mcEnemy1AngryBubble_145)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy1AngryBubble_145 extends MovieClip {
public var mcBubble:MovieClip;
}
}//package main_fla
Section 113
//mcEnemy1BubbleIdle_141 (main_fla.mcEnemy1BubbleIdle_141)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy1BubbleIdle_141 extends MovieClip {
public var mcBubble:MovieClip;
}
}//package main_fla
Section 114
//mcEnemy1OutBubble_150 (main_fla.mcEnemy1OutBubble_150)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy1OutBubble_150 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 115
//mcEnemy2AngryBubble_442 (main_fla.mcEnemy2AngryBubble_442)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy2AngryBubble_442 extends MovieClip {
public var mcBubble:MovieClip;
}
}//package main_fla
Section 116
//mcEnemy2BFFAngryBubble_593 (main_fla.mcEnemy2BFFAngryBubble_593)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy2BFFAngryBubble_593 extends MovieClip {
public var mcBubble:MovieClip;
}
}//package main_fla
Section 117
//mcEnemy2BFFBubbleIdle_589 (main_fla.mcEnemy2BFFBubbleIdle_589)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy2BFFBubbleIdle_589 extends MovieClip {
public var mcBubble:MovieClip;
}
}//package main_fla
Section 118
//mcEnemy2BFFOutBubble_597 (main_fla.mcEnemy2BFFOutBubble_597)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy2BFFOutBubble_597 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 119
//mcEnemy2BubbleIdle_438 (main_fla.mcEnemy2BubbleIdle_438)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy2BubbleIdle_438 extends MovieClip {
public var mcBubble:MovieClip;
}
}//package main_fla
Section 120
//mcEnemy2OutBubble_446 (main_fla.mcEnemy2OutBubble_446)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy2OutBubble_446 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 121
//mcEnemy3AngryBubble_294 (main_fla.mcEnemy3AngryBubble_294)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy3AngryBubble_294 extends MovieClip {
public var mcBubble:MovieClip;
}
}//package main_fla
Section 122
//mcEnemy3BubbleIdle_290 (main_fla.mcEnemy3BubbleIdle_290)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy3BubbleIdle_290 extends MovieClip {
public var mcBubble:MovieClip;
}
}//package main_fla
Section 123
//mcEnemy3OutBubble_298 (main_fla.mcEnemy3OutBubble_298)
package main_fla {
import flash.display.*;
public dynamic class mcEnemy3OutBubble_298 extends MovieClip {
public var mcInside:MovieClip;
}
}//package main_fla
Section 124
//mcHSScroller_726 (main_fla.mcHSScroller_726)
package main_fla {
import flash.display.*;
public dynamic class mcHSScroller_726 extends MovieClip {
public var btnUp:SimpleButton;
public var btnDown:SimpleButton;
}
}//package main_fla
Section 125
//mcHudBFF_606 (main_fla.mcHudBFF_606)
package main_fla {
import flash.display.*;
public dynamic class mcHudBFF_606 extends MovieClip {
public var mcHudBFFHearts:MovieClip;
}
}//package main_fla
Section 126
//mcHudBFFHearts_608 (main_fla.mcHudBFFHearts_608)
package main_fla {
import flash.display.*;
public dynamic class mcHudBFFHearts_608 extends MovieClip {
public var mcState:MovieClip;
public function mcHudBFFHearts_608(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package main_fla
Section 127
//mcHudLives_603 (main_fla.mcHudLives_603)
package main_fla {
import flash.display.*;
import flash.text.*;
public dynamic class mcHudLives_603 extends MovieClip {
public var txtLives:TextField;
}
}//package main_fla
Section 128
//mcPopupHelpIdle_723 (main_fla.mcPopupHelpIdle_723)
package main_fla {
import flash.display.*;
public dynamic class mcPopupHelpIdle_723 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 129
//mcPopupHelpIn_689 (main_fla.mcPopupHelpIn_689)
package main_fla {
import flash.display.*;
public dynamic class mcPopupHelpIn_689 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 130
//mcPopupHelpInside_690 (main_fla.mcPopupHelpInside_690)
package main_fla {
import flash.display.*;
public dynamic class mcPopupHelpInside_690 extends MovieClip {
public var btnBack:SimpleButton;
public var mcButton:MovieClip;
}
}//package main_fla
Section 131
//mcPopupHelpOut_724 (main_fla.mcPopupHelpOut_724)
package main_fla {
import flash.display.*;
public dynamic class mcPopupHelpOut_724 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 132
//mcPopupMenuIdle_756 (main_fla.mcPopupMenuIdle_756)
package main_fla {
import flash.display.*;
public dynamic class mcPopupMenuIdle_756 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 133
//mcPopupMenuIn_738 (main_fla.mcPopupMenuIn_738)
package main_fla {
import flash.display.*;
public dynamic class mcPopupMenuIn_738 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 134
//mcPopupMenuInside_739 (main_fla.mcPopupMenuInside_739)
package main_fla {
import flash.display.*;
public dynamic class mcPopupMenuInside_739 extends MovieClip {
public var mcSliderSound:MovieClip;
public var mcSliderMusic:MovieClip;
public var btnResume:SimpleButton;
public var btnHelp:SimpleButton;
public var btnQuit:SimpleButton;
}
}//package main_fla
Section 135
//mcPopupMenuOut_757 (main_fla.mcPopupMenuOut_757)
package main_fla {
import flash.display.*;
public dynamic class mcPopupMenuOut_757 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 136
//mcPopupQuitIdle_686 (main_fla.mcPopupQuitIdle_686)
package main_fla {
import flash.display.*;
public dynamic class mcPopupQuitIdle_686 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 137
//mcPopupQuitIn_675 (main_fla.mcPopupQuitIn_675)
package main_fla {
import flash.display.*;
public dynamic class mcPopupQuitIn_675 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 138
//mcPopupQuitInside_676 (main_fla.mcPopupQuitInside_676)
package main_fla {
import flash.display.*;
public dynamic class mcPopupQuitInside_676 extends MovieClip {
public var btnYes:SimpleButton;
public var btnNo:SimpleButton;
}
}//package main_fla
Section 139
//mcPopupQuitOut_687 (main_fla.mcPopupQuitOut_687)
package main_fla {
import flash.display.*;
public dynamic class mcPopupQuitOut_687 extends MovieClip {
public var mcPopup:MovieClip;
}
}//package main_fla
Section 140
//Pack_AnimSliderSound01_742 (main_fla.Pack_AnimSliderSound01_742)
package main_fla {
import flash.display.*;
public dynamic class Pack_AnimSliderSound01_742 extends MovieClip {
public var mcAnchor:MovieClip;
public var mcGary:MovieClip;
public var mcSlideBar:MovieClip;
}
}//package main_fla
Section 141
//Pack_GameLevel_All_760 (main_fla.Pack_GameLevel_All_760)
package main_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Pack_GameLevel_All_760 extends MovieClip {
public var txtLevel:TextField;
}
}//package main_fla
Section 142
//Pack_InstructionBubbleAll02_770 (main_fla.Pack_InstructionBubbleAll02_770)
package main_fla {
import flash.display.*;
public dynamic class Pack_InstructionBubbleAll02_770 extends MovieClip {
public var mcText:MovieClip;
public var btnNext:SimpleButton;
public var btnPlay:SimpleButton;
}
}//package main_fla
Section 143
//wav (packaging.wav)
package packaging {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package packaging
Section 144
//wav (PopupLetsGetPoppin.wav)
package PopupLetsGetPoppin {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package PopupLetsGetPoppin
Section 145
//wav (PopupLevel.wav)
package PopupLevel {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package PopupLevel
Section 146
//wav (PopupReady.wav)
package PopupReady {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package PopupReady
Section 147
//PopupBlocker (popups.PopupBlocker)
package popups {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.events.*;
public class PopupBlocker extends Popup implements Idestroyable {
public function PopupBlocker(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, null, loadState);
addState(sSTATE_IDLE, null, loadState);
addState(sSTATE_DISAPPEAR, null, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_IDLE);
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
break;
case sSTATE_IDLE:
break;
case sSTATE_DISAPPEAR:
break;
};
}
override public function destroy(_arg1:Event=null):void{
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
super.destroy(_arg1);
}
}
}//package popups
Section 148
//PopupHelp (popups.PopupHelp)
package popups {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.events.*;
public class PopupHelp extends Popup implements Idestroyable {
private var btnBACK:SimpleButton;
private var btnPLAY:SimpleButton;
public function PopupHelp(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, state_appear, loadState, unloadState);
addState(sSTATE_IDLE, null, loadState, unloadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState, unloadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
private function setPlayButton():void{
if (Main.instance.state == Main.sSTATE_TITLE){
mcState.mcPopup.mcButton.gotoAndStop(1);
} else {
mcState.mcPopup.mcButton.gotoAndStop(2);
};
if (mcState.mcPopup.mcButton.btnPlay == null){
mcState.addEventListener(Event.ADDED, onAddedButton);
} else {
btnPLAY = mcState.mcPopup.mcButton.btnPlay;
setButton(btnPLAY, onClick, onRollOver);
};
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
setPlayButton();
break;
case sSTATE_IDLE:
setPlayButton();
btnBACK = mcState.mcPopup.btnBack;
setButton(btnBACK, onClick, onRollOver);
break;
case sSTATE_DISAPPEAR:
setPlayButton();
break;
};
}
override public function destroy(_arg1:Event=null):void{
setButton(btnBACK, onClick, onRollOver, true);
setButton(btnPLAY, onClick, onRollOver, true);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
btnBACK = null;
btnPLAY = null;
super.destroy(_arg1);
}
private function unloadState():void{
switch (state){
case sSTATE_APPEAR:
case sSTATE_IDLE:
case sSTATE_DISAPPEAR:
break;
};
}
override public function onClick(_arg1:MouseEvent):void{
super.onClick(_arg1);
switch (_arg1.target){
case btnBACK:
close();
break;
case btnPLAY:
if (Main.instance.state == Main.sSTATE_TITLE){
Main.instance.initVariables();
Main.instance.transitTo(Main.sSTATE_GAME);
} else {
Main.instance.resumeGame();
Main.instance.removePopup(Main.instance.popupMenu);
Main.instance.popupHelp.close();
};
break;
};
}
private function onAddedButton(_arg1:Event):void{
if (_arg1.target == mcState.mcPopup.mcButton.getChildByName("btnPlay")){
btnPLAY = mcState.mcPopup.mcButton.getChildByName("btnPlay");
setButton(btnPLAY, onClick, onRollOver);
mcState.removeEventListener(Event.ADDED, onAddedButton);
};
}
override public function onRollOver(_arg1:MouseEvent):void{
super.onRollOver(_arg1);
switch (_arg1.target){
default:
break;
};
}
}
}//package popups
Section 149
//PopupLevel (popups.PopupLevel)
package popups {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.events.*;
public class PopupLevel extends Popup implements Idestroyable {
public function PopupLevel(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_IDLE, state_idle, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
showLevel();
switch (state){
case sSTATE_APPEAR:
break;
case sSTATE_IDLE:
Main.instance.oSoundPlayer.playLevelPopup();
Main.instance.gameManager.manageGameStep();
break;
case sSTATE_DISAPPEAR:
break;
};
}
private function showLevel():void{
mcState.mcPopup.txtLevel.text = Data.nLEVEL;
}
override public function destroy(_arg1:Event=null):void{
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
super.destroy(_arg1);
}
private function unloadState():void{
if (state == sSTATE_DISAPPEAR){
Main.instance.gameManager.manageGameStep();
};
}
override protected function state_disappear():void{
if (stateComplete){
unloadState();
Main.instance.removePopup(this);
};
}
}
}//package popups
Section 150
//PopupMenu (popups.PopupMenu)
package popups {
import flash.events.*;
import library.sounds.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.events.*;
public class PopupMenu extends Popup implements Idestroyable {
private var oSliderMusic:SoundSliderAnimated;
private var btnRESUME:SimpleButton;
private var btnHELP:SimpleButton;
private var btnQUIT:SimpleButton;
private var oSliderSound:SoundSliderAnimated;
public function PopupMenu(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_IDLE, null, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
override public function destroy(_arg1:Event=null):void{
setButton(btnRESUME, onClick, onRollOver, true);
setButton(btnHELP, onClick, onRollOver, true);
setButton(btnQUIT, onClick, onRollOver, true);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
if (oSliderSound != null){
oSliderSound.destroy();
};
oSliderSound = null;
if (oSliderMusic != null){
oSliderMusic.destroy();
};
oSliderMusic = null;
btnRESUME = null;
btnHELP = null;
btnQUIT = null;
super.destroy(_arg1);
}
private function unloadState():void{
oSliderSound.destroy();
oSliderSound = null;
oSliderMusic.destroy();
oSliderMusic = null;
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
oSliderSound = new SoundSliderAnimated(mcState.mcPopup.mcSliderSound, Data.sCATEGORY_SOUND_LINKAGE);
oSliderMusic = new SoundSliderAnimated(mcState.mcPopup.mcSliderMusic, Data.sCATEGORY_MUSIC_LINKAGE);
break;
case sSTATE_IDLE:
btnRESUME = mcState.mcPopup.btnResume;
btnHELP = mcState.mcPopup.btnHelp;
btnQUIT = mcState.mcPopup.btnQuit;
setButton(btnRESUME, onClick, onRollOver);
setButton(btnHELP, onClick, onRollOver);
setButton(btnQUIT, onClick, onRollOver);
oSliderSound = new SoundSliderAnimated(mcState.mcPopup.mcSliderSound, Data.sCATEGORY_SOUND_LINKAGE);
oSliderMusic = new SoundSliderAnimated(mcState.mcPopup.mcSliderMusic, Data.sCATEGORY_MUSIC_LINKAGE);
break;
case sSTATE_DISAPPEAR:
oSliderSound = new SoundSliderAnimated(mcState.mcPopup.mcSliderSound, Data.sCATEGORY_SOUND_LINKAGE);
oSliderMusic = new SoundSliderAnimated(mcState.mcPopup.mcSliderMusic, Data.sCATEGORY_MUSIC_LINKAGE);
break;
};
}
override public function onClick(_arg1:MouseEvent):void{
super.onClick(_arg1);
switch (_arg1.target){
case btnRESUME:
close();
Main.instance.resumeGame();
break;
case btnHELP:
Main.instance.addPopup(Main.sPOPUP_HELP);
break;
case btnQUIT:
Main.instance.addPopup(Main.sPOPUP_QUIT);
break;
};
}
override public function onRollOver(_arg1:MouseEvent):void{
super.onRollOver(_arg1);
switch (_arg1.target){
default:
break;
};
}
}
}//package popups
Section 151
//PopupPoppin (popups.PopupPoppin)
package popups {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.events.*;
public class PopupPoppin extends Popup implements Idestroyable {
public function PopupPoppin(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_IDLE, state_idle, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
override protected function state_idle():void{
if (stateComplete){
setState(sSTATE_DISAPPEAR);
};
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
break;
case sSTATE_IDLE:
Main.instance.oSoundPlayer.playPoppinPopup();
break;
case sSTATE_DISAPPEAR:
Main.instance.gameManager.manageGameStep();
break;
};
}
override public function destroy(_arg1:Event=null):void{
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
super.destroy(_arg1);
}
private function unloadState():void{
}
override protected function state_disappear():void{
if (stateComplete){
unloadState();
Main.instance.removePopup(this);
};
}
}
}//package popups
Section 152
//PopupQuit (popups.PopupQuit)
package popups {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.events.*;
public class PopupQuit extends Popup implements Idestroyable {
private var btnNO:SimpleButton;
private var btnYES:SimpleButton;
public function PopupQuit(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_IDLE, null, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
override public function destroy(_arg1:Event=null):void{
setButton(btnYES, onClick, onRollOver, true);
setButton(btnNO, onClick, onRollOver, true);
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
btnYES = null;
btnNO = null;
super.destroy(_arg1);
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
break;
case sSTATE_IDLE:
btnYES = mcState.mcPopup.btnYes;
btnNO = mcState.mcPopup.btnNo;
setButton(btnYES, onClick, onRollOver);
setButton(btnNO, onClick, onRollOver);
break;
case sSTATE_DISAPPEAR:
break;
};
}
override public function onClick(_arg1:MouseEvent):void{
super.onClick(_arg1);
switch (_arg1.target){
case btnYES:
Main.instance.gameManager.quitGame();
break;
case btnNO:
close();
break;
};
}
override public function onRollOver(_arg1:MouseEvent):void{
super.onRollOver(_arg1);
switch (_arg1.target){
default:
break;
};
}
}
}//package popups
Section 153
//PopupReady (popups.PopupReady)
package popups {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.events.*;
public class PopupReady extends Popup implements Idestroyable {
public function PopupReady(_arg1:MovieClip){
super(_arg1);
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_IDLE, state_idle, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
override protected function state_idle():void{
if (stateComplete){
setState(sSTATE_DISAPPEAR);
};
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
break;
case sSTATE_IDLE:
Main.instance.oSoundPlayer.playReadyPopup();
break;
case sSTATE_DISAPPEAR:
break;
};
}
override public function destroy(_arg1:Event=null):void{
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
super.destroy(_arg1);
}
private function unloadState():void{
if (state == sSTATE_DISAPPEAR){
Main.instance.gameManager.manageGameStep();
};
}
override protected function state_disappear():void{
if (stateComplete){
unloadState();
Main.instance.removePopup(this);
};
}
}
}//package popups
Section 154
//PopupTips (popups.PopupTips)
package popups {
import flash.events.*;
import flash.display.*;
import library.keys.*;
import library.basic.*;
import library.interfaces.*;
import library.events.*;
public class PopupTips extends Popup implements Idestroyable {
protected var oKeys:KeysManager;
private var nCurrentFrame:Number;
private var nEndFrame:Number;
private var nStartFrame:Number;
public function PopupTips(_arg1:MovieClip){
super(_arg1);
nCurrentFrame = 1;
nStartFrame = 1;
nEndFrame = 1;
addState(sSTATE_APPEAR, state_appear, loadState);
addState(sSTATE_IDLE, state_idle, loadState);
addState(sSTATE_DISAPPEAR, state_disappear, loadState);
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.addEventListener(MainEvent.EVENT_DESTROY, destroy, false, 0, true);
setState(sSTATE_APPEAR);
}
private function loadState():void{
if (mcRef.mcBlocker != null){
mcRef.mcBlocker.useHandCursor = false;
};
switch (state){
case sSTATE_APPEAR:
Main.instance.oSoundPlayer.playTipsInPopup();
setFrames(true);
break;
case sSTATE_IDLE:
oKeys = new KeysManager(mcRef);
oKeys.addKey(KeysManager.SPACE);
oKeys.addEventListener(KeyEvent.KEY_DOWN, onKeyDown, false, 0, true);
setFrames();
break;
case sSTATE_DISAPPEAR:
Main.instance.oSoundPlayer.playTipsOutPopup();
setFrames();
break;
};
}
override public function destroy(_arg1:Event=null):void{
setButton(mcState.mcPopup.btnNext, onClick, onRollOver, true);
setButton(mcState.mcPopup.btnPlay, onClick, onRollOver, true);
oKeys.removeEventListener(KeyEvent.KEY_DOWN, onKeyDown, false);
oKeys = null;
if (mcRef != null){
mcRef.parent.removeChild(mcRef);
};
Main.instance.removeEventListener(MainEvent.EVENT_UPDATE, update, false);
Main.instance.removeEventListener(MainEvent.EVENT_DESTROY, destroy, false);
super.destroy(_arg1);
}
private function unloadState():void{
switch (state){
case sSTATE_DISAPPEAR:
Main.instance.gameManager.manageGameStep();
break;
};
}
protected function onKeyDown(_arg1:KeyEvent):void{
if (oKeys.isKeyDown(KeysManager.SPACE)){
close();
};
}
private function setFrames(_arg1:Boolean=false):void{
setButton(mcState.mcPopup.btnPlay, onClick, onRollOver);
switch (Data.nLEVEL){
case 1:
nStartFrame = 1;
nEndFrame = 2;
setButton(mcState.mcPopup.btnNext, onClick, onRollOver);
break;
case 2:
nStartFrame = 3;
nEndFrame = 3;
mcState.mcPopup.btnNext.visible = false;
break;
case 3:
nStartFrame = 4;
nEndFrame = 4;
mcState.mcPopup.btnNext.visible = false;
break;
case 4:
nStartFrame = 5;
nEndFrame = 5;
mcState.mcPopup.btnNext.visible = false;
break;
};
if (_arg1){
nCurrentFrame = nStartFrame;
};
if (nCurrentFrame >= 2){
mcState.mcPopup.btnNext.visible = false;
};
mcState.mcPopup.mcText.gotoAndStop(nCurrentFrame);
}
override public function onClick(_arg1:MouseEvent):void{
super.onClick(_arg1);
switch (_arg1.target){
case mcState.mcPopup.btnPlay:
close();
break;
case mcState.mcPopup.btnNext:
nCurrentFrame = nEndFrame;
mcState.mcPopup.mcText.gotoAndStop(nCurrentFrame);
mcState.mcPopup.btnNext.visible = false;
break;
};
}
override protected function state_disappear():void{
if (stateComplete){
unloadState();
Main.instance.removePopup(this);
};
}
override public function onRollOver(_arg1:MouseEvent):void{
super.onRollOver(_arg1);
switch (_arg1.target){
default:
break;
};
}
}
}//package popups
Section 155
//wav (PopupTipsIn.wav)
package PopupTipsIn {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package PopupTipsIn
Section 156
//wav (PopupTipsOut.wav)
package PopupTipsOut {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package PopupTipsOut
Section 157
//wav (PowerUpBFF.wav)
package PowerUpBFF {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package PowerUpBFF
Section 158
//wav (SBAttack.wav)
package SBAttack {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package SBAttack
Section 159
//wav (SBDie.wav)
package SBDie {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package SBDie
Section 160
//wav (SBHurt.wav)
package SBHurt {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package SBHurt
Section 161
//wav (SBLand.wav)
package SBLand {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package SBLand
Section 162
//wav (SBRun.wav)
package SBRun {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package SBRun
Section 163
//HSScreen (screens.HSScreen)
package screens {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.utils.*;
import library.events.*;
public class HSScreen extends Screen implements Idestroyable {
private var nDirection:Number;
public function HSScreen(_arg1:MovieClip){
super(_arg1);
initButton();
initText();
nDirection = 0;
Main.instance.MyNickServices.addEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, onScoreList, false, 0, true);
Main.instance.MyNickServices.addEventListener(NickServices.sEVENT_SCORES_RECEIVED, onScoreList, false, 0, true);
if (Main.instance.IsScoreSubmitted){
enableButton(mcRef.btnSubmitHS, false);
Main.instance.ScoreSubmitted = false;
submitScore();
} else {
Main.instance.MyNickServices.requestScores(Data.sHS_GAMEID);
};
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
}
public function onUserLoggedOut(_arg1:Event):void{
Main.instance.MyNickServices.addEventListener(NickServices.sEVENT_USER_STATUS_RECEIVED, onLogin, false, 0, true);
Main.instance.MyNickServices.requestLoginUI(true, mcRef);
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, submitScore, false);
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_USER_LOGGED_OUT, onUserLoggedOut, false);
}
public function onMouseDown(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.Scroller_mc.btnUp:
nDirection = -1;
break;
case mcRef.Scroller_mc.btnDown:
nDirection = 1;
break;
};
}
override public function update(_arg1:Event=null):void{
doScroll(nDirection);
}
public function onLogin(_arg1:Event):void{
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_USER_STATUS_RECEIVED, onLogin, false);
submitScore();
}
public function onMouseUp(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.Scroller_mc.btnUp:
case mcRef.Scroller_mc.btnDown:
nDirection = 0;
break;
};
}
protected function submitScore():void{
Main.instance.MyNickServices.addEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, onSubmitScore, false, 0, true);
Main.instance.MyNickServices.addEventListener(NickServices.sEVENT_USER_LOGGED_OUT, onUserLoggedOut, false, 0, true);
Main.instance.MyNickServices.submitScore(Data.sHS_GAMEID, Data.nSCORE);
enableButton(mcRef.btnSubmitHS, false);
}
override protected function initButton():void{
setButton(mcRef.btnPlayAgain, onClick, onRollOver);
if (Data.nSCORE > 0){
enableButton(mcRef.btnSubmitHS, true);
setButton(mcRef.btnSubmitHS, onClick, onRollOver);
} else {
enableButton(mcRef.btnSubmitHS, false);
};
setButton(mcRef.Scroller_mc.btnUp, onClick, onRollOver);
mcRef.Scroller_mc.btnUp.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
mcRef.Scroller_mc.btnUp.addEventListener(MouseEvent.MOUSE_OUT, onMouseUp, false, 0, true);
mcRef.Scroller_mc.btnUp.addEventListener(MouseEvent.MOUSE_UP, onMouseUp, false, 0, true);
setButton(mcRef.Scroller_mc.btnDown, onClick, onRollOver);
mcRef.Scroller_mc.btnDown.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
mcRef.Scroller_mc.btnDown.addEventListener(MouseEvent.MOUSE_OUT, onMouseUp, false, 0, true);
mcRef.Scroller_mc.btnDown.addEventListener(MouseEvent.MOUSE_UP, onMouseUp, false, 0, true);
}
protected function initText():void{
mcRef.txtScore.text = Tools.getFormatedNumber(Data.nSCORE, 0);
}
protected function doScroll(_arg1:Number):void{
if (_arg1 == -1){
mcRef.txtRanks.scrollV--;
mcRef.txtUsernames.scrollV--;
mcRef.txtScores.scrollV--;
} else {
if (_arg1 == 1){
mcRef.txtRanks.scrollV++;
mcRef.txtUsernames.scrollV++;
mcRef.txtScores.scrollV++;
};
};
}
override public function onClick(_arg1:MouseEvent):void{
super.onClick(_arg1);
switch (_arg1.target){
case mcRef.btnPlayAgain:
Main.instance.transitTo(Main.sSTATE_TITLE);
break;
case mcRef.btnSubmitHS:
if (mcRef.btnSubmitHS.enabled){
submitScore();
};
break;
case mcRef.Scroller_mc.btnUp:
break;
case mcRef.Scroller_mc.btnDown:
break;
};
}
public function onScoreList(_arg1:Event):void{
var _local2:Array;
var _local3:String;
_local2 = Main.instance.MyNickServices.highScores;
if (mcRef != null){
mcRef.txtRanks.text = "";
mcRef.txtUsernames.text = "";
mcRef.txtScores.text = "";
if (_local2 != null){
if (_local2.length > 0){
for (_local3 in _local2) {
mcRef.txtUnavailable.text = "";
mcRef.txtRanks.appendText(String(("\n" + _local2[_local3].nRank)));
mcRef.txtUsernames.appendText(String(("\n" + _local2[_local3].sNickName)));
mcRef.txtScores.appendText(String(("\n" + Tools.getFormatedNumber(_local2[_local3].nScore, 0))));
};
} else {
mcRef.txtUnavailable.text = Data.sHS_MSG_LIST_EMPTY;
};
} else {
mcRef.txtUnavailable.text = Data.sHS_MSG_LIST_EMPTY;
};
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, onScoreList, false);
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_SCORES_RECEIVED, onScoreList, false);
};
}
override public function destroy(_arg1:Event=null):void{
setButton(mcRef.btnPlayAgain, onClick, onRollOver, true);
if (Data.nSCORE > 0){
setButton(mcRef.btnSubmitHS, onClick, onRollOver, true);
};
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, onScoreList, false);
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_SCORES_RECEIVED, onScoreList, false);
mcRef = null;
}
public function onSubmitScore(_arg1:Event):void{
Main.instance.MyNickServices.addEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, onScoreList, false, 0, true);
Main.instance.MyNickServices.requestScores(Data.sHS_GAMEID);
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_SCORE_SUBMISSION_COMPLETED, onSubmitScore, false);
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_USER_LOGGED_OUT, onUserLoggedOut, false);
}
override public function onRollOver(_arg1:MouseEvent):void{
super.onRollOver(_arg1);
switch (_arg1.target){
default:
break;
};
}
}
}//package screens
Section 164
//HSTitleScreen (screens.HSTitleScreen)
package screens {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.events.*;
public class HSTitleScreen extends Screen implements Idestroyable {
private var nDirection:Number;
public function HSTitleScreen(_arg1:MovieClip){
super(_arg1);
nDirection = 0;
Main.instance.addEventListener(MainEvent.EVENT_UPDATE, update, false, 0, true);
Main.instance.MyNickServices.addEventListener(NickServices.sEVENT_SCORES_RECEIVED, onScoreList, false, 0, true);
Main.instance.MyNickServices.requestScores(Data.sHS_GAMEID);
initButton();
}
public function onMouseDown(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.Scroller_mc.btnUp:
nDirection = -1;
break;
case mcRef.Scroller_mc.btnDown:
nDirection = 1;
break;
};
}
override public function update(_arg1:Event=null):void{
doScroll(nDirection);
}
public function onMouseUp(_arg1:MouseEvent):void{
switch (_arg1.target){
case mcRef.Scroller_mc.btnUp:
case mcRef.Scroller_mc.btnDown:
nDirection = 0;
break;
};
}
protected function doScroll(_arg1:Number):void{
if (_arg1 == -1){
mcRef.txtRanks.scrollV--;
mcRef.txtUsernames.scrollV--;
mcRef.txtScores.scrollV--;
} else {
if (_arg1 == 1){
mcRef.txtRanks.scrollV++;
mcRef.txtUsernames.scrollV++;
mcRef.txtScores.scrollV++;
};
};
}
override protected function initButton():void{
setButton(mcRef.btnBack, onClick, onRollOver);
setButton(mcRef.Scroller_mc.btnUp, onClick, onRollOver);
mcRef.Scroller_mc.btnUp.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
mcRef.Scroller_mc.btnUp.addEventListener(MouseEvent.MOUSE_OUT, onMouseUp, false, 0, true);
mcRef.Scroller_mc.btnUp.addEventListener(MouseEvent.MOUSE_UP, onMouseUp, false, 0, true);
setButton(mcRef.Scroller_mc.btnDown, onClick, onRollOver);
mcRef.Scroller_mc.btnDown.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown, false, 0, true);
mcRef.Scroller_mc.btnDown.addEventListener(MouseEvent.MOUSE_OUT, onMouseUp, false, 0, true);
mcRef.Scroller_mc.btnDown.addEventListener(MouseEvent.MOUSE_UP, onMouseUp, false, 0, true);
}
override public function onClick(_arg1:MouseEvent):void{
super.onClick(_arg1);
switch (_arg1.target){
case mcRef.btnBack:
Main.instance.transitTo(Main.sSTATE_TITLE);
break;
case mcRef.Scroller_mc.btnUp:
break;
case mcRef.Scroller_mc.btnDown:
break;
};
}
public function onScoreList(_arg1:Event):void{
var _local2:String;
if (mcRef != null){
mcRef.txtRanks.text = "";
mcRef.txtUsernames.text = "";
mcRef.txtScores.text = "";
if (_arg1.target.highScores.length <= 0){
mcRef.txtUnavailable.text = Data.sHS_MSG_LIST_EMPTY;
} else {
for (_local2 in _arg1.target.highScores) {
mcRef.txtUnavailable.text = "";
mcRef.txtRanks.appendText(String(("\n" + _arg1.target.highScores[_local2].nRank)));
mcRef.txtUsernames.appendText(String(("\n" + _arg1.target.highScores[_local2].sNickName)));
mcRef.txtScores.appendText(String(("\n" + _arg1.target.highScores[_local2].nScore)));
};
};
Main.instance.MyNickServices.removeEventListener(NickServices.sEVENT_SCORES_RECEIVED, onScoreList);
};
}
override public function destroy(_arg1:Event=null):void{
setButton(mcRef.btnBack, onClick, onRollOver, true);
mcRef = null;
}
override public function onRollOver(_arg1:MouseEvent):void{
super.onRollOver(_arg1);
switch (_arg1.target){
default:
break;
};
}
}
}//package screens
Section 165
//LoseScreen (screens.LoseScreen)
package screens {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.utils.*;
public class LoseScreen extends Screen {
public function LoseScreen(_arg1:MovieClip){
super(_arg1);
initButton();
initText();
}
private function showHS():void{
enableButton(mcRef.btnSubmitHS, false);
Main.instance.ScoreSubmitted = true;
Main.instance.transitTo(Main.sSTATE_HS);
}
protected function initText():void{
mcRef.txtScore.text = Tools.getFormatedNumber(Data.nSCORE, 0);
}
override protected function initButton():void{
setButton(mcRef.btnPlayAgain, onClick, onRollOver);
if (Data.nSCORE > 0){
enableButton(mcRef.btnSubmitHS, true);
setButton(mcRef.btnSubmitHS, onClick, onRollOver);
} else {
enableButton(mcRef.btnSubmitHS, false);
};
setButton(mcRef.btnViewHS, onClick, onRollOver);
}
override public function onClick(_arg1:MouseEvent):void{
super.onClick(_arg1);
Main.instance.oSoundPlayer.stopJingle();
switch (_arg1.target){
case mcRef.btnPlayAgain:
Main.instance.transitTo(Main.sSTATE_TITLE);
break;
case mcRef.btnSubmitHS:
if (mcRef.btnSubmitHS.enabled){
showHS();
};
break;
case mcRef.btnViewHS:
Main.instance.transitTo(Main.sSTATE_HS);
break;
};
}
override public function onRollOver(_arg1:MouseEvent):void{
super.onRollOver(_arg1);
switch (_arg1.target){
default:
break;
};
}
override public function destroy(_arg1:Event=null):void{
setButton(mcRef.btnPlayAgain, onClick, onRollOver, true);
if (Data.nSCORE > 0){
setButton(mcRef.btnSubmitHS, onClick, onRollOver, true);
};
setButton(mcRef.btnViewHS, onClick, onRollOver, true);
mcRef = null;
}
}
}//package screens
Section 166
//TitleScreen (screens.TitleScreen)
package screens {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
public class TitleScreen extends Screen implements Idestroyable {
public function TitleScreen(_arg1:MovieClip){
super(_arg1);
initButton();
}
private function checkHS(_arg1:Event):void{
if (Main.instance.MyNickServices.ready){
setButton(mcRef.btnViewHS, onClick, onRollOver);
mcRef.removeEventListener(Event.ENTER_FRAME, checkHS);
enableButton(mcRef.btnViewHS, true);
} else {
enableButton(mcRef.btnViewHS, false);
};
}
override protected function initButton():void{
setButton(mcRef.btnPlay, onClick, onRollOver);
setButton(mcRef.btnHelp, onClick, onRollOver);
if (!Main.instance.MyNickServices.ready){
enableButton(mcRef.btnViewHS, false);
mcRef.addEventListener(Event.ENTER_FRAME, checkHS);
} else {
enableButton(mcRef.btnViewHS, true);
setButton(mcRef.btnViewHS, onClick, onRollOver);
};
}
override public function onClick(_arg1:MouseEvent):void{
super.onClick(_arg1);
switch (_arg1.target){
case mcRef.btnPlay:
Main.instance.initVariables();
Main.instance.transitTo(Main.sSTATE_GAME);
break;
case mcRef.btnHelp:
Main.instance.addPopup(Main.sPOPUP_HELP);
break;
case mcRef.btnViewHS:
if (mcRef.btnViewHS.enabled){
Main.instance.transitTo(Main.sSTATE_HS_TITLE);
};
break;
};
}
override public function onRollOver(_arg1:MouseEvent):void{
super.onRollOver(_arg1);
switch (_arg1.target){
default:
break;
};
}
override public function destroy(_arg1:Event=null):void{
setButton(mcRef.btnPlay, onClick, onRollOver, true);
setButton(mcRef.btnHelp, onClick, onRollOver, true);
if (Main.instance.MyNickServices.ready){
setButton(mcRef.btnViewHS, onClick, onRollOver, true);
};
mcRef = null;
}
}
}//package screens
Section 167
//WinScreen (screens.WinScreen)
package screens {
import flash.events.*;
import flash.display.*;
import library.basic.*;
import library.interfaces.*;
import library.utils.*;
public class WinScreen extends Screen implements Idestroyable {
public function WinScreen(_arg1:MovieClip){
super(_arg1);
initButton();
initText();
}
private function showHS():void{
enableButton(mcRef.btnSubmitHS, false);
Main.instance.ScoreSubmitted = true;
Main.instance.transitTo(Main.sSTATE_HS);
}
protected function initText():void{
mcRef.txtScore.text = Tools.getFormatedNumber(Data.nSCORE, 0);
}
override protected function initButton():void{
setButton(mcRef.btnPlayAgain, onClick, onRollOver);
setButton(mcRef.btnSubmitHS, onClick, onRollOver);
setButton(mcRef.btnViewHS, onClick, onRollOver);
}
override public function onClick(_arg1:MouseEvent):void{
super.onClick(_arg1);
Main.instance.oSoundPlayer.stopJingle();
switch (_arg1.target){
case mcRef.btnPlayAgain:
Main.instance.transitTo(Main.sSTATE_TITLE);
break;
case mcRef.btnSubmitHS:
if (mcRef.btnSubmitHS.enabled){
showHS();
};
break;
case mcRef.btnViewHS:
Main.instance.transitTo(Main.sSTATE_HS);
break;
};
}
override public function onRollOver(_arg1:MouseEvent):void{
super.onRollOver(_arg1);
switch (_arg1.target){
default:
break;
};
}
override public function destroy(_arg1:Event=null):void{
setButton(mcRef.btnPlayAgain, onClick, onRollOver, true);
setButton(mcRef.btnSubmitHS, onClick, onRollOver, true);
setButton(mcRef.btnViewHS, onClick, onRollOver, true);
mcRef = null;
}
}
}//package screens
Section 168
//wav (Transition_in.wav)
package Transition_in {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package Transition_in
Section 169
//wav (Transition_out.wav)
package Transition_out {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package Transition_out
Section 170
//wav (Win_jingle.wav)
package Win_jingle {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package Win_jingle
Section 171
//Data (Data)
package {
public class Data {
public static const nBUBBLE_MAX_SPEED_X:Number = 20;
public static const nBUBBLE_MAX_SPEED_Y:Number = -2;
public static const sCATEGORY_SOUND_LINKAGE:String = "sound";
public static const nPOINTS_BFF:Number = 500;
public static const nLEVEL_POPUP_VOLUME:Number = 0.8;
public static const nCOLLECTIBLE_BFF_DISAPPEAR_TIME:Number = 120;
public static const nMUSIC_PACK_VOLUME:Number = 0.7;
public static const nBUBBLE_POPPING_VOLUME:Number = 0.8;
public static const nENEMY_DECEL_Y:Number = 1.34;
public static const nENEMY1_BUBBLE_TIME:Number = 400;
public static const nCOLLECTIBLE_BUMPUP_SPEED:Number = -20;
public static const nENEMY_MIN_SPEED_X:Number = 1;
public static const nENEMY_MIN_SPEED_Y:Number = 1;
public static const nPLAYER_DECEL_Y:Number = 1.34;
public static const nPOINTS_HAIRPIECE:Number = 50;
public static const nBFFCOLLECT_VOLUME:Number = 0.7;
public static const nBFF_POWERUP_VOLUME:Number = 2.3;
public static const nPLAYER_JUMP_SPEED:Number = -40;
public static const nBUTTON_OVER_VOLUME:Number = 1.2;
public static const nENEMY_MIN_FALL_SPEED_Y:Number = 1;
public static const nLOSE_VOLUME:Number = 0.7;
public static const nREADY_POPUP_VOLUME:Number = 0.7;
public static const nENEMY_FLOAT_MIN_SPEED_Y:Number = -0.6;
public static const nCOLLECTIBLE_HAIRPIECE_DISAPPEAR_TIME:Number = 180;
public static const nCOLLECTIBLE_COMB_DISAPPEAR_TIME:Number = 180;
public static const nTRANSITION_IN_VOLUME:Number = 0.7;
public static const nENEMY_JUMP_SPEED:Number = -40;
public static const nPLAYER_LAND_VOLUME:Number = 0.8;
public static const nBUTTON_CLICK_VOLUME:Number = 1.2;
public static const iSTAGE_HEIGHT:Number = 400;
public static const nCOLLECTIBLE_ACCEL_X:Number = 1.2;
public static const nCOLLECTIBLE_ACCEL_Y:Number = 1.34;
public static const nENEMY2_BUBBLE_TIME:Number = 200;
public static const nPOINTS_EMPTY_BUBBLE:Number = 11;
public static const nPLAYER_JUMP_SPEED_X:Number = 8;
public static const nENEMY_BRAKE_X:Number = 1.2;
public static const nLEVEL_WAVES:Array = [1, 2, 2, 3, 3, 4];
public static const nCOLLECTIBLE_MAX_SPEED_X:Number = 8;
public static const nZONE_DEACTIVATE:Number = 200;
public static const nEND_LEVEL_TIME:Number = 100;
public static const nPLAYER_MAX_LIVES:Number = 7;
public static const nTRANSITION_OUT_VOLUME:Number = 0.7;
public static const nCOLLECTIBLE_MAX_SPEED_Y:Number = 15;
public static const nPLAYER_MAX_SPEED_X:Number = 8;
public static const nPLAYER_MAX_SPEED_Y:Number = 15;
public static const nPLAYER_RUN_VOLUME:Number = 0.6;
public static const nENEMY_IDLE_VOLUME:Number = 1.1;
public static const bCHEATS:Boolean = false;
public static const nBUBBLE_DECEL_X:Number = 1.15;
public static const nCOLLECTIBLE_HAIRSPRAY_DISAPPEAR_TIME:Number = 180;
public static const nENEMY_LAND_VOLUME:Number = 0.7;
public static const nBUBBLE_MIN_SPEED_Y:Number = -0.6;
public static const nENEMY_ANGRYBUBBLE_VOLUME:Number = 1.2;
public static const nBUBBLE_MIN_SPEED_X:Number = 2;
public static const iSTAGE_WIDTH:Number = 600;
public static const nENEMY_RUN_VOLUME:Number = 1.1;
public static const nENEMY3_BUBBLE_TIME:Number = 250;
public static const nENEMY_ACCEL_X:Number = 1.2;
public static const sCATEGORY_MUSIC_LINKAGE:String = "music";
public static const nENEMY_ACCEL_Y:Number = 1.34;
public static const sHS_GAMEID:String = "spongebob-whobob-hsb";
public static const nPLAYER_ACCEL_X:Number = 1.2;
public static const nPLAYER_ACCEL_Y:Number = 1.34;
public static const nENEMY_BRAKE_VOLUME:Number = 0.9;
public static const nENEMY_BASE_SPEED_X:Number = 3;
public static const nPOINTS_BONUS_TIME:Number = 41;
public static const nENEMY_MAX_SPEED_Y:Number = 15;
public static const nPLAYER_DIE_VOLUME:Number = 0.8;
public static const nCOLLECTIBLE_VOLUME:Number = 0.7;
public static const nTIPS_POPUP_OUT_VOLUME:Number = 1;
public static const nCOLLECTIBLE_MIN_FALL_SPEED_Y:Number = 1;
public static const nENEMY_RUN_SPEED_X:Number = 7;
public static const nENEMY3_PURSUIT_RANGE_X:Number = 200;
public static const nPLAYER_INVINCIBLE_TIME:Number = 70;
public static const nENEMY_DIE_VOLUME:Number = 1.2;
public static const nENEMY_HITBUBBLE_VOLUME:Number = 1;
public static const nPLAYER_ATTACK_VOLUME:Number = 0.5;
public static const nENEMY3_PURSUIT_RANGE_Y:Number = 150;
public static const nENEMY_FLOAT_MAX_SPEED_Y:Number = -2;
public static const sHS_MSG_LIST_EMPTY:String = "Oops! The High Scores list is not available right now!";
public static const nCOLLECTIBLE_DECEL_Y:Number = 1.34;
public static const nENEMY_JUMP_SPEED_X:Number = 5;
public static const nCOLLECTIBLE_MAX_BFF_PER_LEVEL:Number = 2;
public static const nENEMY_ANGRY_BUBBLE_TIME:Number = 95;
public static const iSTAGE_FPS:Number = 35;
public static const nCOLLECTIBLE_MIN_SPEED_X:Number = 1;
public static const nCOLLECTIBLE_MIN_SPEED_Y:Number = 1;
public static const nPLAYER_HURTING_TIME:Number = 25;
public static const nPOINTS_COMB:Number = 200;
public static const nPOPPIN_POPUP_VOLUME:Number = 0.7;
public static const nLEVEL_TIME:Array = [2100, 2100, 4200, 5250, 6300, 6300];
public static const nPLAYER_MIN_SPEED_X:Number = 4;
public static const nPLAYER_MIN_SPEED_Y:Number = 1;
public static const nENEMY_FLOAT_ACCEL_Y:Number = 1.1;
public static const nBUBBLE_ACCEL_Y:Number = 1.1;
public static const nPLAYER_MIN_FALL_SPEED_Y:Number = 1;
public static const nTIPS_POPUP_IN_VOLUME:Number = 1;
public static const nMUSIC_INGAME_VOLUME:Number = 0.55;
public static const nWIN_VOLUME:Number = 0.7;
public static const nPOINTS_ENEMY_BUBBLE:Number = 50;
public static const nPLAYER_HURT_VOLUME:Number = 0.8;
public static const nCOLLECTIBLE_FRACTION_SPEED_X:Number = 0.5;
public static const nMAX_LEVEL:Number = 6;
public static const nPOINTS_HAIRSPRAY:Number = 100;
public static const nBUBBLE_BUMP_VOLUME:Number = 1;
public static var nSCORE:Number = 0;
public static var iCATEGORY_SOUND_VOLUME:int = 1;
public static var iCATEGORY_MUSIC_VOLUME:int = 1;
public static var nPLAYER_LIVES:Number = 0;
public static var nLEVEL:Number = 1;
}
}//package
Section 172
//Main (Main)
package {
import flash.events.*;
import library.sounds.*;
import flash.display.*;
import gameplay.*;
import library.basic.*;
import popups.*;
import library.utils.*;
import library.events.*;
import screens.*;
public class Main extends MovieClip {
private var oGame:Game;
protected var oNickServices:NickServices;
private var oPopupLevel:PopupLevel;
private var sStateTransit:String;
private var oTransition:Transition;
private var oPopupReady:PopupReady;
private var oPopupTips:PopupTips;
private var oPopupQuit:PopupQuit;
private var oPopupMenu:PopupMenu;
private var oPopupPoppin:PopupPoppin;
private var oDepthManager:DepthManager;
private var oPopupHelp:PopupHelp;
protected var bScoreIsSubmitted:Boolean;
private var oScreen:Screen;
private var oPopupBlocker:PopupBlocker;
private var mcLoadingScreen:MovieClip;
private var sState:String;
public var oSoundPlayer:SoundPlayer;
public static const sPOPUP_READY:String = "ready";
public static const sSTATE_HS_TITLE:String = "highScoreTitle";
public static const sSTATE_LOADED:String = "loaded";
public static const sPOPUP_HELP:String = "help";
public static const sSTATE_HS:String = "highScore";
public static const sPOPUP_QUIT:String = "quit";
public static const sSTATE_LOSE:String = "lose";
public static const sSTATE_TITLE:String = "title";
public static const sSTATE_WIN:String = "win";
public static const sDEPTH_POPUP:String = "popup";
public static const sPOPUP_LEVEL:String = "level";
public static const sPOPUP_BLOCKER:String = "blocker";
public static const sDEPTH_TRANSITION:String = "transition";
public static const sPOPUP_MENU:String = "menu";
public static const sPOPUP_POPPIN:String = "poppin";
public static const sSTATE_GAME:String = "game";
public static const sDEPTH_SCREEN:String = "screen";
public static const sPOPUP_TIPS:String = "tips";
private static var oInstance:Main;
public function Main(){
oInstance = this;
oNickServices = new NickServices();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
addEventListener(Event.UNLOAD, unload, false, 0, true);
}
private function unload(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, update, false);
removeEventListener(Event.UNLOAD, unload, false);
dispatchEvent(new MainEvent(MainEvent.EVENT_DESTROY, false, false));
oDepthManager.destroy(null);
oDepthManager = null;
oPopupMenu = null;
oPopupHelp = null;
oPopupQuit = null;
oPopupBlocker = null;
oTransition = null;
oScreen = null;
oGame = null;
}
public function get popupHelp():PopupHelp{
return (oPopupHelp);
}
public function pauseGame():void{
dispatchEvent(new MainEvent(MainEvent.EVENT_PAUSE, false, false));
}
public function get popupQuit():PopupQuit{
return (oPopupQuit);
}
public function get popupMenu():PopupMenu{
return (oPopupMenu);
}
public function get popupLevel():PopupLevel{
return (oPopupLevel);
}
private function onTransitionFull(_arg1:Event):void{
setState(sStateTransit);
oTransition.removeEventListener(TransitionEvent.EVENT_FULL_SCREEN, onTransitionFull, false);
}
public function get gameManager():Game{
return (oGame);
}
public function initVariables():void{
Data.nSCORE = 0;
Data.nLEVEL = 1;
Data.nPLAYER_LIVES = Data.nPLAYER_MAX_LIVES;
}
private function loadState():void{
var _local1:MovieClip;
switch (state){
case sSTATE_LOADED:
mcLoadingScreen = addScreen();
transitTo(sSTATE_TITLE);
break;
case sSTATE_TITLE:
oSoundPlayer.playPackMusic();
_local1 = addScreen();
oScreen = new TitleScreen(_local1);
break;
case sSTATE_GAME:
oSoundPlayer.playInGameMusic();
_local1 = addScreen();
oGame = new Game(_local1);
oGame.manageGameStep();
break;
case sSTATE_LOSE:
oSoundPlayer.playLose();
_local1 = addScreen();
oScreen = new LoseScreen(_local1);
break;
case sSTATE_WIN:
oSoundPlayer.playWin();
_local1 = addScreen();
oScreen = new WinScreen(_local1);
break;
case sSTATE_HS_TITLE:
_local1 = addScreen();
oScreen = new HSTitleScreen(_local1);
break;
case sSTATE_HS:
oSoundPlayer.playPackMusic();
_local1 = addScreen();
oScreen = new HSScreen(_local1);
break;
};
}
public function set ScoreSubmitted(_arg1:Boolean):void{
bScoreIsSubmitted = _arg1;
}
public function setState(_arg1:String):void{
if (((!((_arg1 == state))) || ((state == sSTATE_GAME)))){
if (state != null){
unloadState();
};
sState = _arg1;
loadState();
};
}
public function get IsScoreSubmitted():Boolean{
return (bScoreIsSubmitted);
}
public function get state():String{
return (sState);
}
private function addScreen():MovieClip{
var _local1:DisplayObjectContainer;
var _local2:MovieClip;
_local1 = oDepthManager.getDepthLayer(sDEPTH_SCREEN);
if (oScreen != null){
if (oScreen.mcRef != null){
_local1.removeChild(oScreen.mcRef);
};
oScreen.destroy(null);
oScreen = null;
};
if (mcLoadingScreen != null){
_local1.removeChild(mcLoadingScreen);
mcLoadingScreen = null;
};
switch (sState){
case sSTATE_LOADED:
_local2 = new mcScreenLoaded();
break;
case sSTATE_TITLE:
_local2 = new mcScreenTitle();
break;
case sSTATE_GAME:
_local2 = new mcScreenGame();
break;
case sSTATE_LOSE:
_local2 = new mcScreenLose();
break;
case sSTATE_WIN:
_local2 = new mcScreenWin();
break;
case sSTATE_HS_TITLE:
_local2 = new mcScreenHSTitle();
break;
case sSTATE_HS:
_local2 = new mcScreenHS();
break;
};
_local1.addChild(_local2);
return (_local2);
}
private function onAddedToStage(_arg1:Event):void{
oDepthManager = new DepthManager();
oDepthManager.addDepthLayer(sDEPTH_SCREEN, this);
oDepthManager.addDepthLayer(sDEPTH_POPUP, this);
oDepthManager.addDepthLayer(sDEPTH_TRANSITION, this);
SoundManager.init();
SoundManager.addCategory(Data.sCATEGORY_MUSIC_LINKAGE, Data.iCATEGORY_MUSIC_VOLUME);
SoundManager.addCategory(Data.sCATEGORY_SOUND_LINKAGE, Data.iCATEGORY_SOUND_VOLUME);
oSoundPlayer = new SoundPlayer();
this.stage.showDefaultContextMenu = false;
setState(sSTATE_LOADED);
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false);
}
public function addPopup(_arg1:String):void{
var _local2:MovieClip;
var _local3:DisplayObjectContainer;
_local3 = oDepthManager.getDepthLayer(sDEPTH_POPUP);
switch (_arg1){
case sPOPUP_LEVEL:
_local2 = new mcPopupLevel();
oPopupLevel = new PopupLevel(_local2);
break;
case sPOPUP_READY:
_local2 = new mcPopupReady();
oPopupReady = new PopupReady(_local2);
break;
case sPOPUP_POPPIN:
_local2 = new mcPopupPoppin();
oPopupPoppin = new PopupPoppin(_local2);
break;
case sPOPUP_TIPS:
_local2 = new mcPopupTips();
oPopupTips = new PopupTips(_local2);
break;
case sPOPUP_MENU:
oSoundPlayer.stopAllSFX();
_local2 = new mcPopupMenu();
oPopupMenu = new PopupMenu(_local2);
break;
case sPOPUP_HELP:
_local2 = new mcPopupHelp();
oPopupHelp = new PopupHelp(_local2);
break;
case sPOPUP_QUIT:
_local2 = new mcPopupQuit();
oPopupQuit = new PopupQuit(_local2);
break;
case sPOPUP_BLOCKER:
_local2 = new mcPopupBlocker();
oPopupBlocker = new PopupBlocker(_local2);
break;
};
_local3.addChild(_local2);
}
public function transitTo(_arg1:String):void{
var _local2:DisplayObjectContainer;
var _local3:MovieClip;
if (oTransition == null){
_local2 = oDepthManager.getDepthLayer(sDEPTH_TRANSITION);
_local3 = new mcTransition();
_local2.addChild(_local3);
sStateTransit = _arg1;
oTransition = new Transition(_local3);
oTransition.addEventListener(TransitionEvent.EVENT_FULL_SCREEN, onTransitionFull, false, 0, true);
oTransition.addEventListener(TransitionEvent.EVENT_COMPLETE, onTransitionComplete, false, 0, true);
};
}
public function removePopup(_arg1:Popup):void{
if (_arg1 != null){
switch (_arg1){
case oPopupLevel:
if (oPopupLevel != null){
oPopupLevel.destroy(null);
};
oPopupLevel = null;
break;
case oPopupReady:
if (oPopupReady != null){
oPopupReady.destroy(null);
};
oPopupReady = null;
break;
case oPopupPoppin:
if (oPopupPoppin != null){
oPopupPoppin.destroy(null);
};
oPopupPoppin = null;
break;
case oPopupTips:
if (oPopupTips != null){
oPopupTips.destroy(null);
};
oPopupTips = null;
break;
case oPopupMenu:
if (oPopupMenu != null){
oPopupMenu.destroy(null);
};
oPopupMenu = null;
break;
case oPopupHelp:
if (oPopupHelp != null){
oPopupHelp.destroy(null);
};
oPopupHelp = null;
break;
case oPopupQuit:
if (oPopupQuit != null){
oPopupQuit.destroy(null);
};
oPopupQuit = null;
break;
case oPopupBlocker:
if (oPopupBlocker != null){
oPopupBlocker.destroy(null);
};
oPopupBlocker = null;
break;
};
};
}
private function update(_arg1:Event):void{
dispatchEvent(new MainEvent(MainEvent.EVENT_UPDATE, false, false));
}
public function get MyNickServices():NickServices{
return (oNickServices);
}
public function resumeGame():void{
dispatchEvent(new MainEvent(MainEvent.EVENT_RESUME, false, false));
}
public function get popupBlocker():PopupBlocker{
return (oPopupBlocker);
}
private function unloadState():void{
switch (state){
case sSTATE_LOADED:
break;
case sSTATE_TITLE:
break;
case sSTATE_GAME:
oGame.destroy(null);
oGame = null;
break;
case sSTATE_LOSE:
break;
case sSTATE_WIN:
break;
case sSTATE_HS_TITLE:
break;
case sSTATE_HS:
break;
};
removePopup(oPopupMenu);
removePopup(oPopupHelp);
removePopup(oPopupQuit);
removePopup(oPopupBlocker);
}
private function onTransitionComplete(_arg1:Event):void{
oTransition.destroy(null);
oTransition.removeEventListener(TransitionEvent.EVENT_COMPLETE, onTransitionComplete, false);
oTransition = null;
}
public static function get instance():Main{
return (oInstance);
}
}
}//package
Section 173
//mcAllSideBlocker (mcAllSideBlocker)
package {
import flash.display.*;
public dynamic class mcAllSideBlocker extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 174
//mcBGLevel1 (mcBGLevel1)
package {
import flash.display.*;
public dynamic class mcBGLevel1 extends MovieClip {
}
}//package
Section 175
//mcBGLevel2 (mcBGLevel2)
package {
import flash.display.*;
public dynamic class mcBGLevel2 extends MovieClip {
}
}//package
Section 176
//mcBGLevel3 (mcBGLevel3)
package {
import flash.display.*;
public dynamic class mcBGLevel3 extends MovieClip {
}
}//package
Section 177
//mcBGLevel4 (mcBGLevel4)
package {
import flash.display.*;
public dynamic class mcBGLevel4 extends MovieClip {
}
}//package
Section 178
//mcBGLevel5 (mcBGLevel5)
package {
import flash.display.*;
public dynamic class mcBGLevel5 extends MovieClip {
}
}//package
Section 179
//mcBGLevel6 (mcBGLevel6)
package {
import flash.display.*;
public dynamic class mcBGLevel6 extends MovieClip {
}
}//package
Section 180
//mcBubble (mcBubble)
package {
import flash.display.*;
public dynamic class mcBubble extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 181
//mcCeiling (mcCeiling)
package {
import flash.display.*;
public dynamic class mcCeiling extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 182
//mcCollectBFF (mcCollectBFF)
package {
import flash.display.*;
public dynamic class mcCollectBFF extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 183
//mcCollectBFF2 (mcCollectBFF2)
package {
import flash.display.*;
public dynamic class mcCollectBFF2 extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 184
//mcCollectComb (mcCollectComb)
package {
import flash.display.*;
public dynamic class mcCollectComb extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 185
//mcCollectHairPiece (mcCollectHairPiece)
package {
import flash.display.*;
public dynamic class mcCollectHairPiece extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 186
//mcCollectHairSpray (mcCollectHairSpray)
package {
import flash.display.*;
public dynamic class mcCollectHairSpray extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 187
//mcEnemy1 (mcEnemy1)
package {
import flash.display.*;
public dynamic class mcEnemy1 extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 188
//mcEnemy1Start (mcEnemy1Start)
package {
import flash.display.*;
public dynamic class mcEnemy1Start extends MovieClip {
}
}//package
Section 189
//mcEnemy2 (mcEnemy2)
package {
import flash.display.*;
public dynamic class mcEnemy2 extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 190
//mcEnemy2BFF (mcEnemy2BFF)
package {
import flash.display.*;
public dynamic class mcEnemy2BFF extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 191
//mcEnemy2BFFStart (mcEnemy2BFFStart)
package {
import flash.display.*;
public dynamic class mcEnemy2BFFStart extends MovieClip {
}
}//package
Section 192
//mcEnemy2Start (mcEnemy2Start)
package {
import flash.display.*;
public dynamic class mcEnemy2Start extends MovieClip {
}
}//package
Section 193
//mcEnemy3 (mcEnemy3)
package {
import flash.display.*;
public dynamic class mcEnemy3 extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 194
//mcEnemy3Start (mcEnemy3Start)
package {
import flash.display.*;
public dynamic class mcEnemy3Start extends MovieClip {
}
}//package
Section 195
//mcEnemyRandomStart (mcEnemyRandomStart)
package {
import flash.display.*;
public dynamic class mcEnemyRandomStart extends MovieClip {
}
}//package
Section 196
//mcFocusKeeper (mcFocusKeeper)
package {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public dynamic class mcFocusKeeper extends MovieClip {
public var txtFocusKeeper:TextField;
public function mcFocusKeeper(){
addFrameScript(0, frame1);
}
public function onFocusIn(_arg1:FocusEvent){
if (!(_arg1.target is TextField)){
stage.focus = this.txtFocusKeeper;
};
}
function frame1(){
stage.addEventListener(FocusEvent.FOCUS_IN, onFocusIn);
stage.addEventListener(FocusEvent.FOCUS_OUT, onFocusOut);
stage.focus = this.txtFocusKeeper;
}
public function onFocusOut(_arg1:FocusEvent){
stage.focus = this.txtFocusKeeper;
}
}
}//package
Section 197
//mcGround (mcGround)
package {
import flash.display.*;
public dynamic class mcGround extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 198
//mcHUD (mcHUD)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcHUD extends MovieClip {
public var mcHudLives:MovieClip;
public var txtScore:TextField;
public var txtTime:TextField;
public var mcHudBFF:MovieClip;
public var btnMenu:SimpleButton;
}
}//package
Section 199
//mcJumpLeft (mcJumpLeft)
package {
import flash.display.*;
public dynamic class mcJumpLeft extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 200
//mcJumpPoint (mcJumpPoint)
package {
import flash.display.*;
public dynamic class mcJumpPoint extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 201
//mcJumpRight (mcJumpRight)
package {
import flash.display.*;
public dynamic class mcJumpRight extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 202
//mcLevels (mcLevels)
package {
import flash.display.*;
public dynamic class mcLevels extends MovieClip {
public var mcLevel:MovieClip;
}
}//package
Section 203
//mcPlayer (mcPlayer)
package {
import flash.display.*;
public dynamic class mcPlayer extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcBubbleGenerator:MovieClip;
public var mcState:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 204
//mcPlayerStart (mcPlayerStart)
package {
import flash.display.*;
public dynamic class mcPlayerStart extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 205
//mcPopupBlocker (mcPopupBlocker)
package {
import flash.display.*;
public dynamic class mcPopupBlocker extends MovieClip {
public var mcBlocker:SimpleButton;
}
}//package
Section 206
//mcPopupHelp (mcPopupHelp)
package {
import flash.display.*;
public dynamic class mcPopupHelp extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 207
//mcPopupLevel (mcPopupLevel)
package {
import flash.display.*;
public dynamic class mcPopupLevel extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 208
//mcPopupMenu (mcPopupMenu)
package {
import flash.display.*;
public dynamic class mcPopupMenu extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 209
//mcPopupPoppin (mcPopupPoppin)
package {
import flash.display.*;
public dynamic class mcPopupPoppin extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 210
//mcPopupQuit (mcPopupQuit)
package {
import flash.display.*;
public dynamic class mcPopupQuit extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 211
//mcPopupReady (mcPopupReady)
package {
import flash.display.*;
public dynamic class mcPopupReady extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 212
//mcPopupTips (mcPopupTips)
package {
import flash.display.*;
public dynamic class mcPopupTips extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 213
//mcReverseLeftPoint (mcReverseLeftPoint)
package {
import flash.display.*;
public dynamic class mcReverseLeftPoint extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 214
//mcReverseRightPoint (mcReverseRightPoint)
package {
import flash.display.*;
public dynamic class mcReverseRightPoint extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 215
//mcScreenGame (mcScreenGame)
package {
import flash.display.*;
public dynamic class mcScreenGame extends MovieClip {
public var mcGameContainer:MovieClip;
}
}//package
Section 216
//mcScreenHS (mcScreenHS)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcScreenHS extends MovieClip {
public var txtScore:TextField;
public var txtRanks:TextField;
public var btnPlayAgain:SimpleButton;
public var btnSubmitHS:SimpleButton;
public var txtScores:TextField;
public var Scroller_mc:MovieClip;
public var txtUsernames:TextField;
public var txtUnavailable:TextField;
}
}//package
Section 217
//mcScreenHSTitle (mcScreenHSTitle)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcScreenHSTitle extends MovieClip {
public var txtRanks:TextField;
public var btnBack:SimpleButton;
public var txtScores:TextField;
public var Scroller_mc:MovieClip;
public var txtUsernames:TextField;
public var txtUnavailable:TextField;
}
}//package
Section 218
//mcScreenLoaded (mcScreenLoaded)
package {
import flash.display.*;
public dynamic class mcScreenLoaded extends MovieClip {
}
}//package
Section 219
//mcScreenLose (mcScreenLose)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcScreenLose extends MovieClip {
public var txtScore:TextField;
public var btnViewHS:SimpleButton;
public var btnPlayAgain:SimpleButton;
public var btnSubmitHS:SimpleButton;
}
}//package
Section 220
//mcScreenTitle (mcScreenTitle)
package {
import flash.display.*;
public dynamic class mcScreenTitle extends MovieClip {
public var btnViewHS:SimpleButton;
public var btnPlay:SimpleButton;
public var btnHelp:SimpleButton;
}
}//package
Section 221
//mcScreenWin (mcScreenWin)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mcScreenWin extends MovieClip {
public var txtScore:TextField;
public var btnViewHS:SimpleButton;
public var btnPlayAgain:SimpleButton;
public var btnSubmitHS:SimpleButton;
}
}//package
Section 222
//mcTransition (mcTransition)
package {
import flash.display.*;
public dynamic class mcTransition extends MovieClip {
public var mcBlocker:SimpleButton;
public var mcState:MovieClip;
}
}//package
Section 223
//mcUpLeftBlocker (mcUpLeftBlocker)
package {
import flash.display.*;
public dynamic class mcUpLeftBlocker extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 224
//mcUpRightBlocker (mcUpRightBlocker)
package {
import flash.display.*;
public dynamic class mcUpRightBlocker extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 225
//mcWallBottom (mcWallBottom)
package {
import flash.display.*;
public dynamic class mcWallBottom extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 226
//mcWallLeft (mcWallLeft)
package {
import flash.display.*;
public dynamic class mcWallLeft extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 227
//mcWallRight (mcWallRight)
package {
import flash.display.*;
public dynamic class mcWallRight extends MovieClip {
public var mcLeftDownBorder:MovieClip;
public var mcForm:MovieClip;
public var mcRightUpBorder:MovieClip;
}
}//package
Section 228
//NickServices (NickServices)
package {
import flash.events.*;
import flash.display.*;
import com.nickonline.services.business.*;
import flash.system.*;
import flash.net.*;
public class NickServices extends EventDispatcher {
private var uNickPoints:uint;
private var bLogged:Boolean;
private var mcLoginUIContainer:DisplayObjectContainer;
private var oAuthenticationResponder:ProxyResponder;
private var oNickPointsResponder:ProxyResponder;
private var bAutoShowLoginUI:Boolean;
private var sNickName:String;
private var aHighScores:Array;
private var mcLoginUI:Sprite;
private var sSubmitScoreGameID:String;
private var mcLoginUIBackground:Sprite;
private var bReady:Boolean;
private var bSubmitScoreUserValidation:Boolean;
private var sBaseURL:String;
private var uSubmitScoreScore:uint;
private var oServiceLocator:ServiceLocator;
private var oHighScoresResponder:ProxyResponder;
public static const sLOCAL_BASE_URL:String = "www.nick-q.mtvi.com";
public static const sEVENT_USER_LOGGED_OUT:String = "userLoggedOut";
public static const sEVENT_ERROR:String = "error";
public static const nLOGIN_UI_BACKGROUND_ALPHA:Number = 0.8;
public static const nLOGIN_UI_BACKGROUND_COLOR:Number = 0;
public static const sEVENT_LOGIN_UI_RECEIVED:String = "loginReceived";
public static const sSERVICE_MANAGER_CONFIG_URL:String = "/common/flash/services/data/services.xml";
public static const sEVENT_SCORES_RECEIVED:String = "scoresReceived";
public static const sEVENT_NICK_POINTS_AWARDING_COMPLETED:String = "nickPointsAwardingCompleted";
public static const sSERVICE_MANAGER_URL:String = "/common/flash/services/ServiceManager.swf";
public static const sEVENT_USER_STATUS_RECEIVED:String = "userStatusReceived";
public static const sEVENT_SERVICES_READY:String = "servicesReady";
public static const sEVENT_SCORE_SUBMISSION_COMPLETED:String = "scoreSubmissionCompleted";
public function NickServices(){
init();
}
public function requestUserStatus():void{
if (bReady){
oServiceLocator.execute("Authentication", "checkLogin", null, oAuthenticationResponder);
};
}
public function requestScores(_arg1:String):void{
if (bReady){
oServiceLocator.execute("HighScores", "doLoadHighScores", new Array(_arg1), oHighScoresResponder);
};
}
private function loginFadeIn():void{
mcLoginUIBackground = new Sprite();
mcLoginUIBackground.graphics.beginFill(nLOGIN_UI_BACKGROUND_COLOR);
mcLoginUIBackground.graphics.drawRect(0, 0, mcLoginUIContainer.stage.stageWidth, mcLoginUIContainer.stage.stageHeight);
mcLoginUIBackground.alpha = 0;
mcLoginUIBackground.addEventListener(Event.ENTER_FRAME, onFadeInEnterFrame);
mcLoginUIContainer.addChild(mcLoginUIBackground);
}
private function init():void{
if (new LocalConnection().domain == "localhost"){
sBaseURL = ("http://" + sLOCAL_BASE_URL);
Security.allowDomain(sLOCAL_BASE_URL);
} else {
sBaseURL = "";
};
oServiceLocator = new ServiceLocator(sSERVICE_MANAGER_URL, sSERVICE_MANAGER_CONFIG_URL);
oServiceLocator.defaultURI = sBaseURL;
oServiceLocator.addEventListener("EVENT_SERVICES_LOADED", onServiceReady);
oServiceLocator.addEventListener("EVENT_SERVICE_INVALID", onServiceInvalid);
oServiceLocator.addEventListener("EVENT_SERVICES_NOT_FOUND", onServiceNotFound);
try {
oServiceLocator.load();
} catch(_e:SecurityError) {
};
}
private function loginFadeOut():void{
mcLoginUIBackground.addEventListener(Event.ENTER_FRAME, onFadeOutEnterFrame);
}
private function onFadeInEnterFrame(_arg1:Event):void{
mcLoginUIBackground.alpha = (mcLoginUIBackground.alpha + 0.1);
if (mcLoginUIBackground.alpha >= nLOGIN_UI_BACKGROUND_ALPHA){
mcLoginUIBackground.removeEventListener(Event.ENTER_FRAME, onFadeInEnterFrame);
};
}
public function get nickName():String{
return (sNickName);
}
private function saveUserInfos(_arg1:Object):void{
sNickName = _arg1.nickName;
uNickPoints = _arg1.points;
}
private function onAuthenticationError(_arg1:Event):void{
dispatchError(("Authentication service error: " + _arg1.type));
}
private function onNickPointsError(_arg1:Event):void{
dispatchError(("Nick Points service error: " + _arg1.type));
}
public function get nickPoints():uint{
return (uNickPoints);
}
public function requestLoginUI(_arg1:Boolean=false, _arg2:DisplayObjectContainer=null):void{
if (bReady){
if (_arg1){
if (_arg2 == null){
} else {
bAutoShowLoginUI = true;
mcLoginUIContainer = _arg2;
loginFadeIn();
};
};
oServiceLocator.execute("Authentication", "getLogin", null, oAuthenticationResponder);
};
}
private function onFadeOutEnterFrame(_arg1:Event):void{
mcLoginUIBackground.alpha = (mcLoginUIBackground.alpha - 0.1);
if (mcLoginUIBackground.alpha <= 0){
mcLoginUIBackground.removeEventListener(Event.ENTER_FRAME, onFadeOutEnterFrame);
mcLoginUIContainer.removeChild(mcLoginUIBackground);
mcLoginUIBackground = null;
dispatchEvent(new Event(sEVENT_USER_STATUS_RECEIVED));
};
}
public function get ready():Boolean{
return (bReady);
}
private function onAuthenticationResult(_arg1:Object):void{
switch (_arg1.type){
case "LOGIN_CHECK_LOGGED_IN":
bLogged = true;
saveUserInfos(_arg1.data);
if (bSubmitScoreUserValidation){
bSubmitScoreUserValidation = false;
oServiceLocator.execute("HighScores", "doSubmitHighScore", new Array(sSubmitScoreGameID, uSubmitScoreScore, sNickName), oHighScoresResponder);
} else {
dispatchEvent(new Event(sEVENT_USER_STATUS_RECEIVED));
};
break;
case "LOGIN_CHECK_LOGGED_OUT":
bLogged = false;
saveUserInfos(new Object());
if (bSubmitScoreUserValidation){
bSubmitScoreUserValidation = false;
dispatchEvent(new Event(sEVENT_USER_LOGGED_OUT));
} else {
dispatchEvent(new Event(sEVENT_USER_STATUS_RECEIVED));
};
break;
case "LOGIN_UI_LOADED":
mcLoginUI = _arg1.data;
if (bAutoShowLoginUI){
mcLoginUI.x = ((mcLoginUIContainer.stage.stageWidth - mcLoginUI.width) / 2);
mcLoginUI.y = ((mcLoginUIContainer.stage.stageHeight - mcLoginUI.height) / 2);
mcLoginUIContainer.addChild(mcLoginUI);
};
dispatchEvent(new Event(sEVENT_LOGIN_UI_RECEIVED));
break;
case "LOGIN_COMPLETE":
bLogged = true;
saveUserInfos(_arg1.data);
if (bAutoShowLoginUI){
bAutoShowLoginUI = false;
mcLoginUIContainer.removeChild(mcLoginUI);
mcLoginUI = null;
loginFadeOut();
} else {
dispatchEvent(new Event(sEVENT_USER_STATUS_RECEIVED));
};
break;
};
}
private function dispatchError(_arg1:String):void{
dispatchEvent(new ErrorEvent(sEVENT_ERROR, false, false, _arg1));
}
public function get logged():Boolean{
return (bLogged);
}
public function get loginUI():Sprite{
return (mcLoginUI);
}
private function onHighScoresError(_arg1:Event):void{
dispatchError(("HighScores service error: " + _arg1.type));
}
private function onServiceInvalid(_arg1:Event):void{
dispatchError("Services invalid.");
}
private function onHighScoresResult(_arg1:Object):void{
var _local2:Object;
switch (_arg1.type){
case "SUBMIT_SCORES_SUCCESS":
dispatchEvent(new Event(sEVENT_SCORE_SUBMISSION_COMPLETED));
break;
case "LOAD_SCORES_SUCCESS":
aHighScores = [];
for each (_local2 in _arg1.data.scores) {
aHighScores.push({nRank:_local2.rank, sNickName:_local2.name, nScore:_local2.score});
};
dispatchEvent(new Event(sEVENT_SCORES_RECEIVED));
break;
};
}
private function onNickPointsResult(_arg1:Object):void{
dispatchEvent(new Event(sEVENT_NICK_POINTS_AWARDING_COMPLETED));
}
private function onServiceNotFound(_arg1:Event):void{
dispatchError("Services not found.");
}
public function submitScore(_arg1:String, _arg2:uint):void{
if (bReady){
requestUserStatus();
bSubmitScoreUserValidation = true;
sSubmitScoreGameID = _arg1;
uSubmitScoreScore = _arg2;
};
}
public function awardNickPoints(_arg1:String, _arg2:String):void{
if (bReady){
oServiceLocator.execute("NickPointsCampaign", "awardNickPoints", new Array(_arg1, _arg2), oHighScoresResponder);
};
}
public function get highScores():Array{
return (aHighScores);
}
public function destroy():void{
mcLoginUI = null;
mcLoginUIContainer = null;
mcLoginUIBackground = null;
}
private function onServiceReady(_arg1:Event):void{
bReady = true;
oAuthenticationResponder = new ProxyResponder(onAuthenticationResult, onAuthenticationError);
oHighScoresResponder = new ProxyResponder(onHighScoresResult, onHighScoresError);
oNickPointsResponder = new ProxyResponder(onNickPointsResult, onNickPointsError);
dispatchEvent(new Event(sEVENT_SERVICES_READY));
}
}
}//package
Section 229
//SoundPlayer (SoundPlayer)
package {
import library.sounds.*;
public class SoundPlayer {
private const nFADE_RATE:Number = 0.2;
private var oCollectible:SoundItem;
private var oButtonClick:SoundItem;
private var oReadyPopup:SoundItem;
private var oBtnClick:SoundItem;
private var oTransition:SoundItem;
private var oTipsPopup:SoundItem;
private var oMusicPack:SoundItem;
private var oBubbleBump:SoundItem;
private var oPlayer:SoundItem;
private var oEnemyBubbled:SoundItem;
private var oMusicInGame:SoundItem;
private var oBFFPowerUp:SoundItem;
private var oEnemyBrake:SoundItem;
private var oPlayerHurt:SoundItem;
private var oBtnOver:SoundItem;
private var oEnemyLand:SoundItem;
private var oEnemyIdle:SoundItem;
private var oEnemyDie:SoundItem;
private var oBubblePopping:SoundItem;
private var oLoseWinJingle:SoundItem;
private var oEnemyRun:SoundItem;
private var oEnemyAngryBubble:SoundItem;
private var oMenu:SoundItem;
private var oBFFCollect:SoundItem;
private var oButtonOver:SoundItem;
public function SoundPlayer():void{
}
public function stopPlayerSFX():void{
if (oPlayer != null){
oPlayer.doStop();
};
}
public function stopEnemyRun():void{
if (oEnemyRun != null){
oEnemyRun.doStop();
};
}
public function playWin():void{
if (oMusicInGame != null){
oMusicInGame.setFadeRate(nFADE_RATE);
oMusicInGame.fadeTo(0, true);
};
oLoseWinJingle = SoundManager.playSoundInCat(Data.sCATEGORY_MUSIC_LINKAGE, "Win_jingle.wav", Data.nWIN_VOLUME, 1, 0, true, playPackMusic);
}
public function playPlayerDie():void{
if (oPlayer != null){
oPlayer.doStop();
};
oPlayer = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "SBDie.wav", Data.nPLAYER_DIE_VOLUME, 1, 0, true);
}
public function playPoppinPopup():void{
if (oReadyPopup != null){
oReadyPopup.doStop();
};
oReadyPopup = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "PopupLetsGetPoppin.wav", Data.nPOPPIN_POPUP_VOLUME, 1, 0, true);
}
public function playPlayerRun():void{
oPlayer = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "SBRun.wav", Data.nPLAYER_RUN_VOLUME, 1, 0, true);
}
public function stopEnemyAngryBubble():void{
if (oEnemyAngryBubble != null){
oEnemyAngryBubble.doStop();
};
}
public function playButtonClick():void{
if (oButtonClick != null){
oButtonClick.doStop();
};
oButtonClick = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "ButtonsClick_01.wav", Data.nBUTTON_CLICK_VOLUME, 1);
}
public function playEnemyIdle():void{
oEnemyIdle = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "EnemyIdle.wav", Data.nENEMY_IDLE_VOLUME, 1, 0, true);
}
public function playEnemyDie():void{
if (oEnemyDie != null){
oEnemyDie.doStop();
};
oEnemyDie = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "EnemyDie.wav", Data.nENEMY_DIE_VOLUME, 1, 0, true);
}
public function playTransitionIn():void{
if (oTransition != null){
oTransition.doStop();
};
oTransition = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "Transition_in.wav", Data.nTRANSITION_IN_VOLUME, 1, 0, true);
}
public function stopEnemyBrake():void{
if (oEnemyBrake != null){
oEnemyBrake.doStop();
};
}
public function playReadyPopup():void{
if (oReadyPopup != null){
oReadyPopup.doStop();
};
oReadyPopup = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "PopupReady.wav", Data.nREADY_POPUP_VOLUME, 1, 0, true);
}
public function playPackMusic():void{
if (oMusicInGame != null){
oMusicInGame.setFadeRate(nFADE_RATE);
oMusicInGame.fadeTo(0, true);
};
oMusicPack = SoundManager.playSoundInCat(Data.sCATEGORY_MUSIC_LINKAGE, "packaging.wav", 0, 9999, 0, true);
oMusicPack.setFadeRate(nFADE_RATE);
oMusicPack.fadeTo(Data.nMUSIC_PACK_VOLUME, false);
}
public function playEnemyAngryBubble():void{
oEnemyAngryBubble = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "EnemyAngryBubble.wav", Data.nENEMY_ANGRYBUBBLE_VOLUME, 1, 0, true);
}
public function stopEnemyIdle():void{
if (oEnemyIdle != null){
oEnemyIdle.doStop();
};
}
public function playBubbleBump():void{
if (oBubbleBump != null){
oBubbleBump.doStop();
};
oBubbleBump = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "BubbleBump_02.wav", Data.nBUBBLE_BUMP_VOLUME, 1, 0, true);
}
public function playPlayerLand():void{
if (oPlayer != null){
oPlayer.doStop();
};
oPlayer = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "SBLand.wav", Data.nPLAYER_LAND_VOLUME, 1, 0, true);
}
public function playBubblePopping():void{
if (oBubblePopping != null){
oBubblePopping.doStop();
};
oBubblePopping = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "BubblePopping_02.wav", Data.nBUBBLE_POPPING_VOLUME, 1, 0, true);
}
public function stopAllSFX():void{
if (oPlayer != null){
oPlayer.doStop();
};
if (oPlayerHurt != null){
oPlayerHurt.doStop();
};
if (oCollectible != null){
oCollectible.doStop();
};
if (oBFFCollect != null){
oBFFCollect.doStop();
};
if (oBFFPowerUp != null){
oBFFPowerUp.doStop();
};
if (oLoseWinJingle != null){
oLoseWinJingle.doStop();
};
if (oReadyPopup != null){
oReadyPopup.doStop();
};
if (oEnemyBubbled != null){
oEnemyBubbled.doStop();
};
if (oEnemyDie != null){
oEnemyDie.doStop();
};
if (oEnemyAngryBubble != null){
oEnemyAngryBubble.doStop();
};
if (oEnemyRun != null){
oEnemyRun.doStop();
};
if (oEnemyLand != null){
oEnemyLand.doStop();
};
if (oEnemyIdle != null){
oEnemyIdle.doStop();
};
if (oBubblePopping != null){
oBubblePopping.doStop();
};
if (oBubbleBump != null){
oBubbleBump.doStop();
};
}
public function playTipsOutPopup():void{
if (oTipsPopup != null){
oTipsPopup.doStop();
};
oTipsPopup = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "PopupTipsOut.wav", Data.nTIPS_POPUP_OUT_VOLUME, 1, 0, true);
}
public function stopJingle():void{
if (oLoseWinJingle != null){
oLoseWinJingle.doStop();
};
}
public function playCollectible():void{
if (oCollectible != null){
oCollectible.doStop();
};
oCollectible = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "CollectibleTaken.wav", Data.nCOLLECTIBLE_VOLUME, 1, 0, true);
}
public function playEnemyBrake():void{
if (oEnemyBrake != null){
oEnemyBrake.doStop();
};
oEnemyBrake = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "EnemyBrake.wav", Data.nENEMY_BRAKE_VOLUME, 1, 0, true);
}
public function playInGameMusic():void{
if (oMusicPack != null){
oMusicPack.setFadeRate(nFADE_RATE);
oMusicPack.fadeTo(0, true);
};
oMusicInGame = SoundManager.playSoundInCat(Data.sCATEGORY_MUSIC_LINKAGE, "in_game.wav", 0, 9999, 0, true);
oMusicInGame.setFadeRate(nFADE_RATE);
oMusicInGame.fadeTo(Data.nMUSIC_INGAME_VOLUME, false);
}
public function playTipsInPopup():void{
if (oTipsPopup != null){
oTipsPopup.doStop();
};
oTipsPopup = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "PopupTipsIn.wav", Data.nTIPS_POPUP_IN_VOLUME, 1, 0, true);
}
public function playPlayerAttack():void{
if (oPlayer != null){
oPlayer.doStop();
};
oPlayer = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "SBAttack.wav", Data.nPLAYER_ATTACK_VOLUME, 1, 0, true);
}
public function playLevelPopup():void{
if (oReadyPopup != null){
oReadyPopup.doStop();
};
oReadyPopup = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "PopupLevel.wav", Data.nLEVEL_POPUP_VOLUME, 1, 0, true);
}
public function playBFFCollectible():void{
if (oBFFCollect != null){
oBFFCollect.doStop();
};
oBFFCollect = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "CollectibleBFF.wav", Data.nBFFCOLLECT_VOLUME, 1, 0, true);
}
public function playEnemyLand():void{
if (oEnemyLand != null){
oEnemyLand.doStop();
};
oEnemyLand = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "EnemyLand.wav", Data.nENEMY_LAND_VOLUME, 1, 0, true);
}
public function playEnemyRun():void{
oEnemyRun = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "EnemyRun.wav", Data.nENEMY_RUN_VOLUME, 1, 0, true);
}
public function playPlayerHurt():void{
if (oPlayerHurt != null){
oPlayerHurt.doStop();
};
oPlayerHurt = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "SBHurt.wav", Data.nPLAYER_HURT_VOLUME, 1, 0, true);
}
public function playEnemyGetBubbled():void{
if (oEnemyBubbled != null){
oEnemyBubbled.doStop();
};
oEnemyBubbled = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "EnemyHitBubble.wav", Data.nENEMY_HITBUBBLE_VOLUME, 1, 0, true);
}
public function playLose():void{
if (oMusicInGame != null){
oMusicInGame.setFadeRate(nFADE_RATE);
oMusicInGame.fadeTo(0, true);
};
oLoseWinJingle = SoundManager.playSoundInCat(Data.sCATEGORY_MUSIC_LINKAGE, "Lose_jingle.wav", Data.nLOSE_VOLUME, 1, 0, true, playPackMusic);
}
public function playButtonOver():void{
if (oButtonOver != null){
oButtonOver.doStop();
};
oButtonOver = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "ButtonsOver_01.wav", Data.nBUTTON_OVER_VOLUME, 1);
}
public function playTransitionOut():void{
if (oTransition != null){
oTransition.doStop();
};
oTransition = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "Transition_out.wav", Data.nTRANSITION_OUT_VOLUME, 1, 0, true);
}
public function playBFFPowerUp():void{
if (oBFFPowerUp != null){
oBFFPowerUp.doStop();
};
oBFFPowerUp = SoundManager.playSoundInCat(Data.sCATEGORY_SOUND_LINKAGE, "PowerUpBFF.wav", Data.nBFF_POWERUP_VOLUME, 1, 0, true);
}
}
}//package