Frame 1
function _getHighScore(Void) {
return(CTRLParam.getRef().nScore);
}
function ShowHighScore() {
if (NGameID != undefined) {
loadMovie ((("WBHighScores.swf?GameID=" + NGameID) + "&GameScore=") + _getHighScore(), this.createEmptyMovieClip("mcHSBoard", this.getNextHighestDepth()));
}
}
stop();
Instance of Symbol 52 MovieClip "ControlLoad" in Frame 1
onClipEvent (enterFrame) {
var percent = Math.round(100 * (_parent.getBytesLoaded() / _parent.getBytesTotal()));
if (_parent.getBytesLoaded() == _parent.getBytesTotal()) {
_parent.mcMain.txtPercent.text = percent + "%";
_parent.mcMain.gotoAndStop(2);
} else {
_parent.mcMain.txtPercent.text = percent + "%";
_parent.mcMain.btnNext._visible = false;
}
}
Frame 11
new CTRLParam(this);
Frame 60
ShowHighScore();
Frame 70
ShowHighScore();
Symbol 15 MovieClip Frame 44
stop();
Symbol 20 MovieClip Frame 10
stop();
Symbol 31 MovieClip Frame 25
stop();
Symbol 32 MovieClip Frame 25
stop();
Symbol 40 MovieClip Frame 56
_parent._parent.gotoAndStop("Init");
Symbol 43 MovieClip Frame 6
stop();
Symbol 44 MovieClip Frame 1
stop();
Symbol 48 Button
on (keyPress "<Left>") {
return(undefined);
}
on (keyPress "<Right>") {
return(undefined);
}
on (keyPress "<Up>") {
return(undefined);
}
on (keyPress "<Down>") {
return(undefined);
}
Symbol 55 MovieClip Frame 1
function getReport() {
if (frate < minForBest) {
if (frate < minForHigh) {
vQuality = "MEDIUM";
} else {
vQuality = "HIGH";
}
} else {
vQuality = "BEST";
}
nbReport++;
_parent.txtFrameRate.text = frate;
_parent.txtQuality.text = vQuality;
_parent.txtFrameRate.textColor = "0";
_parent.txtQuality.textColor = "0";
_quality = vQuality;
enableReport = false;
gotoAndStop (2);
}
fcount = 0;
offset = getTimer();
_visible = false;
minForMedium = 0;
minForHigh = 22;
minForBest = 30;
nbReport = 0;
enableReport = false;
Symbol 55 MovieClip Frame 2
fcount = 0;
offset = getTimer();
Symbol 55 MovieClip Frame 3
fcount++;
Symbol 55 MovieClip Frame 4
call(3);
Symbol 55 MovieClip Frame 5
call(3);
Symbol 55 MovieClip Frame 6
call(3);
Symbol 55 MovieClip Frame 7
call(3);
Symbol 55 MovieClip Frame 8
call(3);
Symbol 55 MovieClip Frame 9
call(3);
Symbol 55 MovieClip Frame 10
call(3);
Symbol 55 MovieClip Frame 11
call(3);
Symbol 55 MovieClip Frame 12
call(3);
Symbol 55 MovieClip Frame 13
call(3);
Symbol 55 MovieClip Frame 14
call(3);
Symbol 55 MovieClip Frame 15
call(3);
Symbol 55 MovieClip Frame 16
call(3);
Symbol 55 MovieClip Frame 17
call(3);
Symbol 55 MovieClip Frame 18
call(3);
Symbol 55 MovieClip Frame 19
call(3);
Symbol 55 MovieClip Frame 20
call(3);
Symbol 55 MovieClip Frame 21
call(3);
Symbol 55 MovieClip Frame 22
call(3);
Symbol 55 MovieClip Frame 23
call(3);
Symbol 55 MovieClip Frame 24
call(3);
Symbol 55 MovieClip Frame 25
call(3);
Symbol 55 MovieClip Frame 26
call(3);
Symbol 55 MovieClip Frame 27
call(3);
Symbol 55 MovieClip Frame 28
call(3);
Symbol 55 MovieClip Frame 29
call(3);
Symbol 55 MovieClip Frame 30
call(3);
Symbol 55 MovieClip Frame 31
call(3);
curtime = (getTimer() - offset) / 1000;
frate = Math.ceil(fcount / curtime);
_parent.pointer.play();
if (enableReport) {
getReport();
} else {
_parent.txtFrameRate.text = frate;
_parent.txtQuality.text = _quality;
_parent.txtFrameRate.textColor = "16777215";
_parent.txtQuality.textColor = "16777215";
gotoAndPlay (2);
}
Symbol 64 MovieClip Frame 1
stop();
Symbol 85 MovieClip Frame 1
stop();
var l_aSndArray = new Array("SFX_BtnClick", "SFX_BtnRoll", "SFX_CageFall", "SFX_PushBlock2", "SFX_PushBlock", "SFX_Transition", "SFX_GameLoop", "SFX_PackagingLoop");
Symbol 91 MovieClip Frame 1
BtnInvisible.useHandCursor = false;
Symbol 100 MovieClip Frame 10
stop();
Symbol 114 MovieClip Frame 1
stop();
Symbol 602 MovieClip [__Packages.CTRLParam] Frame 0
class CTRLParam
{
static var oRef;
var mcTimeLine, mcMain, bPackagingMusicIsPlaying, bGameMusicIsPlaying, oCTRLGame, nCurrentLevel, bWinTheLevel, oTransition, sSection, nScore, nLivesRemaining, oSounds, bPause, oBroadcaster, aDepthList, bMuteSounds, sPath;
function CTRLParam (pMc) {
oRef = this;
mcTimeLine = pMc;
mcMain = mcTimeLine.mcMain;
mcTimeLine.onEnterFrame = Delegate.create(this, enterFrame);
init();
bPackagingMusicIsPlaying = false;
bGameMusicIsPlaying = false;
mcTimeLine.gotoAndStop("TitleCard");
TitleCard();
}
static function getRef() {
return(oRef);
}
function TitleCard() {
startPackagingLoop();
mcMain.btnPlay.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.btnPlay.onRelease = Delegate.create(this, playGame);
mcMain.btnInstructions.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.btnInstructions.onRelease = Delegate.create(this, showInstructions);
}
function Instructions() {
mcMain.mcInstructions.gotoAndStop("Show");
mcMain.mcInstructions.btnPlay.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.mcInstructions.btnPlay.onRelease = Delegate.create(this, playInstructions);
mcMain.mcInstructions.btnNext.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.mcInstructions.btnNext.onRelease = Delegate.create(this, instructionsNext);
mcMain.mcInstructions.btnBack.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.mcInstructions.btnBack.onRelease = Delegate.create(this, instructionsBack);
}
function Game() {
mcMain._x = 0;
mcMain._y = 0;
oCTRLGame = new CTRLGame(mcTimeLine, nCurrentLevel);
initGame();
}
function ResetForGame() {
flushBroadcaster();
mcTimeLine.gotoAndStop("Game");
Game();
unPauseGame();
}
function WinScreen() {
startPackagingLoop();
showScoreEnd();
mcMain.btnPlayAgain.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.btnPlayAgain.onRelease = Delegate.create(this, playAgain);
}
function LoseScreen() {
startPackagingLoop();
showScoreEnd();
mcMain.btnPlayAgain.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.btnPlayAgain.onRelease = Delegate.create(this, playAgain);
}
function ResetVariables() {
resetNewGame();
mcTimeLine.gotoAndStop("TitleCard");
TitleCard();
}
function endOfLevel() {
nCurrentLevel++;
bWinTheLevel = true;
if (nCurrentLevel > MAX_LEVEL) {
flushBroadcaster();
oTransition.goTo("WinScreen");
} else {
resetLevel();
}
}
function get _bWinTheLevel() {
return(bWinTheLevel);
}
function set _bWinTheLevel(_bToSet) {
bWinTheLevel = _bToSet;
//return(_bWinTheLevel);
}
function get _nCurrentLevel() {
return(nCurrentLevel);
}
function initGame() {
sSection = "Game";
startGameLoop();
}
function getScore() {
return(nScore);
}
function get _nLivesRemaining() {
return(nLivesRemaining);
}
function loseALife() {
bWinTheLevel = false;
nLivesRemaining--;
if (nLivesRemaining < 0) {
loseGame();
} else {
resetLevel();
}
}
function resetLevel() {
flushBroadcaster();
oTransition.goTo("ResetForGame");
}
function playBtnRollOver() {
oSounds.PlaySound("SFX_BtnRoll", 100);
}
function playBtnClick() {
oSounds.PlaySound("SFX_BtnClick", 60);
}
function playAgain() {
playBtnClick();
oTransition.goTo("ResetVariables");
}
function pauseGame() {
bPause = true;
oBroadcaster.broadcastMessage("pause");
}
function unPauseGame() {
bPause = false;
oBroadcaster.broadcastMessage("unPause");
}
function playInstructions() {
playBtnClick();
if (sSection == "Packaging") {
playGame();
} else {
CTRLGame.getRef().oInterface.hideInstructions();
}
}
function instructionsNext() {
playBtnClick();
if (sSection == "Packaging") {
mcMain.mcInstructions.nextFrame();
mcMain.mcInstructions.btnPlay.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.mcInstructions.btnPlay.onRelease = Delegate.create(this, playInstructions);
mcMain.mcInstructions.btnNext.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.mcInstructions.btnNext.onRelease = Delegate.create(this, instructionsNext);
mcMain.mcInstructions.btnBack.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.mcInstructions.btnBack.onRelease = Delegate.create(this, instructionsBack);
} else {
CTRLGame.getRef().oInterface.mcInstructions.nextFrame();
CTRLGame.getRef().oInterface.mcInstructions.btnPlay.onRollOver = Delegate.create(this, playBtnRollOver);
CTRLGame.getRef().oInterface.mcInstructions.btnPlay.onRelease = Delegate.create(this, playInstructions);
CTRLGame.getRef().oInterface.mcInstructions.btnNext.onRollOver = Delegate.create(this, playBtnRollOver);
CTRLGame.getRef().oInterface.mcInstructions.btnNext.onRelease = Delegate.create(this, instructionsNext);
CTRLGame.getRef().oInterface.mcInstructions.btnBack.onRollOver = Delegate.create(this, playBtnRollOver);
CTRLGame.getRef().oInterface.mcInstructions.btnBack.onRelease = Delegate.create(this, instructionsBack);
}
}
function instructionsBack() {
playBtnClick();
if (sSection == "Packaging") {
mcMain.mcInstructions.prevFrame();
mcMain.mcInstructions.btnPlay.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.mcInstructions.btnPlay.onRelease = Delegate.create(this, playInstructions);
mcMain.mcInstructions.btnNext.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.mcInstructions.btnNext.onRelease = Delegate.create(this, instructionsNext);
mcMain.mcInstructions.btnBack.onRollOver = Delegate.create(this, playBtnRollOver);
mcMain.mcInstructions.btnBack.onRelease = Delegate.create(this, instructionsBack);
} else {
CTRLGame.getRef().oInterface.mcInstructions.prevFrame();
CTRLGame.getRef().oInterface.mcInstructions.btnPlay.onRollOver = Delegate.create(this, playBtnRollOver);
CTRLGame.getRef().oInterface.mcInstructions.btnPlay.onRelease = Delegate.create(this, playInstructions);
CTRLGame.getRef().oInterface.mcInstructions.btnNext.onRollOver = Delegate.create(this, playBtnRollOver);
CTRLGame.getRef().oInterface.mcInstructions.btnNext.onRelease = Delegate.create(this, instructionsNext);
CTRLGame.getRef().oInterface.mcInstructions.btnBack.onRollOver = Delegate.create(this, playBtnRollOver);
CTRLGame.getRef().oInterface.mcInstructions.btnBack.onRelease = Delegate.create(this, instructionsBack);
}
}
function playGame() {
nCurrentLevel = 1;
playBtnClick();
oTransition.goTo("Game");
}
function showInstructions() {
oTransition.goTo("Instructions");
}
function showScoreEnd() {
mcMain.txtScore.text = styleNumber(nScore);
}
function winGame() {
flushBroadcaster();
oTransition.goTo("WinScreen");
}
function loseGame() {
flushBroadcaster();
oTransition.goTo("LoseScreen");
}
function styleNumber(pNumber, pMinimumChar) {
var _local7 = false;
var _local1 = String(pNumber);
var _local3 = _local1;
do {
if (_local1.length < pMinimumChar) {
_local7 = true;
_local3 = "0" + _local3;
}
} while (_local3.length < pMinimumChar);
_local1 = _local3;
var _local4 = "";
var _local6 = _local1.length;
_local6 = _local6 / 3;
if (_local6 <= 1) {
return(_local1);
}
var _local2 = _local6;
while (_local2 > 1) {
_local4 = (" " + _local1.substr(-3)) + _local4;
_local1 = _local1.substr(0, -3);
_local2--;
}
_local3 = _local1 + _local4;
return(_local3);
}
function returnDepth(pType) {
for (var _local3 in aDepthList) {
if (aDepthList[_local3].sType == pType) {
aDepthList[_local3].nCurrentDepth++;
if (aDepthList[_local3].nCurrentDepth > aDepthList[_local3].nLimitDepth) {
aDepthList[_local3].nCurrentDepth = aDepthList[_local3].nBaseDepth;
}
return(aDepthList[_local3].nCurrentDepth);
}
}
}
function resetNewGame() {
flushBroadcaster();
reInitVars();
}
function enterFrame() {
oBroadcaster.broadcastMessage("doAction");
}
function init() {
oBroadcaster = new Object();
AsBroadcaster.initialize(oBroadcaster);
bMuteSounds = false;
reInitVars();
getPath();
createTransition(mcTimeLine.mcTransition, mcTimeLine, oRef);
createSounds();
setDepths();
}
function createSounds() {
oSounds = new Sounds(mcTimeLine);
}
function setDepths() {
aDepthList = [];
aDepthList.push({sType:"Interface", nCurrentDepth:250000, nBaseDepth:250000, nLimitDepth:250000});
}
function reInitVars() {
sSection = "Packaging";
bPause = false;
nScore = 0;
nCurrentLevel = 1;
nLivesRemaining = STARTING_LIVES;
}
function createTransition(_mc, _mcTimeLine) {
oTransition = new Transition(_mc, _mcTimeLine);
}
function flushBroadcaster() {
for (var _local2 in oBroadcaster._listeners) {
if (oBroadcaster._listeners[_local2].sName != "Transition") {
oBroadcaster.removeListener(oBroadcaster._listeners[_local2]);
}
}
}
function startPackagingLoop() {
if ((bPackagingMusicIsPlaying == false) and (bMuteSounds == false)) {
bPackagingMusicIsPlaying = true;
bGameMusicIsPlaying = false;
oSounds.StopSound("SFX_GameLoop");
oSounds.PlaySound("SFX_PackagingLoop", PACKAGING_VOLUME, 99999);
}
}
function startGameLoop() {
if ((bGameMusicIsPlaying == false) and (bMuteSounds == false)) {
bPackagingMusicIsPlaying = false;
bGameMusicIsPlaying = true;
oSounds.StopSound("SFX_PackagingLoop");
oSounds.PlaySound("SFX_GameLoop", PACKAGING_VOLUME, 99999);
}
}
function getPath() {
var _local3;
var _local2 = new String(mcTimeLine._url);
if (_local2.lastIndexOf("/") == -1) {
_local3 = _local2.lastIndexOf("\\");
} else {
_local3 = _local2.lastIndexOf("/");
if (_local3 <= 10) {
_local3 = _local2.lastIndexOf("\\");
}
}
sPath = _local2.substring(0, _local3 + 1);
}
var PACKAGING_VOLUME = 40;
var MAX_LEVEL = 20;
var STARTING_LIVES = 3;
}
Symbol 603 MovieClip [__Packages.State] Frame 0
class State
{
var oCTRLParam, oCTRLGame, mcRef, bPausable, sState, nFrTotalAnim;
function State (_mc) {
oCTRLParam = CTRLParam.getRef();
oCTRLGame = CTRLGame.getRef();
mcRef = _mc;
bPausable = true;
CTRLParam.getRef().oBroadcaster.addListener(this);
}
function pause() {
mcRef.mcState.stop();
}
function unPause() {
mcRef.mcState.play();
}
function doAction() {
if (bPausable == false) {
this[sState]();
} else if (((bPausable == true) and (CTRLParam.getRef().sSection == "Game")) and (CTRLParam.getRef().bPause == false)) {
this[sState]();
}
}
function get _isStateFinished() {
var _local2 = false;
if (mcRef.mcState._currentframe >= nFrTotalAnim) {
_local2 = true;
}
return(_local2);
}
function setState(pState) {
var _local3;
if (sState != pState) {
sState = pState;
mcRef.gotoAndStop(sState);
nFrTotalAnim = mcRef.mcState._totalframes;
}
}
}
Symbol 604 MovieClip [__Packages.CTRLGame] Frame 0
class CTRLGame extends State
{
static var oRef;
var oCTRLParam, mcTimeLine, mcMain, nCurrentLevel, oInterface, nCurrentStep, nMaxStep, nBlockingIndex, nHidingObjectIndex, nMovingBlockIndex, oPlayer, oGrid;
function CTRLGame (_mcTimeLine, _nCurrentLevel) {
super();
oCTRLParam = CTRLParam.getRef();
mcTimeLine = _mcTimeLine;
mcMain = _mcTimeLine.mcMain;
nCurrentLevel = _nCurrentLevel;
oRef = this;
init();
}
static function getRef() {
return(oRef);
}
function deleteObj(_sName) {
delete this[_sName];
}
function winGame() {
oInterface.updateScore(nCurrentLevel * LEVEL_VALUE);
oInterface.updateScore((nMaxStep - nCurrentStep) * STEP_VALUE);
oCTRLParam.pauseGame();
oCTRLParam.endOfLevel();
stopAllAmbiances();
}
function loseGame() {
oCTRLParam.pauseGame();
oCTRLParam.loseGame();
stopAllAmbiances();
}
function stopAllAmbiances() {
CTRLParam.getRef().oSounds.StopSound("SFX_Ambiance01");
CTRLParam.getRef().oSounds.StopSound("SFX_Ambiance02");
CTRLParam.getRef().oSounds.StopSound("SFX_Ambiance03");
CTRLParam.getRef().oSounds.StopSound("SFX_Ambiance04");
CTRLParam.getRef().oSounds.StopSound("SFX_Ambiance05");
}
function createBlockingObject(_mcRef) {
this["Object" + nBlockingIndex] = new BlockingObject(_mcRef);
nBlockingIndex++;
}
function createHidingObject(_mcRef) {
this["Object" + nHidingObjectIndex] = new HidingObject(_mcRef);
nHidingObjectIndex++;
}
function createMovingBlock(_mcRef) {
this["MovingBlock" + nMovingBlockIndex] = new MovingBlock(_mcRef);
nMovingBlockIndex++;
}
function checkAddAStep() {
var _local2 = true;
var _local3 = nCurrentStep;
if (_local3 >= nMaxStep) {
_local2 = false;
}
return(_local2);
}
function addAStep() {
nCurrentStep++;
oInterface.updateRemainingSteps(nMaxStep - nCurrentStep);
}
function get _nMaxStep() {
return(nMaxStep);
}
function get _nCurrentLevel() {
return(nCurrentLevel);
}
function init() {
mcMain.gotoAndStop("Level" + nCurrentLevel);
initLevelVars();
createInterface(mcMain.mcInterface);
createGrid();
createPlayer();
}
function initLevelVars() {
nBlockingIndex = 1;
nMovingBlockIndex = 1;
nHidingObjectIndex = 1;
nCurrentStep = 0;
nMaxStep = this[("LEVEL" + nCurrentLevel) + "_MOVES"];
var _local2 = 80;
switch (nCurrentLevel) {
case 1 :
case 6 :
case 11 :
case 16 :
CTRLParam.getRef().oSounds.PlaySound("SFX_Ambiance01", _local2, 99999);
break;
case 2 :
case 7 :
case 12 :
case 17 :
CTRLParam.getRef().oSounds.PlaySound("SFX_Ambiance02", _local2, 99999);
break;
case 3 :
case 8 :
case 13 :
case 18 :
CTRLParam.getRef().oSounds.PlaySound("SFX_Ambiance03", _local2, 99999);
break;
case 4 :
case 9 :
case 14 :
case 19 :
CTRLParam.getRef().oSounds.PlaySound("SFX_Ambiance04", _local2, 99999);
break;
case 5 :
case 10 :
case 15 :
case 20 :
CTRLParam.getRef().oSounds.PlaySound("SFX_Ambiance05", _local2, 99999);
}
}
function createInterface(_mc) {
oInterface = new Interface(_mc);
}
function createPlayer() {
oPlayer = new Player(mcMain.mcPlayer);
}
function createGrid() {
oGrid = new Grid(mcMain.mcGrid);
}
var LEVEL1_MOVES = 15;
var LEVEL2_MOVES = 15;
var LEVEL3_MOVES = 15;
var LEVEL4_MOVES = 15;
var LEVEL5_MOVES = 18;
var LEVEL6_MOVES = 20;
var LEVEL7_MOVES = 21;
var LEVEL8_MOVES = 21;
var LEVEL9_MOVES = 21;
var LEVEL10_MOVES = 42;
var LEVEL11_MOVES = 25;
var LEVEL12_MOVES = 28;
var LEVEL13_MOVES = 32;
var LEVEL14_MOVES = 32;
var LEVEL15_MOVES = 32;
var LEVEL16_MOVES = 20;
var LEVEL17_MOVES = 60;
var LEVEL18_MOVES = 35;
var LEVEL19_MOVES = 33;
var LEVEL20_MOVES = 93;
var LEVEL_VALUE = 1000;
var STEP_VALUE = 250;
}
Symbol 605 MovieClip [__Packages.Interface] Frame 0
class Interface extends State
{
var sName, mcMenu, mcRef, mcTxtScore, mcInstructions, oCTRLParam, nMaxScore, nEnergyToGo, nCurrentEnergy, sState, nFrTotalAnim, bPausable;
function Interface (_mc) {
super(_mc);
sName = "Interface";
mcMenu = mcRef.mcMenu;
mcTxtScore = mcRef.txtScore;
mcInstructions = mcRef.mcInstructions;
mcRef.swapDepths(oCTRLParam.returnDepth("Interface"));
setState("Idle");
mcRef.txtLives.text = CTRLParam.getRef()._nLivesRemaining;
mcRef.txtSteps.text = CTRLGame.getRef()._nMaxStep;
mcRef.txtLevel.text = CTRLGame.getRef()._nCurrentLevel;
init();
mcRef.btnMenu.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcRef.btnMenu.onRelease = Delegate.create(this, showMenu);
mcRef.btnReset.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcRef.btnReset.onRelease = Delegate.create(CTRLParam.getRef(), CTRLParam.getRef().loseALife);
}
function updateRemainingSteps(_nSteps) {
mcRef.txtSteps.text = _nSteps;
}
function updateScore(pScore) {
if ((oCTRLParam.nScore + pScore) < nMaxScore) {
oCTRLParam.nScore = oCTRLParam.nScore + pScore;
} else {
oCTRLParam.nScore = nMaxScore;
}
if (oCTRLParam.nScore < 0) {
oCTRLParam.nScore = 0;
}
mcTxtScore.text = oCTRLParam.styleNumber(oCTRLParam.nScore);
}
function showMenu() {
mcRef.btnMenu.enabled = false;
oCTRLParam.playBtnClick();
oCTRLParam.pauseGame();
setState("Appear");
_global.Sounds.PlaySound("SFX_MenuOpen", 100, 0);
}
function hideMenu() {
mcRef.btnMenu.enabled = true;
oCTRLParam.playBtnClick();
setState("Close");
_global.Sounds.PlaySound("SFX_MenuClose", 100, 0);
}
function showInstructions() {
oCTRLParam.playBtnClick();
mcInstructions.gotoAndStop("Show");
mcInstructions.btnPlay.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcInstructions.btnPlay.onRelease = Delegate.create(oCTRLParam, oCTRLParam.playInstructions);
mcInstructions.btnNext.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcInstructions.btnNext.onRelease = Delegate.create(oCTRLParam, oCTRLParam.instructionsNext);
mcInstructions.btnBack.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcInstructions.btnBack.onRelease = Delegate.create(oCTRLParam, oCTRLParam.instructionsBack);
}
function hideInstructions() {
oCTRLParam.playBtnClick();
mcInstructions.gotoAndStop("Hide");
}
function quitGame() {
oCTRLParam.playBtnClick();
oCTRLParam.loseGame();
}
function setMusicOff() {
oCTRLParam.playBtnClick();
oCTRLParam.bMuteSounds = true;
_global.Sounds.SetVolume("SFX_GameLoop", 0);
_global.Sounds.SetVolume("SFX_Ambiance01", 0);
_global.Sounds.SetVolume("SFX_Ambiance02", 0);
_global.Sounds.SetVolume("SFX_Ambiance03", 0);
_global.Sounds.SetVolume("SFX_Ambiance04", 0);
_global.Sounds.SetVolume("SFX_Ambiance05", 0);
mcRef.mcMenu.mcState.mcMenu.mcSound.gotoAndStop("MusicOn");
mcRef.mcMenu.mcState.mcMenu.mcSound.btnSoundOn.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcRef.mcMenu.mcState.mcMenu.mcSound.btnSoundOn.onRelease = Delegate.create(this, setMusicOn);
}
function setMusicOn() {
oCTRLParam.playBtnClick();
oCTRLParam.bMuteSounds = false;
_global.Sounds.SetVolume("SFX_GameLoop", 40);
_global.Sounds.SetVolume("SFX_Ambiance01", 80);
_global.Sounds.SetVolume("SFX_Ambiance02", 80);
_global.Sounds.SetVolume("SFX_Ambiance03", 80);
_global.Sounds.SetVolume("SFX_Ambiance04", 80);
_global.Sounds.SetVolume("SFX_Ambiance05", 80);
mcRef.mcMenu.mcState.mcMenu.mcSound.gotoAndStop("MusicOff");
mcRef.mcMenu.mcState.mcMenu.mcSound.btnSoundOff.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcRef.mcMenu.mcState.mcMenu.mcSound.btnSoundOff.onRelease = Delegate.create(this, setMusicOff);
}
function pause() {
mcRef.mcMenu.mcState.stop();
}
function unPause() {
mcRef.mcMenu.mcState.play();
}
function updateEnergyBar(_nEnergyToBe) {
nEnergyToGo = _nEnergyToBe;
if (nEnergyToGo > nCurrentEnergy) {
setState("RaiseEnergy");
} else if (nEnergyToGo < nCurrentEnergy) {
setState("LowerEnergy");
}
}
function doAction() {
this[sState]();
}
function Appear() {
if (oCTRLParam.bMuteSounds == false) {
mcRef.mcMenu.mcState.mcMenu.mcSound.gotoAndStop("MusicOff");
} else {
mcRef.mcMenu.mcState.mcMenu.mcSound.gotoAndStop("MusicOn");
}
if (mcRef.mcMenu.mcState._currentframe >= nFrTotalAnim) {
menuInit();
}
}
function Close() {
if (oCTRLParam.bMuteSounds == false) {
mcRef.mcMenu.mcState.mcMenu.mcSound.gotoAndStop("MusicOff");
} else {
mcRef.mcMenu.mcState.mcMenu.mcSound.gotoAndStop("MusicOn");
}
if (mcRef.mcMenu.mcState._currentframe >= nFrTotalAnim) {
oCTRLParam.unPauseGame();
setState("Idle");
}
}
function RaiseEnergy() {
if (nCurrentEnergy < nEnergyToGo) {
nCurrentEnergy++;
} else {
setState("Idle");
}
mcRef.mcEnergyBar.gotoAndStop(nCurrentEnergy);
}
function LowerEnergy() {
if (nCurrentEnergy > nEnergyToGo) {
nCurrentEnergy--;
} else {
setState("Idle");
}
mcRef.mcEnergyBar.gotoAndStop(nCurrentEnergy);
}
function init() {
nMaxScore = 999999 /* 0x0F423F */;
nCurrentEnergy = 100;
mcRef.mcEnergyBar.gotoAndStop(nCurrentEnergy);
bPausable = false;
updateScore(0);
}
function menuInit() {
setState("Full");
mcRef.mcMenu.mcState.mcMenu.btnResume.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcRef.mcMenu.mcState.mcMenu.btnResume.onRelease = Delegate.create(this, hideMenu);
mcRef.mcMenu.mcState.mcMenu.btnHowToPlay.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcRef.mcMenu.mcState.mcMenu.btnHowToPlay.onRelease = Delegate.create(this, showInstructions);
mcRef.mcMenu.mcState.mcMenu.btnQuit.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcRef.mcMenu.mcState.mcMenu.btnQuit.onRelease = Delegate.create(this, quitGame);
if (oCTRLParam.bMuteSounds == false) {
mcRef.mcMenu.mcState.mcMenu.mcSound.gotoAndStop("MusicOff");
} else {
mcRef.mcMenu.mcState.mcMenu.mcSound.gotoAndStop("MusicOn");
}
mcRef.mcMenu.mcState.mcMenu.mcSound.btnSoundOn.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcRef.mcMenu.mcState.mcMenu.mcSound.btnSoundOn.onRelease = Delegate.create(this, setMusicOn);
mcRef.mcMenu.mcState.mcMenu.mcSound.btnSoundOff.onRollOver = Delegate.create(oCTRLParam, oCTRLParam.playBtnRollOver);
mcRef.mcMenu.mcState.mcMenu.mcSound.btnSoundOff.onRelease = Delegate.create(this, setMusicOff);
}
function returnToMenu() {
oCTRLParam.playBtnClick();
mcRef.mcMenu.mcState.prevFrame();
menuInit();
}
function restartGame() {
oCTRLParam.playBtnClick();
}
function setState(pState) {
var _local3;
if (sState != pState) {
sState = pState;
mcRef.mcMenu.gotoAndStop(sState);
nFrTotalAnim = mcRef.mcMenu.mcState._totalframes;
}
}
}
Symbol 606 MovieClip [__Packages.Delegate] Frame 0
class Delegate extends Object
{
var func;
function Delegate () {
super();
}
function DelegateArgs(f) {
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local3 = arguments.callee.target;
func = arguments.callee.func;
var _local2 = arguments.callee.arg;
_local2 = _local2.concat(arguments);
return(func.apply(_local3, _local2));
};
_local2.target = obj;
_local2.func = func;
_local2.arg = arguments.slice(2);
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 607 MovieClip [__Packages.Player] Frame 0
class Player extends State
{
var bUpKeyIsPressed, bDownKeyIsPressed, bLeftKeyIsPressed, bRightKeyIsPressed, bEndOfStage, bArmRaised, bMustLower, mcRef, oCurrentTile, nCurrentRow, nCurrentColumn, nPosX, nPosY, sState, nFrTotalAnim, nMoveTimer, nDepX, nDepY, oTargetTile, oBlockToPush, sDirection, nTargetPosX, nTargetPosY;
function Player (_mcRef) {
super(_mcRef);
bUpKeyIsPressed = false;
bDownKeyIsPressed = false;
bLeftKeyIsPressed = false;
bRightKeyIsPressed = false;
bEndOfStage = false;
bArmRaised = false;
bMustLower = false;
setDirection("Down");
setState("Idle");
CTRLGame.getRef().oGrid.askForCurrentTile(mcRef, this);
}
function setGoodTile(_oTile) {
oCurrentTile = _oTile;
mcRef.swapDepths(oCurrentTile.__get___nDepth() + DEPTH_MODIFIER);
nCurrentRow = oCurrentTile._nRow;
nCurrentColumn = oCurrentTile._nColumn;
nPosX = oCurrentTile._nPosX;
nPosY = oCurrentTile._nPosY;
mcRef._x = nPosX;
mcRef._y = nPosY;
if (oCurrentTile.__get___sType() == "Goal") {
bEndOfStage = true;
CTRLGame.getRef().winGame();
}
}
function pause() {
mcRef.mcDir.mcState.stop();
}
function unPause() {
mcRef.mcDir.mcState.play();
}
function setState(pState) {
var _local3;
sState = pState;
mcRef.mcDir.gotoAndStop(sState);
nFrTotalAnim = mcRef.mcDir.mcState._totalframes;
}
function get _isStateFinished() {
var _local2 = false;
if (mcRef.mcDir.mcState._currentframe >= nFrTotalAnim) {
_local2 = true;
}
return(_local2);
}
function lowerTheArm() {
bMustLower = true;
}
function Idle() {
checkKeys();
}
function Move() {
if (mcRef.mcDir.mcState._currentframe == 6) {
CTRLParam.getRef().oSounds.PlaySound("SFX_Step1", 100);
} else if (mcRef.mcDir.mcState._currentframe == 14) {
CTRLParam.getRef().oSounds.PlaySound("SFX_Step2", 100);
}
nMoveTimer++;
nPosX = nPosX + nDepX;
nPosY = nPosY + nDepY;
mcRef._x = nPosX;
mcRef._y = nPosY;
if (nMoveTimer > TIME_TO_CHANGE_TILE) {
setGoodTile(oTargetTile);
checkEndMove();
}
checkKeyUnPressed();
}
function MoveRaise() {
if (mcRef.mcDir.mcState._currentframe == 6) {
CTRLParam.getRef().oSounds.PlaySound("SFX_Step1", 100);
} else if (mcRef.mcDir.mcState._currentframe == 14) {
CTRLParam.getRef().oSounds.PlaySound("SFX_Step2", 100);
}
nMoveTimer++;
nPosX = nPosX + nDepX;
nPosY = nPosY + nDepY;
mcRef._x = nPosX;
mcRef._y = nPosY;
if (nMoveTimer > TIME_TO_CHANGE_TILE) {
setGoodTile(oTargetTile);
checkEndMove();
}
checkKeyUnPressed();
}
function Scared() {
if (_isStateFinished) {
CTRLParam.getRef().loseALife();
setState("EndScared");
}
}
function RaiseArm() {
if (_isStateFinished) {
setState("MoveRaise");
oBlockToPush.reallyPushBlock();
}
}
function LowerArm() {
if (_isStateFinished) {
bMustLower = false;
bArmRaised = false;
setState("Idle");
}
}
function setDirection(_sDirection) {
if (sDirection != _sDirection) {
sDirection = _sDirection;
mcRef.gotoAndStop(sDirection);
}
}
function checkEndMove() {
var _local2 = CTRLGame.getRef().checkAddAStep();
if (_local2 == true) {
if ((this[("b" + sDirection) + "KeyIsPressed"] == true) && (bEndOfStage == false)) {
startToMove(sDirection);
} else if (bEndOfStage == true) {
setState("WaitEndStage");
} else if (bArmRaised == true) {
setState("LowerArm");
} else {
setState("Idle");
}
} else {
CTRLParam.getRef().oSounds.PlaySound("SFX_CageFall", 100);
setState("Scared");
}
}
function checkKeys() {
checkKeyPressed();
checkKeyUnPressed();
}
function checkKeyPressed() {
for (var _local2 in KEY_LIST) {
if ((Key.isDown(KEY_LIST[_local2][0]) == true) and (this[("b" + KEY_LIST[_local2][1]) + "KeyIsPressed"] == false)) {
pressKey(KEY_LIST[_local2][1]);
}
}
}
function checkKeyUnPressed() {
for (var _local2 in KEY_LIST) {
if ((Key.isDown(KEY_LIST[_local2][0]) == false) and (this[("b" + KEY_LIST[_local2][1]) + "KeyIsPressed"] == true)) {
unPressKey(KEY_LIST[_local2][1]);
}
}
}
function pressKey(_key) {
this[("b" + _key) + "KeyIsPressed"] = true;
startToMove(_key);
}
function startToMove(_sDirection) {
setDirection(_sDirection);
if (bArmRaised == true) {
setState("LowerArm");
} else {
setState("Idle");
}
var _local2 = nCurrentRow;
var _local3 = nCurrentColumn;
switch (_sDirection) {
case "Down" :
_local2++;
break;
case "Up" :
_local2--;
break;
case "Left" :
_local3--;
break;
case "Right" :
_local3++;
}
var _local6 = CTRLGame.getRef().oGrid.checkIfTileEmpty(_local2, _local3);
if (_local6 == true) {
var _local4 = CTRLGame.getRef().oGrid[(("TileR" + _local2) + "C") + _local3];
if (_local4._sType == "MovingBlock") {
if (startPushMovingBlock(_sDirection, _local4) == true) {
if (bArmRaised == false) {
setState("RaiseArm");
bArmRaised = true;
} else {
setState("MoveRaise");
}
startChangeTile(_local2, _local3);
}
} else {
setState("Move");
startChangeTile(_local2, _local3);
}
}
}
function startPushMovingBlock(_sDirection, _oTempTargetTile) {
var _local2;
_local2 = _oTempTargetTile.__get___oMovingBlockRef().startPushBlock(_sDirection);
oBlockToPush = _oTempTargetTile._oMovingBlockRef;
if (bArmRaised == false) {
} else {
oBlockToPush.reallyPushBlock();
}
return(_local2);
}
function startChangeTile(_nNewRow, _nNewColumn) {
CTRLGame.getRef().addAStep();
oTargetTile = CTRLGame.getRef().oGrid[(("TileR" + _nNewRow) + "C") + _nNewColumn];
mcRef.swapDepths(oTargetTile.__get___nDepth() + DEPTH_MODIFIER);
nTargetPosX = oTargetTile._nPosX;
nTargetPosY = oTargetTile._nPosY;
var _local3 = nTargetPosX - nPosX;
var _local2 = nTargetPosY - nPosY;
nDepX = _local3 / TIME_TO_CHANGE_TILE;
nDepY = _local2 / TIME_TO_CHANGE_TILE;
nMoveTimer = 1;
}
function unPressKey(_key) {
this[("b" + _key) + "KeyIsPressed"] = false;
}
var KEY_LIST = [[38, "Up"], [37, "Left"], [40, "Down"], [39, "Right"]];
var DEPTH_MODIFIER = 5;
var TIME_TO_CHANGE_TILE = 16;
}
Symbol 608 MovieClip [__Packages.Tile] Frame 0
class Tile extends State
{
var sName, nColumn, nRow, mcGridRef, nDepth, mcRef, nPosX, nPosY, bWalkable, sType, oMovingBlockRef;
function Tile (_sName, _nRow, _nColumn, _mcGridRef) {
super();
sName = _sName;
nColumn = _nColumn;
nRow = _nRow;
mcGridRef = _mcGridRef;
nDepth = ((nRow * ROW_DEPTH_MODIFIER) + (nColumn * COLUMN_DEPTH_MODIFIER)) + BASE_DEPTH;
getThePosition();
mcRef = CTRLGame.getRef().mcMain.mcRefTile.duplicateMovieClip(sName, nDepth);
mcRef._yscale = 50;
mcRef._x = nPosX;
mcRef._y = nPosY;
mcRef._visible = false;
bWalkable = true;
}
function get _nDepth() {
return(nDepth);
}
function get _nColumn() {
return(nColumn);
}
function get _nRow() {
return(nRow);
}
function get _nPosX() {
return(nPosX);
}
function get _nPosY() {
return(nPosY);
}
function get _sType() {
return(sType);
}
function set _sType(_sValue) {
sType = _sValue;
//return(_sType);
}
function get _oMovingBlockRef() {
return(oMovingBlockRef);
}
function set _oMovingBlockRef(_oValue) {
oMovingBlockRef = _oValue;
//return(_oMovingBlockRef);
}
function isEmpty() {
var _local2 = true;
if (bWalkable == false) {
_local2 = false;
}
return(_local2);
}
function isEmptyToPush() {
var _local2 = true;
if (((bWalkable == false) && (sType != "Water")) || (sType == "MovingBlock")) {
_local2 = false;
}
return(_local2);
}
function getGoodTile(_nPosX, _nPosY) {
if ((_nPosX >= (nPosX - (SIZE_TILE / 2))) && (_nPosX <= (nPosX + (SIZE_TILE / 2)))) {
if ((_nPosY >= (nPosY - (SIZE_TILE / 4))) && (_nPosY <= (nPosY + (SIZE_TILE / 4)))) {
CTRLGame.getRef().oGrid.currentTileIsFound(this);
}
}
}
function setTileSpecificType(_nPosX, _nPosY, _sType) {
if ((_nPosX >= (nPosX - (SIZE_TILE / 2))) && (_nPosX <= (nPosX + (SIZE_TILE / 2)))) {
if ((_nPosY >= (nPosY - (SIZE_TILE / 4))) && (_nPosY <= (nPosY + (SIZE_TILE / 4)))) {
setGoodType(_sType);
}
}
}
function becomeWalkable() {
bWalkable = true;
}
function getThePosition() {
var _local2 = mcGridRef._x;
var _local3 = mcGridRef._y;
nPosX = (_local2 - (nRow * SIZE_TILE)) + (nColumn * SIZE_TILE);
nPosY = ((_local3 + (nRow * (SIZE_TILE / 2))) + (nColumn * (SIZE_TILE / 2))) + (SIZE_TILE / 2);
}
function setGoodType(_sType) {
sType = _sType;
switch (sType) {
case "Wall" :
bWalkable = false;
break;
case "Goal" :
break;
case "Water" :
bWalkable = false;
}
}
var SIZE_TILE = 28.25;
var COLUMN_DEPTH_MODIFIER = 10;
var ROW_DEPTH_MODIFIER = 1000;
var BASE_DEPTH = 1000;
}
Symbol 609 MovieClip [__Packages.MovingBlock] Frame 0
class MovingBlock extends State
{
var setState, mcRef, oCurrentTile, nCurrentRow, nCurrentColumn, nPosX, nPosY, nColumnToGo, nRowToGo, nMoveTimer, nDepX, nDepY, oTargetTile, __get___isStateFinished, nTargetPosX, nTargetPosY;
function MovingBlock (_mcRef) {
super(_mcRef);
setState("Idle");
CTRLGame.getRef().oGrid.askForCurrentTile(mcRef, this);
}
function setGoodTile(_oTile) {
if ((_oTile.__get___nColumn() == oCurrentTile.__get___nColumn()) && (_oTile.__get___nRow() == oCurrentTile.__get___nRow())) {
} else {
oCurrentTile.__set___sType("");
oCurrentTile.__set___oMovingBlockRef(undefined);
oCurrentTile = _oTile;
mcRef.swapDepths(oCurrentTile.__get___nDepth() + DEPTH_MODIFIER);
nCurrentRow = oCurrentTile._nRow;
nCurrentColumn = oCurrentTile._nColumn;
nPosX = oCurrentTile._nPosX;
nPosY = oCurrentTile._nPosY;
mcRef._x = nPosX;
mcRef._y = nPosY;
if (oCurrentTile.__get___sType() == "Water") {
startToSink();
oCurrentTile.__set___oMovingBlockRef(undefined);
} else {
oCurrentTile.__set___sType("MovingBlock");
oCurrentTile.__set___oMovingBlockRef(this);
}
}
}
function startPushBlock(_sDirection) {
var _local4 = false;
var _local2 = nCurrentRow;
var _local3 = nCurrentColumn;
switch (_sDirection) {
case "Down" :
_local2++;
break;
case "Up" :
_local2--;
break;
case "Left" :
_local3--;
break;
case "Right" :
_local3++;
}
var _local5 = CTRLGame.getRef().oGrid.checkIfTileEmptyToPush(_local2, _local3);
if (_local5 == true) {
_local4 = true;
nColumnToGo = _local3;
nRowToGo = _local2;
}
return(_local4);
}
function reallyPushBlock() {
startChangeTile(nRowToGo, nColumnToGo);
}
function Idle() {
}
function Move() {
nMoveTimer++;
nPosX = nPosX + nDepX;
nPosY = nPosY + nDepY;
mcRef._x = nPosX;
mcRef._y = nPosY;
if (nMoveTimer > TIME_TO_CHANGE_TILE) {
setGoodTile(oTargetTile);
setState("Idle");
}
}
function Sinking() {
if (__get___isStateFinished()) {
hasSinked();
}
}
function startChangeTile(_nNewRow, _nNewColumn) {
oTargetTile = CTRLGame.getRef().oGrid[(("TileR" + _nNewRow) + "C") + _nNewColumn];
if (oTargetTile.__get___nDepth() != undefined) {
mcRef.swapDepths(oTargetTile.__get___nDepth() + DEPTH_MODIFIER);
}
nTargetPosX = oTargetTile._nPosX;
nTargetPosY = oTargetTile._nPosY;
var _local3 = nTargetPosX - nPosX;
var _local2 = nTargetPosY - nPosY;
nDepX = _local3 / TIME_TO_CHANGE_TILE;
nDepY = _local2 / TIME_TO_CHANGE_TILE;
nMoveTimer = 1;
CTRLParam.getRef().oSounds.PlaySound("SFX_PushBlock", 50);
CTRLParam.getRef().oSounds.PlaySound("SFX_RingLoop", 100);
setState("Move");
}
function startToSink() {
CTRLParam.getRef().oSounds.PlaySound("SFX_BlockFall", 80);
CTRLGame.getRef().oPlayer.lowerTheArm();
setState("Sinking");
}
function hasSinked() {
oCurrentTile.__set___sType("");
oCurrentTile.becomeWalkable();
setState("Sinked");
}
var DEPTH_MODIFIER = 3;
var TIME_TO_CHANGE_TILE = 16;
}
Symbol 610 MovieClip [__Packages.Grid] Frame 0
class Grid extends State
{
var mcGridRef, oRef;
function Grid (_mcGridRef) {
super();
mcGridRef = _mcGridRef;
createAllTiles();
}
function askForCurrentTile(_mcObj, _oRef) {
oRef = _oRef;
CTRLParam.getRef().oBroadcaster.broadcastMessage("getGoodTile", _mcObj._x, _mcObj._y);
}
function currentTileIsFound(_oTile) {
oRef.setGoodTile(_oTile);
}
function checkIfTileEmpty(_nRow, _nColumn) {
var _local2;
_local2 = this[(("TileR" + _nRow) + "C") + _nColumn].isEmpty();
return(_local2);
}
function checkIfTileEmptyToPush(_nRow, _nColumn) {
var _local2;
_local2 = this[(("TileR" + _nRow) + "C") + _nColumn].isEmptyToPush();
return(_local2);
}
function setTileType(_mcTile, _sType) {
CTRLParam.getRef().oBroadcaster.broadcastMessage("setTileSpecificType", _mcTile._x, _mcTile._y, _sType);
}
function createAllTiles() {
var _local5 = mcGridRef._x;
var _local6 = mcGridRef._y;
var _local4 = 0;
while (_local4 <= NUMBER_ROWS) {
var _local2 = 0;
while (_local2 <= NUMBER_COLUMN) {
var _local3 = (("TileR" + _local4) + "C") + _local2;
this[_local3] = new Tile(_local3, _local4, _local2, mcGridRef);
_local2++;
}
_local4++;
}
}
var NUMBER_ROWS = 11;
var NUMBER_COLUMN = 11;
}
Symbol 611 MovieClip [__Packages.BlockingObject] Frame 0
class BlockingObject extends State
{
var setState, mcRef, oCurrentTile, nCurrentRow, nCurrentColumn, nPosX, nPosY;
function BlockingObject (_mcRef) {
super(_mcRef);
setState("Idle");
CTRLGame.getRef().oGrid.askForCurrentTile(mcRef, this);
}
function setGoodTile(_oTile) {
oCurrentTile = _oTile;
mcRef.swapDepths(oCurrentTile.__get___nDepth() + DEPTH_MODIFIER);
nCurrentRow = oCurrentTile._nRow;
nCurrentColumn = oCurrentTile._nColumn;
nPosX = oCurrentTile._nPosX;
nPosY = oCurrentTile._nPosY;
mcRef._x = nPosX;
mcRef._y = nPosY;
}
function Idle() {
}
var DEPTH_MODIFIER = 2;
}
Symbol 612 MovieClip [__Packages.HidingObject] Frame 0
class HidingObject extends State
{
var setState, mcRef, oCurrentTile;
function HidingObject (_mcRef) {
super(_mcRef);
setState("Idle");
CTRLGame.getRef().oGrid.askForCurrentTile(mcRef, this);
}
function setGoodTile(_oTile) {
oCurrentTile = _oTile;
mcRef.swapDepths(oCurrentTile.__get___nDepth() + DEPTH_MODIFIER);
}
function Idle() {
}
var DEPTH_MODIFIER = 3;
}
Symbol 613 MovieClip [__Packages.Transition] Frame 0
class Transition extends State
{
var sName, mcRef, mcTimeLine, bPausable, sGoingTo, setState, OpeningTitleCard, OpeningInstructions, OpeningWinScreen, OpeningLoseScreen, oCTRLParam, sComingFrom, nFrTotalAnim;
function Transition (pMc, pTimeLine) {
super(pMc);
sName = "Transition";
mcRef = pMc;
mcTimeLine = pTimeLine;
bPausable = false;
sGoingTo = "TitleCard";
setState("Idle");
OpeningTitleCard = Delegate.create(this, Opening);
OpeningInstructions = Delegate.create(this, Opening);
OpeningWinScreen = Delegate.create(this, Opening);
OpeningLoseScreen = Delegate.create(this, Opening);
}
function goTo(pGoingTo) {
if (sGoingTo == "ResetVariables") {
sGoingTo = "TitleCard";
}
if (pGoingTo == "ResetForGame") {
setState("OpeningResetForGame");
} else if ((pGoingTo == "LoseScreen") && (sGoingTo == "Game")) {
setState("OpeningResetForGame");
} else {
setState("Opening" + sGoingTo);
}
sGoingTo = pGoingTo;
CTRLParam.getRef().oSounds.PlaySound("SFX_Transition", 100);
}
function changeSection() {
mcTimeLine.gotoAndStop(sGoingTo);
oCTRLParam[sGoingTo]();
sComingFrom = sGoingTo;
}
function OpeningResetForGame() {
if (mcRef.mcState._currentframe >= nFrTotalAnim) {
if (CTRLParam.getRef().__get___bWinTheLevel() == true) {
setState("OpenedResetForGameWin");
mcRef.mcState.mcPopup.txtRoom.text = ("ROOM " + (CTRLParam.getRef().__get___nCurrentLevel() - 1)) + " COMPLETED!";
mcRef.mcState.mcPopup.txtScore.text = CTRLParam.getRef().styleNumber(oCTRLParam.nScore);
} else {
setState("OpenedResetForGameLose");
}
CTRLParam.getRef().__set___bWinTheLevel(false);
}
}
function Opening() {
if (mcRef.mcState._currentframe >= nFrTotalAnim) {
setState("Opened");
}
}
function Opened() {
if (mcRef.mcState._currentframe >= nFrTotalAnim) {
changeSection();
setState("Closing");
}
}
function OpenedResetForGameWin() {
if (mcRef.mcState._currentframe >= nFrTotalAnim) {
changeSection();
setState("ClosingResetForGame");
}
}
function OpenedResetForGameLose() {
if (mcRef.mcState._currentframe >= nFrTotalAnim) {
changeSection();
setState("Closing");
}
}
function ClosingResetForGame() {
if (mcRef.mcState._currentframe >= nFrTotalAnim) {
setState("Idle");
}
}
function Closing() {
if (mcRef.mcState._currentframe >= nFrTotalAnim) {
setState("Idle");
}
}
function pause() {
}
function unPause() {
}
}
Symbol 614 MovieClip [__Packages.Sounds] Frame 0
class Sounds extends MovieClip
{
var mcTimeLine, oItems, oSounds, aTabSonFade, bMute, nIndex, nDepth, aControlled, nFadingSpeed, onEnterFrame;
function Sounds (_mc) {
super();
mcTimeLine = _mc;
_global.Sounds = this;
init();
createAllSounds();
}
function init() {
oItems = {};
oSounds = {};
aTabSonFade = [];
bMute = false;
nIndex = 0;
nDepth = 0;
aControlled = ["SFX_BtnClick", "SFX_BtnRoll", "SFX_CageFall", "SFX_PushBlock2", "SFX_PushBlock", "SFX_Transition", "SFX_GameLoop", "SFX_PackagingLoop", "SFX_Ambiance01", "SFX_Ambiance02", "SFX_Ambiance03", "SFX_Ambiance04", "SFX_Ambiance05", "SFX_BlockFall", "SFX_Step1", "SFX_Step2", "SFX_RingLoop"];
nFadingSpeed = 2;
}
function createAllSounds() {
for (var _local3 in aControlled) {
oItems[aControlled[_local3]] = new Object();
oItems[aControlled[_local3]].sName = aControlled[_local3];
oItems[aControlled[_local3]].nVolume = 0;
oItems[aControlled[_local3]].nPausePosition = 0;
oItems[aControlled[_local3]].mcRef = mcTimeLine.createEmptyMovieClip(aControlled[_local3], nDepth);
oItems[aControlled[_local3]].sSound = new Sound(aControlled[_local3]);
oItems[aControlled[_local3]].sSound.attachSound(aControlled[_local3]);
oItems[aControlled[_local3]].onSoundComplete = function () {
_global.Sounds.fSoundComplete(this.Nom);
};
nDepth++;
}
}
function PlaySound(pName, pVolume, pNbLoop) {
if (CTRLParam.getRef().bMuteSounds == false) {
SetVolume(pName, pVolume);
oItems[pName].sSound.start(0, pNbLoop);
}
}
function StopSound(pName) {
SetVolume(pName, 0);
oItems[pName].sSound.stop();
}
function PauseSound(pName) {
this[pName].PausePosition = this[pName].position;
this[pName].stop();
}
function ResumeSound(pName) {
this[pName].start(this[pName].PausePosition / 1000, 0);
}
function fSoundComplete(pName) {
}
function startFadeIn(pName, pVolume, pNbLoop) {
PlaySound(pName, 0, pNbLoop);
var _local2 = [pName, pVolume, "In", 0];
aTabSonFade.push(_local2);
onEnterFrame = mx.utils.Delegate.create(this, fEnterFrame);
}
function startFadeOut(pName) {
aTabSonFade = [];
if ((oItems[pName].sSound.getVolume() != undefined) and (oItems[pName].sSound.getVolume() != 0)) {
var _local3 = [pName, 0, "Out", oItems[pName].sSound.getVolume()];
aTabSonFade.push(_local3);
onEnterFrame = mx.utils.Delegate.create(this, fEnterFrame);
}
}
function fEnterFrame() {
for (var _local6 in aTabSonFade) {
var _local3 = aTabSonFade[_local6][0];
var _local4 = aTabSonFade[_local6][1];
var _local5 = aTabSonFade[_local6][2];
var _local2 = aTabSonFade[_local6][3];
if (_local5 == "In") {
_local2 = _local2 + nFadingSpeed;
if (_local2 >= _local4) {
_local2 = _local4;
fDelete(_local3);
if (aTabSonFade.length == 0) {
delete onEnterFrame;
}
}
} else {
_local2 = _local2 - nFadingSpeed;
if (_local2 <= 0) {
StopSound(_local3);
_local2 = 0;
fDelete(_local3);
if (aTabSonFade.length == 0) {
delete onEnterFrame;
}
}
}
if (_local2 != 0) {
aTabSonFade[_local6][3] = _local2;
}
SetVolume(_local3, _local2);
}
}
function fDelete(pName) {
var _local2 = 0;
while (_local2 <= aTabSonFade.length) {
if (aTabSonFade[_local2][0] == pName) {
aTabSonFade.splice(_local2, 1);
}
_local2++;
}
}
function SetVolume(pName, pVolume) {
oItems[pName].Volume = pVolume;
if (bMute) {
oItems[pName].sSound.setVolume(0);
} else {
oItems[pName].sSound.setVolume(pVolume);
}
}
function DoFade(pName, pVolume, l_DirFade, l_SpdFade, l_Index) {
var _local3 = oItems[pName].Volume;
if (l_DirFade == "In") {
if ((_local3 + l_SpdFade) < pVolume) {
SetVolume(pName, _local3 + l_SpdFade);
} else {
SetVolume(pName, pVolume);
aTabSonFade.splice(l_Index, 1);
}
} else if ((_local3 - l_SpdFade) > pVolume) {
SetVolume(pName, _local3 - l_SpdFade);
} else {
SetVolume(pName, pVolume);
aTabSonFade.splice(l_Index, 1);
if (pVolume == 0) {
StopSound(pName);
}
}
}
function Fade() {
for (var _local2 in aTabSonFade) {
DoFade(aTabSonFade[_local2][0], aTabSonFade[_local2][1], aTabSonFade[_local2][2], aTabSonFade[_local2][3], _local2);
}
}
function DoMute() {
bMute = true;
for (var _local2 in oItems) {
oItems.i.Nom.setVolume(0);
}
}
function UndoMute() {
bMute = false;
for (var _local2 in oItems) {
SetVolume(oItems[_local2].Nom, oItems[_local2].Volume);
}
}
}
Symbol 615 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 161 MovieClip Frame 1
stop();
Symbol 161 MovieClip Frame 2
stop();
Symbol 174 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 179 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 181 MovieClip Frame 1
CTRLGame.getRef().oGrid.setTileType(this, "Wall");
this._visible = false;
Symbol 183 MovieClip Frame 1
CTRLGame.getRef().oGrid.setTileType(this, "Goal");
this._visible = false;
Symbol 191 MovieClip Frame 1
CTRLGame.getRef().createBlockingObject(this);
Symbol 206 MovieClip Frame 1
CTRLGame.getRef().createMovingBlock(this);
Symbol 208 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 210 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 212 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 214 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 216 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 218 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 381 MovieClip Frame 1
stop();
Symbol 386 MovieClip Frame 1
stop();
Symbol 389 MovieClip Frame 1
this.swapDepths(666);
this.removeMovieClip();
Symbol 401 MovieClip Frame 1
CTRLGame.getRef().oGrid.setTileType(this, "Water");
this._visible = false;
Symbol 403 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 405 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 420 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 422 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 445 MovieClip Frame 1
CTRLGame.getRef().createBlockingObject(this);
Symbol 447 MovieClip Frame 1
CTRLGame.getRef().createBlockingObject(this);
Symbol 449 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 452 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 464 MovieClip Frame 1
CTRLGame.getRef().createBlockingObject(this);
Symbol 466 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 485 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 489 MovieClip Frame 1
CTRLGame.getRef().createBlockingObject(this);
Symbol 491 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 512 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 520 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 532 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 540 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 545 MovieClip Frame 1
CTRLGame.getRef().createBlockingObject(this);
Symbol 548 MovieClip Frame 1
CTRLGame.getRef().createBlockingObject(this);
Symbol 550 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 556 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Symbol 560 MovieClip Frame 1
CTRLGame.getRef().createHidingObject(this);
Instance of Symbol 426 MovieClip "CacheRoom3_2" in Symbol 573 MovieClip Frame 31
onClipEvent (load) {
with (_parent._parent._parent) {
var Nom = this._name;
var Tile = Control.Grid.ComputeItemTile(this._x, this._y);
var Depth = Control.Grid.FindDepth(Tile);
_global.C.G_TableSwap.push(Nom);
this.swapDepths(Depth);
}
}