Frame 1
function getPoints(_callbackFunction, _functionScope) {
}
function awardPoints(_points, _callbackFunction, _functionScope) {
}
Array.prototype.indexOf = function (_oValue, _nStartIndex) {
var _local4 = this.length;
var _local3 = -1;
if (_nStartIndex == undefined) {
_nStartIndex = 0;
}
var _local2 = _nStartIndex;
while (_local2 < _local4) {
if (this[_local2] == _oValue) {
_local3 = _local2;
break;
}
_local2++;
}
return(_local3);
};
Array.prototype.remove = function (_oValue) {
var _local2 = this.indexOf(_oValue);
if (_local2 != -1) {
this.splice(_local2, 1);
}
};
Array.prototype.shuffle = function (_nLevel) {
var _local3 = this.length;
var _local2 = 0;
while (_local2 < _nLevel) {
this.exchange(Math.floor(Math.random() * _local3), Math.floor(Math.random() * _local3));
_local2++;
}
};
Array.prototype.exchange = function (_nIndexA, _nIndexB) {
var _local2 = this[_nIndexA];
this[_nIndexA] = this[_nIndexB];
this[_nIndexB] = _local2;
};
Array.prototype.equals = function (_aArray) {
var _local3 = true;
if (this != _aArray) {
var _local2 = this.length;
if (_local2 != _aArray.length) {
_local3 = false;
} else {
while (_local2--) {
if (this[_local2] != _aArray[_local2]) {
_local3 = false;
break;
}
}
}
}
return(_local3);
};
Array.prototype.getRandom = function () {
return(this[Math.floor(Math.random() * this.length)]);
};
String.prototype.pad = function (_nLen, _sPad, _bRight) {
while (this.length < _nLen) {
if (_bRight == true) {
this=this + _sPad;//parameter overwritten
this + _sPad;
} else {
this=_sPad + this;//parameter overwritten
_sPad + this;
}
}
return(this);
};
ASSetPropFlags(Array.prototype, new Array("indexOf", "remove", "shuffle", "exchange", "equals", "getRandom"), 7);
ASSetPropFlags(String.prototype, new Array("pad"), 7);
System.security.allowDomain("www.nick.com");
Stage.showMenu = false;
_focusrect = false;
HighScores.bDebug = false;
HighScores.bDisplay = true;
HighScores.init(gProxyObj, Config.sHS_GAME_ID);
Frame 2
_global.MainRef = this;
this.onEnterFrame = function () {
var _local2 = this.getBytesLoaded() / this.getBytesTotal();
var _local3 = String(Math.round(_local2 * 100));
mcState.txtLoadedPercent.text = _local3;
if (_local2 >= 1) {
mcState.mcPreloader.gotoAndStop("Disperse");
delete this.onEnterFrame;
}
};
stop();
Frame 20
stop();
Instance of Symbol 543 MovieClip in Frame 20
onClipEvent (load) {
_global.P = new GameParam(this);
_global.P.initParam();
}
Frame 40
stop();
mcGame.mcGameCtn._rotation = 25;
Frame 79
_global.P.oSnd.playMusicPackaging();
Frame 98
_global.P.showScoreHS();
Symbol 5 Button
on (keyPress "<Left>") {
return(undefined);
}
on (keyPress "<Right>") {
return(undefined);
}
on (keyPress "<Down>") {
return(undefined);
}
on (keyPress "<Up>") {
return(undefined);
}
Symbol 8 MovieClip Frame 1
function localTrace(_sText) {
_host.txtTrace.text = _sText;
}
var _host = this;
_global.superTrace = localTrace;
Symbol 1081 MovieClip [__Packages.HighScores] Frame 0
class HighScores
{
static var oProxyObj, bDebug;
function HighScores () {
}
static function init(_oProxyObj, _sGameID) {
oProxyObj = _oProxyObj;
oProxyObj.setGame_Id(_sGameID);
if (bDebug) {
oProxyObj.setServer("www.nick.com");
oProxyObj.setScreenName("SarbaDev");
oProxyObj.setIsLoggedIn(true);
}
}
static function requestScores() {
oProxyObj.getScores(function () {
HighScores.onSuccess();
});
}
static function submitScore(_nScore) {
if (_nScore > 0) {
oProxyObj.submitScore(_nScore, function () {
HighScores.onSuccess();
});
}
}
static function populateFields(_oIndexes, _oNames, _oScores) {
var _local2 = getHighScores();
var _local5 = "";
var _local4 = "";
var _local3 = "";
var _local1 = 0;
while (_local1 < _local2.length) {
_local5 = _local5 + ((_local2[_local1].nIndex + 1) + newline);
_local4 = _local4 + (_local2[_local1].sName + newline);
_local3 = _local3 + (styleNumber(_local2[_local1].nScore, 1) + newline);
_local1++;
}
_oIndexes.text = _local5;
_oNames.text = _local4;
_oScores.text = _local3;
}
static function getHighScores() {
var _local6 = new Array();
var _local7 = oProxyObj.getScoreCount();
var _local1 = 0;
while (_local1 < _local7) {
var _local2 = oProxyObj.getScoreItem(_local1);
_local6.push({nIndex:_local1, sName:_local2[0], nScore:_local2[1]});
_local1++;
}
return(_local6);
}
static function styleNumber(_nNumber, _nMinimumChar) {
var _local7 = false;
var _local1 = String(_nNumber);
var _local3 = _local1;
var _local8 = "";
do {
if (_local1.length < _nMinimumChar) {
_local7 = true;
_local3 = "0" + _local3;
}
} while (_local3.length < _nMinimumChar);
_local1 = _local3;
var _local4 = "";
var _local6 = _local1.length;
_local6 = _local6 / 3;
if (_local6 <= 1) {
_local8 = _local1;
} else {
var _local2 = _local6;
while (_local2 > 1) {
_local4 = (" " + _local1.substr(-3)) + _local4;
_local1 = _local1.substr(0, -3);
_local2--;
}
_local3 = _local1 + _local4;
_local8 = _local3;
}
return(_local8);
}
}
Symbol 1082 MovieClip [__Packages.Config] Frame 0
class Config
{
function Config () {
}
static function getPlayer() {
var _local1 = new Object();
_local1.nTIME_BRAKING = 65;
_local1.nTIME_FOR_NEXT_BRAKE = 100;
_local1.nHORIZ_SPEED_MAX = 15;
_local1.nHORIZ_SPEED_NORMAL = 8;
_local1.nHORIZ_SPEED_BRAKE = 2;
_local1.nHORIZ_SPEED_MIN = 1;
_local1.nHORIZ_ACCEL = 0.6;
_local1.nHORIZ_GROUND_FRICTION = -0.2;
_local1.nHORIZ_BRAKE = -0.8;
_local1.nHORIZ_SLOWDOWN = -2;
_local1.nHORIZ_GRAVITY = 0.6;
_local1.nVERTICAL_SPEED = 8;
_local1.nGRAVITY = 0.7;
_local1.nLIMIT_FALLING_SPEED = 20;
_local1.aSPEED_DOWN_CHAR = [0, 2, 3, 3, 4, 5, 6, 6, 7, 7, 7];
_local1.aSPEED_DOWN_SNOWBALL = [0, 2, 2, 3, 3, 3, 4, 4, 5, 5, 6];
_local1.nTOTAL_LIVES = 5;
_local1.nHITS_BEFORE_LOSE_LIFE_ROUND1 = 2;
_local1.nHITS_BEFORE_LOSE_LIFE_ROUND2 = 2;
_local1.nTREE_SCALE_MODIF = -7;
_local1.nSHELL_SCALE_MODIF = -5;
_local1.nROCK_SCALE_MODIF = -5;
_local1.nCORAL_SCALE_MODIF = -7;
_local1.nLASER_SCALE_MODIF = -10;
_local1.nSNOWMAN_SCALE_MODIF = 15;
_local1.nSNOWBANK_SCALE_MODIF = 3;
_local1.nSNOWBALL_MAX_SCALE = 200;
_local1.nSNOWBALL_MIN_SCALE = 100;
_local1.nSNOWBALL_GOAL_SCALE = 195;
return(_local1);
}
static function getObsGrid() {
var _local1 = new Object();
_local1.nBUFFER_IN = 600;
_local1.nBUFFER_OUT = 300;
_local1.nRockWidth = 2;
_local1.nRockHeight = 1;
_local1.nRockNbInstances = 4;
_local1.nTreeWidth = 2;
_local1.nTreeHeight = 2;
_local1.nTreeNbInstances = 5;
_local1.nJumpWidth = 4;
_local1.nJumpLength = 50;
_local1.nJumpHeight = 2;
_local1.nJumpNbInstances = 1;
_local1.nCoralWidth = 2;
_local1.nCoralHeight = 1;
_local1.nCoralNbInstances = 3;
_local1.nShellWidth = 2;
_local1.nShellHeight = 1;
_local1.nShellNbInstances = 3;
_local1.nSnowManWidth = 2;
_local1.nSnowManHeight = 2;
_local1.nSnowManNbInstances = 2;
_local1.nSnowBankWidth = 2;
_local1.nSnowBankHeight = 2;
_local1.nSnowBankNbInstances = 2;
_local1.nLaserWidth = 4;
_local1.nLaserHeight = 1;
_local1.nLaserNbInstances = 1;
_local1.nCharacterWidth = 4;
_local1.nCharacterHeight = 1;
_local1.nCharacterNbInstances = 1;
_local1.nPowerUpWidth = 4;
_local1.nPowerUpHeight = 1;
_local1.nPowerUpNbInstances = 1;
_local1.nAnchovyWidth = 4;
_local1.nAnchovyHeight = 1;
_local1.nAnchovyNbInstances = 1;
return(_local1);
}
static function getLevel() {
var _local2 = new Object();
_local2.aCharacterPercent = [100];
_local2.nMIN_NB_CHAR_FOR_ROUND2 = 7;
_local2.nTIME_FOR_GAME = 7000;
switch (_global.P.nLevel) {
case 0 :
_local2.aRockPercent = [30, 20, 10];
_local2.aTreePercent = [20, 10];
_local2.aJumpPercent = [10];
_local2.aCoralPercent = [15, 5];
_local2.aShellPercent = [15, 5];
_local2.aShellPercent = [0];
_local2.aLaserPercent = [0];
_local2.aSnowManPercent = [0];
_local2.aSnowBankPercent = [0];
_local2.aPowerUpPercent = [9];
_local2.aAnchovyPercent = [20];
_local2.aPriority = ["Jump", "Tree", "Anchovy", "PowerUp", "Coral", "Rock", "Shell"];
_local2.nCharacterAppearanceDelay = 16;
_local2.nMAX_CHAR_PER_ROUND = 7;
_local2.nELEMENTS_DISTANCE_X = 50;
_local2.nELEMENTS_DISTANCE_Y = 25;
_local2.nSTART_Y = -80;
_local2.nNB_COLUMNS = 4;
_local2.nNB_ROWS = 9;
_local2.nPOWERUP_SPEED = 2;
_local2.nCHAR_FOR_LEVEL = 2;
break;
case 1 :
_local2.aRockPercent = [30, 20, 10];
_local2.aTreePercent = [25, 15, 5];
_local2.aJumpPercent = [20];
_local2.aCoralPercent = [40, 30];
_local2.aShellPercent = [40, 30];
_local2.aLaserPercent = [0];
_local2.aSnowManPercent = [0];
_local2.aSnowBankPercent = [0];
_local2.aPowerUpPercent = [9];
_local2.aAnchovyPercent = [20, 10];
_local2.aPriority = ["Jump", "Tree", "Anchovy", "PowerUp", "Coral", "Rock", "Shell"];
_local2.nCharacterAppearanceDelay = 15;
_local2.nMAX_CHAR_PER_ROUND = 10;
_local2.nELEMENTS_DISTANCE_X = 50;
_local2.nELEMENTS_DISTANCE_Y = 25;
_local2.nSTART_Y = -80;
_local2.nNB_COLUMNS = 4;
_local2.nNB_ROWS = 9;
_local2.nPOWERUP_SPEED = 2;
_local2.nCHAR_FOR_LEVEL = 4;
break;
case 2 :
_local2.aRockPercent = [40, 30, 20];
_local2.aTreePercent = [40, 30, 20];
_local2.aJumpPercent = [20];
_local2.aCoralPercent = [50, 40];
_local2.aShellPercent = [60, 50];
_local2.aLaserPercent = [0];
_local2.aSnowManPercent = [0];
_local2.aSnowBankPercent = [0];
_local2.aPowerUpPercent = [8];
_local2.aAnchovyPercent = [20, 10];
_local2.aPriority = ["Jump", "Tree", "Anchovy", "PowerUp", "Coral", "Rock", "Shell"];
_local2.nCharacterAppearanceDelay = 14;
_local2.nMAX_CHAR_PER_ROUND = 10;
_local2.nELEMENTS_DISTANCE_X = 50;
_local2.nELEMENTS_DISTANCE_Y = 25;
_local2.nSTART_Y = -80;
_local2.nNB_COLUMNS = 4;
_local2.nNB_ROWS = 9;
_local2.nPOWERUP_SPEED = 2;
_local2.nCHAR_FOR_LEVEL = 7;
break;
case 3 :
_local2.aRockPercent = [30, 20, 10];
_local2.aTreePercent = [0];
_local2.aJumpPercent = [20];
_local2.aCoralPercent = [30, 20, 10];
_local2.aShellPercent = [50, 40];
_local2.aLaserPercent = [20, 10];
_local2.aSnowManPercent = [100];
_local2.aSnowBankPercent = [30, 20];
_local2.aPowerUpPercent = [8];
_local2.aPriority = ["Jump", "Coral", "Laser", "PowerUp", "Tree", "Rock", "SnowBank", "Shell"];
_local2.nCharacterAppearanceDelay = 14;
_local2.nMAX_CHAR_PER_ROUND = 20;
_local2.nELEMENTS_DISTANCE_X = 50;
_local2.nELEMENTS_DISTANCE_Y = 25;
_local2.nSTART_Y = -80;
_local2.nNB_COLUMNS = 4;
_local2.nNB_ROWS = 9;
_local2.nPOWERUP_SPEED = 2;
_local2.nOBSTACLE_EASING_SPEED = 1;
_local2.nCHAR_FOR_LEVEL = 6;
break;
case 4 :
_local2.aRockPercent = [40, 30, 20];
_local2.aTreePercent = [0];
_local2.aJumpPercent = [20];
_local2.aCoralPercent = [40, 30, 20];
_local2.aShellPercent = [30, 20, 10];
_local2.aLaserPercent = [35, 25];
_local2.aSnowManPercent = [100];
_local2.aSnowBankPercent = [30, 20, 10];
_local2.aPowerUpPercent = [10];
_local2.aPriority = ["Jump", "Coral", "Laser", "PowerUp", "Tree", "Rock", "SnowBank", "Shell"];
_local2.nCharacterAppearanceDelay = 12;
_local2.nMAX_CHAR_PER_ROUND = 20;
_local2.nELEMENTS_DISTANCE_X = 50;
_local2.nELEMENTS_DISTANCE_Y = 25;
_local2.nSTART_Y = -80;
_local2.nNB_COLUMNS = 4;
_local2.nNB_ROWS = 9;
_local2.nPOWERUP_SPEED = 2;
_local2.nOBSTACLE_EASING_SPEED = 1;
_local2.nCHAR_FOR_LEVEL = 10;
break;
case 5 :
_local2.aRockPercent = [50, 40, 30];
_local2.aTreePercent = [0];
_local2.aJumpPercent = [10];
_local2.aCoralPercent = [40, 30, 20];
_local2.aShellPercent = [40, 30, 20];
_local2.aLaserPercent = [40, 30];
_local2.aSnowManPercent = [100];
_local2.aSnowBankPercent = [30, 20];
_local2.aPowerUpPercent = [12];
_local2.aPriority = ["Jump", "Coral", "Laser", "PowerUp", "Tree", "Rock", "SnowBank", "Shell"];
_local2.nCharacterAppearanceDelay = 12;
_local2.nMAX_CHAR_PER_ROUND = 20;
_local2.nELEMENTS_DISTANCE_X = 50;
_local2.nELEMENTS_DISTANCE_Y = 25;
_local2.nSTART_Y = -80;
_local2.nNB_COLUMNS = 4;
_local2.nNB_ROWS = 9;
_local2.nPOWERUP_SPEED = 2;
_local2.nOBSTACLE_EASING_SPEED = 1;
_local2.nCHAR_FOR_LEVEL = 15;
}
return(_local2);
}
static function score() {
var _local1 = new Object();
var _local2 = new Object();
_local1.nPtsPowerUp = 250;
_local1.nPtsAnchovy = 300;
_local1.nPtsSnowBank = 300;
_local1.nPtsSnowMan = 300;
_local1.nPtsCharacter = 1000;
_local1.nPtsTimeFinish = 5000;
_local1.nPtsTimeBonus = 200;
return(_local1);
}
static var bCHEATS = true;
static var STG_FPS = 35;
static var sHS_GAME_ID = "sb_peak";
static var EEGG_KEY = 78;
static var STAGE_WIDTH = 600;
static var engine = {fps:STG_FPS};
}
Symbol 1083 MovieClip [__Packages.GameParam] Frame 0
class GameParam
{
var mcRef, mcRefMain, oParamBroadcaster, oTransit, oPopUp, oSnd, bSubmitScore, bAllowSubmit, nLevel, nScore, nTime, nLives;
function GameParam (_mcRef) {
mcRef = _mcRef;
mcRef.onEnterFrame = mx.utils.Delegate.create(this, enterFrame);
mcRefMain = mcRef._parent;
oParamBroadcaster = new Object();
AsBroadcaster.initialize(oParamBroadcaster);
}
function createTransition(_mcRef, _mcRefMain) {
oTransit = new Game.Transition(_mcRef, "oTransit", _mcRefMain);
}
function createPopUps(_mcRef) {
oPopUp = new PopUp(_mcRef);
}
function initParam() {
resetParams();
createPopUps(mcRef._parent.mcPopUp);
createTransition(mcRef._parent.mcTransit, mcRefMain);
oParamBroadcaster.addListener(oPopUp);
oParamBroadcaster.addListener(oTransit);
oSnd = new Library.Sound.SoundCall();
Library.Sound.SoundManager.doInit(mcRefMain.mcSound);
Library.Sound.SoundManager.setCategoryVolume(sSOUND_CAT_MUSIC, 70);
Library.Sound.SoundManager.setCategoryVolume(sSOUND_CAT_SFX, 80);
oSnd.playMusicPackaging();
bSubmitScore = false;
bAllowSubmit = false;
}
function upgradeLevel() {
nLevel++;
if (nLevel == 3) {
_global.C.manageGameStep();
} else if (nLevel >= 6) {
_global.C.manageGameStep();
}
_global.C.showPanel();
}
function setMusicBtn(_mcRef) {
if (Library.Sound.SoundManager.isCategoryMuted("music")) {
_mcRef.gotoAndStop("Music_Off");
}
}
function setSoundBtn(_mcRef) {
if (Library.Sound.SoundManager.isCategoryMuted("SFX")) {
_mcRef.gotoAndStop("Sound_Off");
}
}
function muteSFX(_bMute) {
if (_bMute) {
Library.Sound.SoundManager.doMuteCategory("SFX");
} else {
Library.Sound.SoundManager.doUnMuteCategory("SFX");
}
}
function muteMusic(_bMute) {
if (_bMute) {
Library.Sound.SoundManager.doMuteCategory("music");
} else {
Library.Sound.SoundManager.doUnMuteCategory("music");
}
}
function showHideFriends() {
if (nLevel >= 3) {
_global.C.oHud.hideFriends();
}
}
function resetParamAndStart() {
resetParams();
oSnd.stopAllSFX();
oSnd.stopMusic();
oTransit.goTo("StartScene");
}
function isInRound1() {
var _local2 = false;
if (nLevel < 3) {
_local2 = true;
}
return(_local2);
}
function showScoreHS() {
mcRefMain.mcState.txtScore1.text = HighScores.styleNumber(nScore, 1);
}
function resetParams() {
nLevel = 0;
nTime = Config.getLevel().nTIME_FOR_GAME;
nScore = 0;
nLives = Config.getPlayer().nTOTAL_LIVES;
}
function enterFrame() {
oParamBroadcaster.broadcastMessage("doAction");
}
var sSOUND_CAT_MUSIC = "music";
var sSOUND_CAT_SFX = "SFX";
}
Symbol 1084 MovieClip [__Packages.Game.State] Frame 0
class Game.State
{
var mcRef, sName, nPosX, nPosY, bPausable, sState, nNbFrAnim, onStateEnd;
function State (_mcRef) {
mcRef = _mcRef;
sName = _mcRef._name;
nPosX = mcRef._x;
nPosY = mcRef._y;
bPausable = true;
_global.C.oActionBroadcast.addListener(this);
}
function doPause() {
mcRef.mcState.stop();
}
function doUnpause() {
mcRef.mcState.play();
}
function doAction() {
if (!bPausable) {
this[sState]();
} else if (!_global.C.bPause) {
this[sState]();
}
if (mcRef.mcState._currentframe == nNbFrAnim) {
onStateEnd();
}
}
function setState(_sState) {
if (sState != _sState) {
sState = _sState;
mcRef.gotoAndStop(sState);
nNbFrAnim = mcRef.mcState._totalframes;
delete onStateEnd;
}
}
function getState() {
return(sState);
}
function isStateFinished() {
var _local2 = false;
if (mcRef.mcState._currentframe == nNbFrAnim) {
_local2 = true;
}
return(_local2);
}
function destroy() {
mcRef.swapDepths(50);
mcRef.removeMovieClip();
_global.C.oActionBroadcast.removeListener(this);
}
}
Symbol 1085 MovieClip [__Packages.Game.Transition] Frame 0
class Game.Transition extends Game.State
{
var bPausable, setState, fToLaunchAfterClose, fToLaunch, fLaunched, nNbFrAnim, mcRef;
function Transition (_mcRef) {
super(_mcRef);
bPausable = false;
_global.T = this;
_global.C.oActionBroadcast.addListener(this);
setState("Idle");
}
function goTo(_sFrame) {
fToLaunchAfterClose = undefined;
_global.P.oSnd.playTransition();
if (_sFrame == "InGameInstructP1") {
_global.C.callPause();
launch(_global.P.oPopUp.mcRef.mcState.mcMenu, function () {
this.gotoAndStop("InGameInstructP1");
});
} else if (_sFrame == "InGameMenu") {
launch(_global.P.oPopUp.mcRef.mcState.mcMenu, function () {
this.gotoAndStop("Menu");
});
} else {
launch(_global.P.mcRefMain, function () {
this.gotoAndStop(_sFrame);
});
}
}
function goToClose(_sFrame) {
_global.P.oSnd.playTransition();
launchSetClosingFct(_global.P.mcRefMain, function () {
this.gotoAndStop(_sFrame);
}, function () {
_global.C.manageGameStep();
});
}
function launch(_oCaller, _fFunc) {
startTransition(mx.utils.Delegate.create(_oCaller, _fFunc));
}
function launchSetClosingFct(_oCaller, _fFunc, _fClosingFunc) {
startTransition(mx.utils.Delegate.create(_oCaller, _fFunc));
fToLaunchAfterClose = _fClosingFunc;
}
function startTransition(_fToLaunch) {
fToLaunch = _fToLaunch;
setState("Opening");
}
function launchFunction() {
fToLaunch();
fLaunched = fToLaunch;
}
function launchClosingFunction() {
fToLaunchAfterClose();
fLaunched = fToLaunchAfterClose;
}
function Opening() {
if (mcRef.mcState._currentframe >= nNbFrAnim) {
setState("Opened");
}
}
function Opened() {
if (mcRef.mcState._currentframe >= nNbFrAnim) {
launchFunction();
_global.P.oSnd.playTransitionEnd();
setState("Closing");
}
}
function Closing() {
if (mcRef.mcState._currentframe >= nNbFrAnim) {
setState("Idle");
if (fToLaunchAfterClose != undefined) {
launchClosingFunction();
}
}
}
}
Symbol 1086 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 1087 MovieClip [__Packages.PopUp] Frame 0
class PopUp extends Game.State
{
var sCurPopUp, bPausable, bOpenQuit, bOpenMenu, bQuitGame, bRestart, setState, mcRef, nNbFrAnim;
function PopUp (_mcRef) {
super(_mcRef);
sCurPopUp = "";
bPausable = false;
bOpenQuit = false;
bOpenMenu = false;
bQuitGame = false;
bRestart = false;
setState("Close");
}
function setOpen(_sPopUp, _bPause) {
if (_bPause == true) {
_global.C.callPause();
}
sCurPopUp = _sPopUp;
setState(_sPopUp + "Opening");
mcRef.LockBtn.useHandCursor = false;
if (sCurPopUp == "Menu") {
_global.P.setMusicBtn(mcRef.mcState.mcMenu.mcMusicBtn);
_global.P.setSoundBtn(mcRef.mcState.mcMenu.mcSoundBtn);
}
}
function setClose() {
setState(sCurPopUp + "Closing");
if (sCurPopUp == "Menu") {
_global.P.setMusicBtn(mcRef.mcState.mcMenu.mcMusicBtn);
_global.P.setSoundBtn(mcRef.mcState.mcMenu.mcSoundBtn);
}
}
function Close() {
}
function MenuOpening() {
if (mcRef.mcState._currentframe >= nNbFrAnim) {
setState("MenuOpen");
_global.P.setMusicBtn(mcRef.mcState.mcMenu.mcMusicBtn);
_global.P.setSoundBtn(mcRef.mcState.mcMenu.mcSoundBtn);
}
}
function MenuOpen() {
}
function MenuClosing() {
if (mcRef.mcState._currentframe >= nNbFrAnim) {
if (bOpenQuit == false) {
setState("Close");
if (bRestart) {
bRestart = false;
_global.P.oSnd.stopAllSFX();
_global.P.resetParamAndStart();
} else {
_global.C.callUnpause();
}
} else {
sCurPopUp = "Quit";
setState("QuitOpening");
}
}
}
function QuitOpening() {
if (mcRef.mcState._currentframe >= nNbFrAnim) {
setState("QuitOpen");
}
}
function QuitOpen() {
}
function QuitClosing() {
if (mcRef.mcState._currentframe >= nNbFrAnim) {
if (bOpenMenu == true) {
bOpenMenu = false;
sCurPopUp = "Menu";
setState("MenuOpening");
} else {
sCurPopUp = "";
if (bQuitGame == true) {
bQuitGame = false;
_global.C.oScoresManager.saveScore();
_global.P.oSnd.stopAllSFX();
_global.P.oSnd.playMusicPackaging();
_global.P.oTransit.goTo("LoseScr");
} else {
_global.C.callUnpause();
}
setState("Close");
}
}
}
}
Symbol 1088 MovieClip [__Packages.Library.Sound.SoundCall] Frame 0
class Library.Sound.SoundCall
{
var oTransition, oBtnSFX, oAvalanche, oBob, oBobTurn, oObstacles, oHeatRay, oPowerUp, oCurrentTransition, oCurrentMusic;
function SoundCall () {
}
function playTransition() {
oTransition = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndTransition", 0, 1);
oTransition.setFadeRate(50);
oTransition.doFadeTo(100, true);
}
function playTransitionEnd() {
oTransition = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndTransitionEnd", 100, 1);
}
function playBtnRollOver() {
oBtnSFX = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndButtonRollOver", 100);
}
function playBtnClick() {
oBtnSFX = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndButtonClick", 100);
}
function stopAllSFX() {
oAvalanche.doStop();
oBob.doStop();
oBobTurn.doStop();
oObstacles.doStop();
oHeatRay.doStop();
oPowerUp.doStop();
oBtnSFX.doStop();
}
function pauseAllSFX() {
oAvalanche.doPause();
oBob.doPause();
oHeatRay.doPause();
}
function resumeAllSFX() {
oAvalanche.doResume();
oBob.doResume();
oHeatRay.doResume();
}
function playStartAvalanche() {
oAvalanche = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndAvalanche", 100, 1);
oAvalanche.setFadeRate(1);
oAvalanche.doFadeTo(0, true);
}
function playCoverAvalanche() {
oAvalanche = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndAvalanche", 100, 1);
}
function stopCoverAvalanche() {
oAvalanche.setFadeRate(4);
oAvalanche.doFadeTo(0, true);
}
function playBobIdle(_bStopPrevious) {
if ((oBob.__get__LinkageName() != "sndBobIdle") && (_bStopPrevious)) {
stopBobSFX();
}
oBob = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndBobIdle", 70, 1, true);
}
function stopBobSFX() {
oBob.doStop();
}
function playBobTurn() {
oBobTurn = Library.Sound.SoundManager.doPlayRandomSoundInCat(_global.P.sSOUND_CAT_SFX, "sndBobTurn", oBobTurn, 80, 4, true);
}
function playBobHurt() {
oBob = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndBobHurt", 90, 1);
}
function playBobOnJump() {
oBob = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndBobOnJump", 100, 1, true);
}
function playBobJump() {
oBob = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndBobJumping", 100, 1, true);
}
function playBobLand() {
oBob = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndBobLanding", 100, 1, true);
}
function playSnowballIdle() {
oBob = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndSnowballIdle", 60, 1, true);
}
function playSnowballStartJump() {
oBob = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndSnowballStartJump", 100, 1, true);
}
function playSnowballJump() {
oBob = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndSnowballJumping", 100, 1, true);
}
function playSnowballLand() {
oBob = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndSnowballLanding", 100, 1, true);
}
function playGrabCharacter() {
oPowerUp = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndGrabCharacter", 100, 1);
}
function playGrabAnchovy() {
oPowerUp = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndGrabAnchovy", 100, 1);
}
function playGrabGary() {
oPowerUp = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndGrabGary", 80, 1);
}
function playObstacleHit(_sType) {
switch (_sType) {
case "Coral" :
case "Rock" :
oObstacles = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndHitRock", 80, 1);
break;
case "Tree" :
oObstacles = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndHitTree", 70, 1);
break;
case "Shell" :
oObstacles = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndHitShell", 80, 1);
break;
case "Laser" :
oObstacles = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndHitLaser", 80, 1, true);
}
}
function playHeatRayAppears() {
oHeatRay = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndHeatRayAppears", 100, 1, true);
}
function playHeatRayHurt() {
stopHeatRay();
oHeatRay = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndHeatRayHurt", 100, 1, true);
}
function stopHeatRay() {
oHeatRay.doStop();
}
function playHitSnowBank() {
oObstacles = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndHitSnowBank", 100, 1);
}
function playHitSnowMan() {
oObstacles = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndHitSnowMan", 100, 1);
}
function playGaryIdle() {
oObstacles = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_SFX, "sndGaryIdle", 60, 1, true);
}
function pauseMusic() {
oCurrentTransition.doPause();
oCurrentMusic.doPause();
}
function resumeMusic() {
oCurrentTransition.doResume();
oCurrentMusic.doResume();
}
function playMusicPackaging() {
stopMusic();
oCurrentMusic = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_MUSIC, "sndMusicPack", 80, 9999);
}
function playMusicInGame() {
stopMusic();
oCurrentMusic = Library.Sound.SoundManager.doPlaySoundInCat(_global.P.sSOUND_CAT_MUSIC, "sndMusicGame", 90, 9999);
}
function stopMusic() {
oCurrentMusic.setFadeRate();
oCurrentMusic.doFadeTo(0, true);
}
}
Symbol 1089 MovieClip [__Packages.Library.Sound.SoundItem] Frame 0
class Library.Sound.SoundItem
{
var sndObj, sLinkage, mcRef, nRemainingLoop, nCurrentVolume, nTargetVolume, nFadeRate, sCategory, bFadeAtEnd, bMuted, bPaused, bNeedFreshStart, nCurrentTime, aEventListeners, bStopAfterFade;
function SoundItem (__sndObject, __sLinkage, __nVolume, __nLoop, __sCategory, __mc) {
sndObj = __sndObject;
sLinkage = __sLinkage;
mcRef = __mc;
nRemainingLoop = __nLoop;
nCurrentVolume = __nVolume;
nTargetVolume = __nVolume;
nFadeRate = FADE_RATE;
sCategory = __sCategory;
bFadeAtEnd = false;
bMuted = false;
bPaused = false;
bNeedFreshStart = false;
sndObj.onSoundComplete = Library.Utils.Delegate.create(this, doSoundComplete);
sndObj.start(0, __nLoop);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
nCurrentTime = 0;
aEventListeners = new Array();
}
function doEnterFrame() {
if (!bPaused) {
if (nCurrentTime > sndObj.position) {
nRemainingLoop--;
}
nCurrentTime = sndObj.position;
}
doCheckFadeAtEnd();
doManageFade();
}
function doAddListener(__oListener) {
aEventListeners.push(__oListener);
}
function doRemoveListener(__oListener) {
var _local2 = 0;
while (_local2 < aEventListeners.length) {
if (aEventListeners[_local2] == __oListener) {
delete aEventListeners[_local2];
aEventListeners.splice(_local2, 1);
}
_local2++;
}
}
function doSoundComplete() {
if (bNeedFreshStart && (nRemainingLoop > 1)) {
sndObj.start(0, nRemainingLoop - 1);
} else {
doManageEndEvent();
}
}
function doUpdateSound() {
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
function doMute() {
bMuted = true;
doUpdateSound();
}
function doUnMute() {
bMuted = false;
doUpdateSound();
}
function doPause() {
sndObj.stop();
bPaused = true;
}
function doResume() {
bPaused = false;
bNeedFreshStart = true;
sndObj.start(nCurrentTime / 1000, 1);
}
function doStop() {
sndObj.stop();
doManageEndEvent();
}
function doFadeTo(__nVolume, __bStopAndDelete) {
if (__bStopAndDelete == undefined) {
__bStopAndDelete = true;
}
bStopAfterFade = __bStopAndDelete;
nTargetVolume = __nVolume;
}
function setVolumeTo(_nVolume) {
sndObj.setVolume(returnComputedVolume(_nVolume));
}
function setFadeRate(__nRate) {
if (__nRate == undefined) {
__nRate = FADE_RATE;
}
nFadeRate = __nRate;
}
function setFadeAtEnd(__bFadeAtEnd) {
bFadeAtEnd = true;
}
function setPan(__nPan) {
sndObj.setPan(__nPan);
}
function get Category() {
return(sCategory);
}
function get LinkageName() {
return(sLinkage);
}
function get Volume() {
return(sndObj.getVolume());
}
function get Position() {
return(sndObj.position);
}
function get SoundObject() {
return(sndObj);
}
function doCheckFadeAtEnd() {
if (bFadeAtEnd) {
if (nRemainingLoop == 1) {
if ((sndObj.duration - nCurrentTime) <= FADE_AT_END_TIME) {
doFadeTo(0);
}
}
}
}
function doManageEndEvent() {
var _local2 = 0;
while (_local2 < aEventListeners.length) {
aEventListeners[_local2].doSoundEvent(Library.Sound.SoundManager.EVENT_SOUND_COMPLETE, this);
_local2++;
}
aEventListeners = new Array();
mcRef.removeMovieClip();
delete mcRef;
delete aEventListeners;
delete sndObj.onSoundComplete;
delete sndObj;
}
function doManageFade() {
if (nCurrentVolume != nTargetVolume) {
nCurrentVolume = Library.Utils.MoreMath.getReachNum(nCurrentVolume, nTargetVolume, nFadeRate);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
if ((nCurrentVolume <= 0) && (bStopAfterFade)) {
sndObj.stop();
doManageEndEvent();
}
}
function returnComputedVolume(__nVolume) {
var _local2;
if ((!bMuted) && (!Library.Sound.SoundManager.isCategoryMuted(sCategory))) {
var _local3 = Library.Sound.SoundManager.__get__MasterVolume() / 100;
var _local4 = Library.Sound.SoundManager.getCategoryVolume(sCategory) / 100;
_local2 = __nVolume;
_local2 = _local2 * _local4;
_local2 = _local2 * _local3;
} else {
_local2 = 0;
}
return(_local2);
}
static var FADE_RATE = 8;
static var FADE_AT_END_TIME = 800;
}
Symbol 1090 MovieClip [__Packages.Library.Utils.Delegate] Frame 0
class Library.Utils.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;
var _local4 = arguments.callee.func;
var _local2 = arguments.callee.arg;
_local2 = _local2.concat(arguments);
return(_local4.apply(_local3, _local2));
};
_local2.target = obj;
_local2.func = func;
_local2.arg = arguments.slice(2);
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 1091 MovieClip [__Packages.Library.Sound.SoundManager] Frame 0
class Library.Sound.SoundManager
{
static var aSounds, nSoundNum, mcAttach, aSoundCategories, nMasterVolume, oEnterFrameListener;
function SoundManager () {
}
static function doPlaySound(__sLinkage, __nVolume, __nLoop, __bUnique) {
return(doPlaySoundInCat(DEFAULT_CATEGORY, __sLinkage, __nVolume, __nLoop, __bUnique));
}
static function doPlaySoundInCat(__sCategoryName, __sLinkage, __nVolume, __nLoop, __bUnique) {
doCheckInit();
if (__nVolume == undefined) {
__nVolume = 100;
}
if (__nLoop == undefined) {
__nLoop = 1;
}
if (__bUnique == undefined) {
__bUnique = false;
}
var _local1;
var _local2;
if (__bUnique) {
var _local4 = isSoundPlaying(__sLinkage);
_local2 = !_local4.bPlaying;
if (!_local2) {
_local1 = _local4.oSound;
}
} else {
_local2 = true;
}
if (_local2) {
doManageCategory(__sCategoryName);
var _local5 = getMCForSound();
var _local3 = new Sound(_local5);
_local3.attachSound(__sLinkage);
if (_local3.duration != undefined) {
_local1 = new Library.Sound.SoundItem(_local3, __sLinkage, __nVolume, __nLoop, __sCategoryName, _local5);
}
_local1.doAddListener(Library.Sound.SoundManager);
aSounds.push(_local1);
}
return(_local1);
}
static function doPlayRandomSoundInCat(_sCategoryName, _sLinkagePrefix, _oSndLink, _nVolume, _nAmount, _bUnique) {
doCheckInit();
if (_nVolume == undefined) {
_nVolume = 100;
}
if (_bUnique == undefined) {
_bUnique = false;
}
var _local2 = false;
var _local7 = 1;
var _local5;
var _local1 = _sLinkagePrefix;
var _local6 = Math.floor((Math.random() * _nAmount) + 1);
_local1 = ((_local1 + "") + _local6) + "";
var _local3 = false;
if (_oSndLink != undefined) {
_local3 = isSoundPlaying(_oSndLink.__get__LinkageName()).bPlaying;
if ((!_local3) || (!_bUnique)) {
_local2 = true;
} else {
_local5 = _oSndLink;
}
} else {
_local2 = true;
}
if (_local2) {
_local5 = doPlaySoundInCat(_sCategoryName, _local1, _nVolume, _local7, _bUnique);
}
return(_local5);
}
static function isSoundPlaying(__sLinkageName) {
var _local1 = new Object();
_local1.bPlaying = false;
_local1.oSound = undefined;
for (var _local3 in aSounds) {
if (aSounds[_local3].LinkageName == __sLinkageName) {
_local1.bPlaying = true;
_local1.oSound = aSounds[_local3];
}
}
return(_local1);
}
static function doManageExternalSound(__oSound) {
doCheckInit();
doManageCategory(__oSound.__get__Category());
__oSound.doAddListener(Library.Sound.SoundManager);
aSounds.push(__oSound);
}
static function getMCForSound() {
nSoundNum++;
var _local1 = mcAttach.createEmptyMovieClip("Snd" + nSoundNum, nSoundNum);
return(_local1);
}
static function doInit(__mcAttach) {
mcAttach = __mcAttach;
if (!bInited) {
bInited = true;
nSoundNum = 0;
aSounds = new Array();
aSoundCategories = new Array();
nMasterVolume = 100;
mx.transitions.OnEnterFrameBeacon.init();
oEnterFrameListener = new Object();
oEnterFrameListener.onEnterFrame = Library.Utils.Delegate.create(Library.Sound.SoundManager, doEnterFrame);
MovieClip.addListener(oEnterFrameListener);
}
}
static function doEnterFrame() {
for (var _local1 in aSounds) {
aSounds[_local1].doEnterFrame();
}
}
static function setCategoryVolume(__sCategoryName, __nVol) {
doManageCategory(__sCategoryName);
for (var _local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == __sCategoryName) {
aSoundCategories[_local3].nVolume = __nVol;
}
}
doUpdateAllSoundsVolume();
}
static function getCategoryVolume(__sCategoryName) {
doManageCategory(__sCategoryName);
var _local1;
for (var _local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == __sCategoryName) {
_local1 = aSoundCategories[_local3].nVolume;
}
}
return(_local1);
}
static function isCategoryMuted(__sCategoryName) {
doManageCategory(__sCategoryName);
var _local1;
for (var _local3 in aSoundCategories) {
if (aSoundCategories[_local3].sName == __sCategoryName) {
_local1 = aSoundCategories[_local3].bMuted;
}
}
return(_local1);
}
static function doSoundEvent(__nEvent, __oSound) {
if (!(__nEvent === EVENT_SOUND_COMPLETE)) {
} else {
for (var _local2 in aSounds) {
if (aSounds[_local2] == __oSound) {
delete aSounds[_local2];
aSounds.splice(_local2, 1);
}
}
}
}
static function doMuteCategory(__sCategoryName) {
for (var _local2 in aSoundCategories) {
if (aSoundCategories[_local2].sName == __sCategoryName) {
aSoundCategories[_local2].bMuted = true;
}
}
doUpdateAllSoundsVolume();
}
static function doUnMuteCategory(__sCategoryName) {
for (var _local2 in aSoundCategories) {
if (aSoundCategories[_local2].sName == __sCategoryName) {
aSoundCategories[_local2].bMuted = false;
}
}
doUpdateAllSoundsVolume();
}
static function setMasterVolume(__nVol) {
nMasterVolume = __nVol;
doUpdateAllSoundsVolume();
}
static function get MasterVolume() {
return(nMasterVolume);
}
static function doRemoveListenerFromAllSounds(__oListener) {
for (var _local2 in aSounds) {
aSounds[_local2].doRemoveListener(__oListener);
}
}
static function doUpdateAllSoundsVolume() {
for (var _local1 in aSounds) {
aSounds[_local1].doUpdateSound();
}
}
static function doCheckInit() {
if (!bInited) {
}
}
static function doManageCategory(__sCategoryName) {
doCheckInit();
var _local1 = false;
for (var _local4 in aSoundCategories) {
if (aSoundCategories[_local4].sName == __sCategoryName) {
_local1 = true;
}
}
if (!_local1) {
var _local3 = new Object();
_local3.sName = __sCategoryName;
_local3.nVolume = 100;
_local3.bMuted = false;
aSoundCategories.push(_local3);
}
}
static var EVENT_SOUND_COMPLETE = 1;
static var DEFAULT_CATEGORY = "SFX";
static var bInited = false;
}
Symbol 1092 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local4 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local4);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
static var version = "1.1.0.52";
}
Symbol 1093 MovieClip [__Packages.mx.transitions.BroadcasterMX] Frame 0
class mx.transitions.BroadcasterMX
{
var _listeners;
function BroadcasterMX () {
}
static function initialize(o, dontCreateArray) {
if (o.broadcastMessage != undefined) {
delete o.broadcastMessage;
}
o.addListener = mx.transitions.BroadcasterMX.prototype.addListener;
o.removeListener = mx.transitions.BroadcasterMX.prototype.removeListener;
if (!dontCreateArray) {
o._listeners = new Array();
}
}
function addListener(o) {
removeListener(o);
if (broadcastMessage == undefined) {
broadcastMessage = mx.transitions.BroadcasterMX.prototype.broadcastMessage;
}
return(_listeners.push(o));
}
function removeListener(o) {
var _local2 = _listeners;
var _local3 = _local2.length;
while (_local3--) {
if (_local2[_local3] == o) {
_local2.splice(_local3, 1);
if (!_local2.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local5 = String(arguments.shift());
var _local4 = _listeners.concat();
var _local6 = _local4.length;
var _local3 = 0;
while (_local3 < _local6) {
_local4[_local3][_local5].apply(_local4[_local3], arguments);
_local3++;
}
}
static var version = "1.1.0.52";
}
Symbol 1094 MovieClip [__Packages.Library.Utils.MoreMath] Frame 0
class Library.Utils.MoreMath
{
function MoreMath () {
}
static function getRandomRange(__nMin, __nMax) {
return(Math.floor(Math.random() * ((__nMax + 1) - __nMin)) + __nMin);
}
static function getPolarity(__nNum) {
var _local1 = 0;
if (__nNum < 0) {
_local1 = -1;
} else if (__nNum > 0) {
_local1 = 1;
}
return(_local1);
}
static function getReachZero(__nNum, __nReducer) {
return(getReachNum(__nNum, 0, __nReducer));
}
static function getReachNum(__nNum, __nTargetNum, __nReducer) {
var _local1 = __nNum;
if (_local1 != __nTargetNum) {
if (_local1 < __nTargetNum) {
_local1 = _local1 + __nReducer;
if (_local1 > __nTargetNum) {
_local1 = __nTargetNum;
}
} else {
_local1 = _local1 - __nReducer;
if (_local1 < __nTargetNum) {
_local1 = __nTargetNum;
}
}
}
return(_local1);
}
static function getDistance(__nX1, __nY1, __nX2, __nY2) {
return(Math.sqrt(Math.pow(Math.abs(__nX2 - __nX1), 2) + Math.pow(Math.abs(__nY2 - __nY1), 2)));
}
static function getAngle(__nX1, __nY1, __nX2, __nY2) {
var _local3;
var _local2;
var _local1;
_local3 = Math.abs(__nX2) - Math.abs(__nX1);
_local2 = Math.abs(__nY2) - Math.abs(__nY1);
_local1 = Math.atan2(_local2, _local3);
_local1 = (_local1 * 180) / Math.PI;
return(_local1);
}
static function getHypotenuse(__nDX, __nDY) {
return(Math.sqrt(Math.pow(__nDX, 2) + Math.pow(__nDY, 2)));
}
static function getBoundsCenter(_oBox) {
var _local3 = (_oBox.xMin + _oBox.xMax) / 2;
var _local2 = (_oBox.yMin + _oBox.yMax) / 2;
return({x:_local3, y:_local2});
}
}
Symbol 1095 MovieClip [__Packages.GameController] Frame 0
class GameController
{
var mcRef, mcGame, bPause, sGameStep, oActionBroadcast, oHud, oPlayer, oAvalanche, oSnowBGManager, oPanelFGManager, oSceneryBGManager, oSkyManager, oObjectsManager, oTimeManager, oScoresManager, oTrailManager;
function GameController (_mcRef) {
mcRef = _mcRef;
mcGame = mcRef._parent;
bPause = false;
sGameStep = sSTEP_INIT;
oActionBroadcast = new Object();
AsBroadcaster.initialize(oActionBroadcast);
mcRef.onEnterFrame = mx.utils.Delegate.create(this, enterFrame);
}
function callPause() {
bPause = true;
oActionBroadcast.broadcastMessage("doPause");
_global.P.oSnd.pauseAllSFX();
}
function callUnpause() {
oActionBroadcast.broadcastMessage("doUnpause");
bPause = false;
_global.P.oSnd.resumeAllSFX();
}
function enterFrame() {
oActionBroadcast.broadcastMessage("doAction");
}
function initController() {
initGame();
}
function initGame() {
_global.P.nGameScore = 0;
oHud = new Hud(mcGame.mcHud);
oPlayer = new Game.Player(mcGame.mcGameCtn.mcObstacleCtn.mcPlayer, "oPlayer", this);
oAvalanche = new Game.Avalanche(mcGame.mcGameCtn.mcAvalanche, "oAvalanche", this);
oSnowBGManager = new Game.Backgrounds.SnowBGManager(mcGame.mcGameCtn.mcSnowBGCtn, oPlayer, "oSnowBGManager", this);
oPanelFGManager = new Game.Backgrounds.PanelFGManager(mcGame.mcGameCtn.mcPanelFGCtn, oPlayer, "oPanelFGManager", this);
oSceneryBGManager = new Game.Backgrounds.SceneryBGManager(mcGame.mcGameCtn.mcSceneryBGCtn, oPlayer, "oSceneryBGManager", this);
oSkyManager = new Game.Backgrounds.SkyManager(mcGame.mcSkyBGCtn, oPlayer, "oSkyManager", this);
oObjectsManager = new Game.ObjectsManager(mcGame.mcGameCtn.mcObstacleCtn, oPlayer, this);
oTimeManager = new Game.TimeManager(oHud, "oTimeManager", this);
oScoresManager = new Game.ScoresManager(mcGame, oHud, "oScoresManager", this);
oTrailManager = new Game.TrailManager(mcGame.mcGameCtn.mcObstacleCtn, oPlayer, "oTrailManager", this);
oTimeManager.resetTimer(_global.P.nTime);
manageGameStep();
}
function manageGameStep() {
switch (sGameStep) {
case sSTEP_INIT :
sGameStep = sSTEP_START_CUTSCENE;
_global.P.oSnd.playMusicInGame();
oPlayer.initVars();
manageGameStep();
break;
case sSTEP_START_CUTSCENE :
sGameStep = sSTEP_GAME;
if (!_global.P.isInRound1()) {
manageGameStep();
} else {
oAvalanche.startAvalanche();
}
break;
case sSTEP_GAME :
showPanel();
oPlayer.bAllowControls = true;
_global.minFPS = 40;
if (!_global.P.isInRound1()) {
sGameStep = sSTEP_ENDLASTROUND;
} else {
sGameStep = sSTEP_ENDFIRSTROUND;
}
break;
case sSTEP_ENDFIRSTROUND :
oObjectsManager.deleteMe();
_global.P.oSnd.stopAllSFX();
if (_global.P.nLives > 0) {
if (oPlayer.__get__NbCharacters() >= Config.getLevel().nMIN_NB_CHAR_FOR_ROUND2) {
_global.P.nTime = oTimeManager.Time;
sGameStep = sSTEP_SHOWCUTSCENE;
} else {
sGameStep = sSTEP_LOSE;
}
} else {
sGameStep = sSTEP_LOSE;
if (_global.P.isInRound1()) {
_global.P.oSnd.stopCoverAvalanche();
}
}
oScoresManager.saveScore();
manageGameStep();
break;
case sSTEP_SHOWCUTSCENE :
_global.P.oSnd.stopMusic();
showCutScene();
break;
case sSTEP_ENDLASTROUND :
oObjectsManager.deleteMe();
_global.P.oSnd.stopAllSFX();
_global.P.nLevel = 0;
if (_global.P.nLives > 0) {
if (oPlayer.mcRef._xscale >= Config.getPlayer().nSNOWBALL_GOAL_SCALE) {
sGameStep = sSTEP_WIN;
_global.P.nTime = oTimeManager.Time;
oScoresManager.addTimeBonus();
} else {
sGameStep = sSTEP_LOSE;
}
} else {
sGameStep = sSTEP_LOSE;
}
oScoresManager.saveScore();
manageGameStep();
break;
case sSTEP_WIN :
onGameWon();
break;
case sSTEP_LOSE :
onGameLost();
}
}
function showPanel() {
oHud.showPanel();
}
function destroy() {
delete oActionBroadcast;
delete mcRef.onEnterFrame;
}
function onGameLost() {
destroy();
_global.P.oSnd.playMusicPackaging();
_global.P.oTransit.goTo(sSTATE_LOSE);
}
function onGameWon() {
destroy();
_global.P.oSnd.stopAllSFX();
_global.P.oSnd.stopMusic();
_global.P.oTransit.goTo(sSTATE_WIN);
}
function showCutScene() {
destroy();
_global.P.oTransit.goTo(sSTATE_CUTSCENE);
}
var sSTATE_GAME_START = "Game";
var sSTATE_LOSE = "LoseScr";
var sSTATE_WIN = "GoodEnd";
var sSTATE_CUTSCENE = "CutScene";
var sSTEP_INIT = "Init";
var sSTEP_START_CUTSCENE = "StartCutScene";
var sSTEP_GAME = "Game";
var sSTEP_ENDFIRSTROUND = "EndFirstRound";
var sSTEP_ENDLASTROUND = "EndLastRound";
var sSTEP_SHOWCUTSCENE = "ShowCutScene";
var sSTEP_LOSE = "Lose";
var sSTEP_WIN = "Win";
}
Symbol 1096 MovieClip [__Packages.Hud] Frame 0
class Hud extends Game.State
{
var oLevelPanel, mcRef;
function Hud (_mcRef) {
super(_mcRef);
oLevelPanel = new Game.LevelPanel(mcRef.mcLevel, "oLevelPanel", this);
}
function showPanel() {
oLevelPanel.showNewLevel();
}
function updateLives(_nLives) {
mcRef.txtLives.text = _nLives;
}
function updateTime(_sTime) {
mcRef.txtTime.text = _sTime;
}
function updateFriends(_nFriends) {
mcRef.mcFriends.txtFriends.text = _nFriends;
}
function updateScore(_nScore) {
mcRef.txtScore.text = _nScore;
}
function hideFriends() {
mcRef.mcFriends._visible = false;
}
}
Symbol 1097 MovieClip [__Packages.Game.LevelPanel] Frame 0
class Game.LevelPanel extends Game.State
{
var oOwner, nLevel, sState, mcRef, nNbFrAnim, onStateEnd, isStateFinished;
function LevelPanel (_mcRef, _sName, _oOwner) {
super(_mcRef, _sName);
oOwner = _oOwner;
setState(sSTATE_IDLE);
}
function showNewLevel() {
nLevel = _global.P.nLevel;
if (nLevel >= 3) {
nLevel = nLevel - 3;
}
nLevel = nLevel + 1;
setState(sSTATE_OPENING);
}
function setState(_sState) {
if (sState != _sState) {
sState = _sState;
mcRef.gotoAndStop(sState);
nNbFrAnim = mcRef.mcState._totalframes;
delete onStateEnd;
showLevelNo();
}
}
function showLevelNo() {
mcRef.mcState.mcPanel.txtLevel.text = nLevel;
}
function Idle() {
}
function Showing() {
if (isStateFinished()) {
setState(sSTATE_CLOSING);
}
}
function Opening() {
if (isStateFinished()) {
setState(sSTATE_SHOWING);
}
}
function Closing() {
if (isStateFinished()) {
setState(sSTATE_IDLE);
}
}
var sSTATE_IDLE = "Idle";
var sSTATE_OPENING = "Opening";
var sSTATE_SHOWING = "Showing";
var sSTATE_CLOSING = "Closing";
}
Symbol 1098 MovieClip [__Packages.Game.DynamicCharacter] Frame 0
class Game.DynamicCharacter extends Game.State
{
var mcRef, oOwner, setState, bPausable, sState, getState, nHorizSpeed, nVerticalSpeed, nPosX, nPosY, bIsAttached, nBeforeJumpingY, nAscendingSpeed, nOnJumpDistance, sName, nFallingSpeed, isStateFinished;
function DynamicCharacter (_mcRef, _mcState, _sName, _oOwner) {
super(_mcState);
mcRef = _mcRef;
oOwner = _oOwner;
setState(sSTATE_IDLE);
_mcRef.swapDepths(1);
}
function doAction() {
if ((!bPausable) || (!_global.C.bPause)) {
this[sState]();
if (!isInJumpState()) {
horizGravity();
groundFriction();
checkLimits();
} else {
applyVerticalSpeed();
switch (getState()) {
case sSTATE_ONJUMP :
ascendOnJump();
break;
case sSTATE_STARTMIDAIR :
case sSTATE_INMIDAIR :
verticalGravity();
checkBottomLimit();
}
}
applyPosY();
movePlayer();
}
}
function initVars() {
nHorizSpeed = Config.getPlayer().nHORIZ_SPEED_NORMAL;
nVerticalSpeed = 0;
nPosX = mcRef._x;
nPosY = mcRef._y;
bIsAttached = false;
}
function getVerticalSpeed() {
return(nVerticalSpeed);
}
function getDistances() {
return({x1:DISTANCE_X1, x2:DISTANCE_X2, y1:DISTANCE_Y1, y2:DISTANCE_Y2});
}
function startJump(_mcRef) {
if ((!isInJumpState()) && (getState() != sSTATE_LANDJUMP)) {
nBeforeJumpingY = nPosY;
if (mcRef.getDepth() > _mcRef.getDepth()) {
mcRef.swapDepths(_mcRef);
}
nAscendingSpeed = (-1 * nHorizSpeed) * Math.tan(nJUMP_ANGLE);
nOnJumpDistance = 0;
setState(sSTATE_ONJUMP);
}
}
function isInJumpState() {
var _local2 = false;
if (((getState() == sSTATE_ONJUMP) || (getState() == sSTATE_STARTMIDAIR)) || (getState() == sSTATE_INMIDAIR)) {
_local2 = true;
}
return(_local2);
}
function deleteMe() {
delete this[sName];
}
function checkLimits() {
if ((nPosY <= SCREEN_LIMIT_DOWN) && (nPosY >= SCREEN_LIMIT_UP)) {
var _local3 = nPosY;
applyVerticalSpeed();
if (nPosY != _local3) {
if (nVerticalSpeed > 0) {
var _local5 = _local3 + DISTANCE_Y2;
var _local4 = nPosY + DISTANCE_Y2;
} else {
var _local5 = _local3 - DISTANCE_Y1;
var _local4 = nPosY - DISTANCE_Y1;
}
_global.C.oActionBroadcast.broadcastMessage("updateIsInRange", this, _local5, _local4);
nPosY = checkElementsInRange(nPosY, nVerticalSpeed > 0);
}
} else {
nVerticalSpeed = 0;
if (nPosY > SCREEN_LIMIT_DOWN) {
nPosY = SCREEN_LIMIT_DOWN;
} else if (nPosY < SCREEN_LIMIT_UP) {
nPosY = SCREEN_LIMIT_UP;
}
}
}
function checkElementsInRange(_nPosY, _bPlayerMovingDown) {
var _local6 = _nPosY;
var _local5;
var _local4 = _global.C.oObjectsManager.getObjectsInRange();
if (_local4.length > 0) {
if (_bPlayerMovingDown) {
var _local3 = 0;
while (_local3 < _local4.length) {
_local5 = (_local4[_local3].mcRef._y - _local4[_local3].nDistanceY1) - DISTANCE_Y2;
if ((_local3 == 0) || (_local5 < _local6)) {
_local6 = _local5;
}
_local3++;
}
} else {
var _local3 = 0;
while (_local3 < _local4.length) {
_local5 = (_local4[_local3].mcRef._y + _local4[_local3].nDistanceY2) + DISTANCE_Y1;
if ((_local3 == 0) || (_local5 > _local6)) {
_local6 = _local5;
}
_local3++;
}
}
}
if (_bPlayerMovingDown) {
_local6--;
} else {
_local6++;
}
return(_local6);
}
function checkBottomLimit() {
if (nPosY > SCREEN_LIMIT_DOWN) {
nVerticalSpeed = 0;
nPosY = SCREEN_LIMIT_DOWN;
}
}
function applyVerticalSpeed() {
var _local2 = nVerticalSpeed;
if ((nVerticalSpeed != 0) && (!isInJumpState())) {
var _local3 = -1;
if (nVerticalSpeed < 0) {
_local3 = 1;
}
_local2 = nVerticalSpeed;
}
nPosY = nPosY + _local2;
}
function applyPosY() {
mcRef._y = nPosY;
nPosY = mcRef._y;
}
function movePlayer() {
nPosX = nPosX + nHorizSpeed;
if (isInJumpState()) {
nOnJumpDistance = nOnJumpDistance + nHorizSpeed;
}
mcRef._x = nPosX;
}
function horizGravity() {
if (nHorizSpeed < Config.getPlayer().nHORIZ_SPEED_NORMAL) {
nHorizSpeed = nHorizSpeed + Config.getPlayer().nHORIZ_GRAVITY;
if (nHorizSpeed > Config.getPlayer().nHORIZ_SPEED_NORMAL) {
nHorizSpeed = Config.getPlayer().nHORIZ_SPEED_NORMAL;
if (getState() != sSTATE_SLOWEDDOWN) {
setState(sSTATE_IDLE);
}
}
}
}
function groundFriction() {
if (nHorizSpeed > Config.getPlayer().nHORIZ_SPEED_NORMAL) {
nHorizSpeed = nHorizSpeed + Config.getPlayer().nHORIZ_GROUND_FRICTION;
if (nHorizSpeed < Config.getPlayer().nHORIZ_SPEED_MIN) {
nHorizSpeed = Config.getPlayer().nHORIZ_SPEED_MIN;
}
}
}
function ascendOnJump() {
nVerticalSpeed = nAscendingSpeed;
if (nOnJumpDistance >= Config.getObsGrid().nJumpLength) {
nFallingSpeed = nVerticalSpeed + Config.getPlayer().nGRAVITY;
nVerticalSpeed = nFallingSpeed;
mcRef.swapDepths((_global.C.oObjectsManager.nDEPTH_START + _global.C.oObjectsManager.nObjectIndex) - 1);
setState(sSTATE_STARTMIDAIR);
}
}
function verticalGravity() {
if (nPosY < nBeforeJumpingY) {
nVerticalSpeed = nVerticalSpeed + Config.getPlayer().nGRAVITY;
} else {
nVerticalSpeed = 0;
nPosY = nBeforeJumpingY;
setState(sSTATE_LANDJUMP);
}
}
function Idle() {
}
function OnJump() {
}
function StartMidAir() {
if (isStateFinished()) {
setState(sSTATE_INMIDAIR);
}
}
function InMidAir() {
}
function LandJump() {
if (isStateFinished()) {
setState(sSTATE_IDLE);
}
}
function StartMovingUp() {
if (isStateFinished()) {
setState(sSTATE_IDLEUP);
}
}
function IdleUp() {
}
function EndMovingUp() {
if (isStateFinished()) {
setState(sSTATE_IDLE);
}
}
function StartMovingDown() {
if (isStateFinished()) {
setState(sSTATE_IDLEDOWN);
}
}
function IdleDown() {
}
function EndMovingDown() {
if (isStateFinished()) {
setState(sSTATE_IDLE);
}
}
var DISTANCE_X1 = 17;
var DISTANCE_X2 = 17;
var DISTANCE_Y1 = 4;
var DISTANCE_Y2 = 6;
var SCREEN_LIMIT_UP = -95;
var SCREEN_LIMIT_DOWN = 120;
var nJUMP_ANGLE = 0.750491578;
var sSTATE_IDLE = "Idle";
var sSTATE_SLOW = "Slow";
var sSTATE_ACCEL = "Accel";
var sSTATE_BUMP = "Bump";
var sSTATE_SLOWEDDOWN = "SlowedDown";
var sSTATE_ONJUMP = "OnJump";
var sSTATE_STARTMIDAIR = "StartMidAir";
var sSTATE_INMIDAIR = "InMidAir";
var sSTATE_LANDJUMP = "LandJump";
var sSTATE_STARTMOVINGUP = "StartMovingUp";
var sSTATE_STARTMOVINGDOWN = "StartMovingDown";
var sSTATE_ENDMOVINGUP = "EndMovingUp";
var sSTATE_ENDMOVINGDOWN = "EndMovingDown";
var sSTATE_IDLEUP = "IdleUp";
var sSTATE_IDLEDOWN = "IdleDown";
}
Symbol 1099 MovieClip [__Packages.Game.Player] Frame 0
class Game.Player extends Game.DynamicCharacter
{
var oOwner, sSTATE_IDLE, bPausable, sState, groundFriction, checkLimits, bAllowControls, sSTATE_ONJUMP, getState, sSTATE_STARTMIDAIR, sSTATE_INMIDAIR, checkBottomLimit, bIsSnowBall, applyPosY, movePlayer, mcRef, nNbFrAnim, onStateEnd, oLifeMinus, oLastTrailChar, aFollowingCharacters, aRescuedCharactersNo, nHorizSpeed, nVerticalSpeed, nNbOfChar, nVSpeedIncrement, nHitCounter, oLastObstacle, nPosX, nPosY, bIsAttached, aCharacters, nDestinScale, nScaleDirection, bEasterEggActive, nBrakingDuration, nTimeBetweenBrakes, bBrakeAvailable, bKeyBrakePressed, sSTATE_LANDJUMP, nBeforeJumpingY, nAscendingSpeed, nJUMP_ANGLE, nOnJumpDistance, sSTATE_SLOWEDDOWN, mcCharacters, sSTATE_STARTMOVINGUP, sSTATE_STARTMOVINGDOWN, sSTATE_ENDMOVINGUP, sSTATE_ENDMOVINGDOWN, sSTATE_IDLEUP, sSTATE_IDLEDOWN, bEEggKeyDown, SCREEN_LIMIT_UP, SCREEN_LIMIT_DOWN, nFallingSpeed, isStateFinished;
function Player (_mcRef, _sName, _oOwner) {
super(_mcRef, _mcRef, _sName, _oOwner);
oOwner = _oOwner;
setState(sSTATE_IDLE);
_mcRef.swapDepths(1);
}
function doAction() {
if ((!bPausable) || (!_global.C.bPause)) {
this[sState]();
checkEasterEgg();
if (!isInJumpState()) {
horizGravity();
groundFriction();
checkLimits();
if (bAllowControls) {
checkTimeForNextBrake();
checkControls();
}
} else {
applyVerticalSpeed();
switch (getState()) {
case sSTATE_ONJUMP :
case sSTATE_SNOWBALLONJUMP :
ascendOnJump();
break;
case sSTATE_STARTMIDAIR :
case sSTATE_INMIDAIR :
case sSTATE_SNOWBALLAIR :
verticalGravity();
checkBottomLimit();
}
}
if (bIsSnowBall) {
updateScales();
}
applyPosY();
movePlayer();
}
}
function setState(_sState) {
if (sState != _sState) {
sState = _sState;
mcRef.gotoAndStop(sState);
nNbFrAnim = mcRef.mcState._totalframes;
delete onStateEnd;
checkEasterEgg();
}
}
function initVars() {
oLifeMinus = new Game.LifeMinus(oOwner.mcGame.mcGameCtn.mcLife, "oLifeMinus", this);
oLastTrailChar = this;
aFollowingCharacters = new Array();
aRescuedCharactersNo = new Array();
nHorizSpeed = Config.getPlayer().nHORIZ_SPEED_NORMAL;
nVerticalSpeed = 0;
nNbOfChar = 0;
nVSpeedIncrement = 0;
if (!_global.P.isInRound1()) {
bIsSnowBall = true;
setState(sSTATE_SNOWBALLIDLE);
nHitCounter = Config.getPlayer().nHITS_BEFORE_LOSE_LIFE_ROUND2;
} else {
bIsSnowBall = false;
nHitCounter = Config.getPlayer().nHITS_BEFORE_LOSE_LIFE_ROUND1;
}
_global.C.oHud.updateLives(_global.P.nLives);
oLastObstacle = undefined;
nPosX = mcRef._x;
nPosY = mcRef._y;
bIsAttached = false;
aCharacters = new Array();
nDestinScale = 100;
nScaleDirection = 0;
bEasterEggActive = false;
bAllowControls = false;
nBrakingDuration = 0;
nTimeBetweenBrakes = Config.getPlayer().nTIME_FOR_NEXT_BRAKE;
bBrakeAvailable = true;
bKeyBrakePressed = false;
}
function startJump(_mcRef) {
if (((!isInJumpState()) && (getState() != sSTATE_LANDJUMP)) && (getState() != sSTATE_SNOWBALLLAND)) {
nBeforeJumpingY = nPosY;
if (mcRef.getDepth() > _mcRef.getDepth()) {
mcRef.swapDepths(_mcRef);
}
nAscendingSpeed = (-1 * nHorizSpeed) * Math.tan(nJUMP_ANGLE);
nOnJumpDistance = 0;
if (!bIsSnowBall) {
_global.P.oSnd.stopBobSFX();
setState(sSTATE_ONJUMP);
} else {
setState(sSTATE_SNOWBALLONJUMP);
}
prepareTrailingJump(_mcRef);
}
}
function getDistances() {
if (!bIsSnowBall) {
return({x1:DISTANCE_X1, x2:DISTANCE_X2, y1:DISTANCE_Y1, y2:DISTANCE_Y2});
}
var _local3 = Math.floor((mcRef._xscale * (DISTANCE_X1 + nSNOWBALL_DISTANCE_X_MOD)) / Config.getPlayer().nSNOWBALL_MIN_SCALE);
var _local4 = Math.floor((mcRef._xscale * (DISTANCE_X2 + nSNOWBALL_DISTANCE_X_MOD)) / Config.getPlayer().nSNOWBALL_MIN_SCALE);
var _local2 = Math.floor((mcRef._xscale * (DISTANCE_Y1 + nSNOWBALL_DISTANCE_Y_MOD)) / Config.getPlayer().nSNOWBALL_MIN_SCALE);
return({x1:_local3, x2:_local4, y1:_local2, y2:DISTANCE_Y2});
}
function slowDown(_oCurrentObstacle, _sType) {
if ((!isInJumpState()) && (_global.P.nLives > 0)) {
if (nHorizSpeed > Config.getPlayer().nHORIZ_SPEED_MIN) {
nHorizSpeed = nHorizSpeed + Config.getPlayer().nHORIZ_SLOWDOWN;
if (nHorizSpeed < Config.getPlayer().nHORIZ_SPEED_MIN) {
nHorizSpeed = Config.getPlayer().nHORIZ_SPEED_MIN;
}
}
if (!bIsSnowBall) {
_global.P.oSnd.playBobHurt();
setState(sSTATE_SLOWEDDOWN);
_global.P.oSnd.playObstacleHit(_sType);
if (((oLastObstacle == undefined) || (oLastObstacle.mcRef._x == undefined)) || ((_oCurrentObstacle != oLastObstacle) && (oLastObstacle.mcRef._x < _oCurrentObstacle.mcRef._x))) {
oLastObstacle = _oCurrentObstacle;
loseLife();
}
}
}
}
function growBall(_oCurrentObstacle, _nScaleModif) {
if (!isInJumpState()) {
setDestinationScale(_nScaleModif);
setVSpeedIncrementWithBallSize(_nScaleModif);
}
}
function reduceBall(_oCurrentObstacle, _nScaleModif, _sType) {
if (!isInJumpState()) {
_global.P.oSnd.playObstacleHit(_sType);
setState(sSTATE_SNOWBALLHURT);
if (((oLastObstacle == undefined) || (oLastObstacle.mcRef._x == undefined)) || ((_oCurrentObstacle != oLastObstacle) && (oLastObstacle.mcRef._x < _oCurrentObstacle.mcRef._x))) {
oLastObstacle = _oCurrentObstacle;
setDestinationScale(_nScaleModif);
loseLife();
}
}
}
function incrementNbOfChar() {
if (!isInJumpState()) {
nNbOfChar++;
}
}
function addCharacter(_nCharNo, _nPosX, _nPosY) {
if (!isInJumpState()) {
nVSpeedIncrement++;
var _local4 = _global.C.oObjectsManager.mcRef.attachMovie(sTRAIL_CHAR_LINKAGE, sTRAIL_CHAR_LINKAGE + _nCharNo, _global.C.oObjectsManager.mcRef.getNextHighestDepth(), {_x:_nPosX - Game.TrailCharacter.nMIN_DIST_FROM_TARGET, _y:_nPosY});
_local4.gotoAndStop(Game.TrailCharacter.sCHAR_LABEL + _nCharNo);
var _local5 = new Game.TrailCharacter(_local4, this, ("o" + sTRAIL_CHAR_LINKAGE) + _nCharNo, this);
if (oLastTrailChar != this) {
oLastTrailChar.setTarget(_local5);
}
oLastTrailChar = _local5;
aFollowingCharacters.push(oLastTrailChar);
aRescuedCharactersNo.push(_nCharNo);
_global.C.oHud.updateFriends(nNbOfChar);
}
}
function easeUpMovement() {
if (!isInJumpState()) {
nVSpeedIncrement = nVSpeedIncrement - Config.getLevel().nPOWERUP_SPEED;
if (_global.P.isInRound1()) {
var _local3 = Config.getPlayer().aSPEED_DOWN_CHAR.length - 1;
} else {
var _local3 = Config.getPlayer().aSPEED_DOWN_SNOWBALL.length - 1;
}
if (nVSpeedIncrement < 0) {
nVSpeedIncrement = 0;
} else if (nVSpeedIncrement > _local3) {
nVSpeedIncrement = _local3;
}
}
}
function easeUpByObstacle() {
if (!isInJumpState()) {
nVSpeedIncrement = nVSpeedIncrement - Config.getLevel().nOBSTACLE_EASING_SPEED;
var _local2 = Config.getPlayer().aSPEED_DOWN_SNOWBALL.length - 1;
if (nVSpeedIncrement < 0) {
nVSpeedIncrement = 0;
} else if (nVSpeedIncrement > _local2) {
nVSpeedIncrement = _local2;
}
}
}
function isInJumpState() {
var _local2 = false;
if (((((getState() == sSTATE_ONJUMP) || (getState() == sSTATE_STARTMIDAIR)) || (getState() == sSTATE_INMIDAIR)) || (getState() == sSTATE_SNOWBALLONJUMP)) || (getState() == sSTATE_SNOWBALLAIR)) {
_local2 = true;
}
return(_local2);
}
function prepareTrailingJump(_mcJump) {
var _local2 = 0;
while (_local2 < aFollowingCharacters.length) {
aFollowingCharacters[_local2].setJumping(mcRef._x, mcRef._y, _mcJump);
_local2++;
}
}
function setVSpeedIncrementWithBallSize(_nScaleMod) {
var _local2 = 0;
_local2 = Math.round((_nScaleMod / Config.getPlayer().nSNOWBALL_MIN_SCALE) * Config.getPlayer().aSPEED_DOWN_SNOWBALL.length);
var _local3 = Config.getPlayer().aSPEED_DOWN_SNOWBALL.length - 1;
if ((nVSpeedIncrement + _local2) > _local3) {
nVSpeedIncrement = _local3 - 1;
} else {
nVSpeedIncrement = nVSpeedIncrement + _local2;
}
}
function updateScales() {
var _local3 = mcRef._xscale;
_global.superTrace((nVSpeedIncrement + " ") + _local3);
if (((nScaleDirection < 0) && (_local3 > nDestinScale)) || ((nScaleDirection > 0) && (_local3 < nDestinScale))) {
_local3 = _local3 + nScaleDirection;
}
mcRef._xscale = _local3;
mcRef._yscale = _local3;
if (_local3 >= Config.getPlayer().nSNOWBALL_GOAL_SCALE) {
_global.C.manageGameStep();
}
}
function setDestinationScale(_nScale) {
var _local2 = mcRef._xscale;
nDestinScale = _local2 + _nScale;
if (nDestinScale < Config.getPlayer().nSNOWBALL_MIN_SCALE) {
nDestinScale = Config.getPlayer().nSNOWBALL_MIN_SCALE;
} else if (nDestinScale > Config.getPlayer().nSNOWBALL_MAX_SCALE) {
nDestinScale = Config.getPlayer().nSNOWBALL_MAX_SCALE;
}
if (nDestinScale < _local2) {
nScaleDirection = -1;
} else if (nDestinScale > _local2) {
nScaleDirection = 1;
} else {
nScaleDirection = 0;
}
}
function loseLife() {
nHitCounter--;
if (nHitCounter <= 0) {
if (!_global.P.isInRound1()) {
nHitCounter = Config.getPlayer().nHITS_BEFORE_LOSE_LIFE_ROUND2;
} else {
nHitCounter = Config.getPlayer().nHITS_BEFORE_LOSE_LIFE_ROUND1;
}
_global.P.nLives--;
_global.C.oHud.updateLives(_global.P.nLives);
oLifeMinus.showLife();
if (_global.P.nLives <= 0) {
bAllowControls = false;
if (_global.P.isInRound1()) {
oOwner.oAvalanche.coverAll(aRescuedCharactersNo);
}
}
}
if ((_global.P.nLives <= 0) && (!_global.P.isInRound1())) {
_global.C.manageGameStep();
}
}
function setMcCharacters() {
mcCharacters = mcRef.mcState.mcCharacters;
}
function checkTimeForNextBrake() {
nTimeBetweenBrakes++;
if (nTimeBetweenBrakes >= Config.getPlayer().nTIME_FOR_NEXT_BRAKE) {
bBrakeAvailable = true;
if (!bKeyBrakePressed) {
}
} else {
bBrakeAvailable = false;
}
}
function checkControls() {
switch (sState) {
case sSTATE_IDLE :
case sSTATE_SNOWBALLIDLE :
case sSTATE_STARTMOVINGUP :
case sSTATE_STARTMOVINGDOWN :
case sSTATE_ENDMOVINGUP :
case sSTATE_ENDMOVINGDOWN :
case sSTATE_IDLEUP :
case sSTATE_IDLEDOWN :
checkUpDown();
if (Key.isDown(37) && (Key.isDown(39))) {
} else if (Key.isDown(37)) {
if (!bKeyBrakePressed) {
bKeyBrakePressed = true;
}
if (bBrakeAvailable) {
if (nBrakingDuration < Config.getPlayer().nTIME_BRAKING) {
slowPlayer();
}
}
} else if (Key.isDown(39)) {
accelPlayer();
}
if (((!Key.isDown(37)) && (bKeyBrakePressed)) && (bBrakeAvailable)) {
bKeyBrakePressed = false;
nTimeBetweenBrakes = 0;
nBrakingDuration = 0;
}
break;
case sSTATE_SLOWEDDOWN :
checkUpDown();
}
}
function checkEasterEgg() {
if (Key.isDown(Config.EEGG_KEY) && (!bEEggKeyDown)) {
bEEggKeyDown = true;
invertEasterEgg();
} else if ((!Key.isDown(Config.EEGG_KEY)) && (bEEggKeyDown)) {
bEEggKeyDown = false;
}
if (bEasterEggActive) {
mcRef.mcState.mcHead.gotoAndStop(sSTATE_EEGG_SHOW);
} else {
mcRef.mcState.mcHead.gotoAndStop(sSTATE_EEGG_IDLE);
}
}
function invertEasterEgg() {
bEasterEggActive = !bEasterEggActive;
}
function applyVerticalSpeed() {
var _local3 = nVerticalSpeed;
if ((nVerticalSpeed != 0) && (!isInJumpState())) {
var _local4 = -1;
if (nVerticalSpeed < 0) {
_local4 = 1;
}
if (_global.P.isInRound1()) {
var _local5 = Config.getPlayer().aSPEED_DOWN_CHAR[nVSpeedIncrement];
} else {
var _local5 = Config.getPlayer().aSPEED_DOWN_SNOWBALL[nVSpeedIncrement];
}
_local3 = nVerticalSpeed + (_local4 * _local5);
}
nPosY = nPosY + _local3;
}
function accelPlayer() {
if (nHorizSpeed < Config.getPlayer().nHORIZ_SPEED_MAX) {
nHorizSpeed = nHorizSpeed + Config.getPlayer().nHORIZ_ACCEL;
if (nHorizSpeed > Config.getPlayer().nHORIZ_SPEED_MAX) {
nHorizSpeed = Config.getPlayer().nHORIZ_SPEED_MAX;
}
}
}
function slowPlayer() {
nBrakingDuration++;
if (nHorizSpeed > Config.getPlayer().nHORIZ_SPEED_BRAKE) {
nHorizSpeed = nHorizSpeed + Config.getPlayer().nHORIZ_BRAKE;
if (nHorizSpeed < Config.getPlayer().nHORIZ_SPEED_BRAKE) {
nHorizSpeed = Config.getPlayer().nHORIZ_SPEED_BRAKE;
}
}
}
function checkUpDown() {
if (Key.isDown(38) && (Key.isDown(40))) {
} else if (Key.isDown(38)) {
if (nPosY > SCREEN_LIMIT_UP) {
nVerticalSpeed = -1 * Config.getPlayer().nVERTICAL_SPEED;
if (((getState() != sSTATE_IDLEUP) && (getState() != sSTATE_SLOWEDDOWN)) && (!bIsSnowBall)) {
setState(sSTATE_STARTMOVINGUP);
}
} else if (nPosY <= SCREEN_LIMIT_UP) {
nVerticalSpeed = 0;
if (((getState() != sSTATE_IDLE) && (getState() != sSTATE_SLOWEDDOWN)) && (!bIsSnowBall)) {
setState(sSTATE_ENDMOVINGUP);
}
}
} else if (Key.isDown(40)) {
if (nPosY < SCREEN_LIMIT_DOWN) {
nVerticalSpeed = Config.getPlayer().nVERTICAL_SPEED;
if (((getState() != sSTATE_IDLEDOWN) && (getState() != sSTATE_SLOWEDDOWN)) && (!bIsSnowBall)) {
setState(sSTATE_STARTMOVINGDOWN);
}
} else if (nPosY >= SCREEN_LIMIT_DOWN) {
nVerticalSpeed = 0;
if (((getState() != sSTATE_IDLE) && (getState() != sSTATE_SLOWEDDOWN)) && (!bIsSnowBall)) {
setState(sSTATE_ENDMOVINGDOWN);
}
}
} else {
if (nVerticalSpeed > 0) {
if ((getState() != sSTATE_SLOWEDDOWN) && (!bIsSnowBall)) {
setState(sSTATE_ENDMOVINGDOWN);
}
} else if (nVerticalSpeed < 0) {
if ((getState() != sSTATE_SLOWEDDOWN) && (!bIsSnowBall)) {
setState(sSTATE_ENDMOVINGUP);
}
}
nVerticalSpeed = 0;
}
}
function horizGravity() {
if (nHorizSpeed < Config.getPlayer().nHORIZ_SPEED_NORMAL) {
nHorizSpeed = nHorizSpeed + Config.getPlayer().nHORIZ_GRAVITY;
if (nHorizSpeed > Config.getPlayer().nHORIZ_SPEED_NORMAL) {
nHorizSpeed = Config.getPlayer().nHORIZ_SPEED_NORMAL;
if (getState() != sSTATE_SLOWEDDOWN) {
if (!bIsSnowBall) {
setState(sSTATE_IDLE);
} else {
setState(sSTATE_SNOWBALLIDLE);
}
}
}
}
}
function ascendOnJump() {
nVerticalSpeed = nAscendingSpeed;
if (nOnJumpDistance >= Config.getObsGrid().nJumpLength) {
nFallingSpeed = nVerticalSpeed + Config.getPlayer().nGRAVITY;
nVerticalSpeed = nFallingSpeed;
mcRef.swapDepths((_global.C.oObjectsManager.nDEPTH_START + _global.C.oObjectsManager.nObjectIndex) - 1);
_global.P.oSnd.stopBobSFX();
if (!bIsSnowBall) {
setState(sSTATE_STARTMIDAIR);
} else {
_global.P.oSnd.playSnowballStartJump();
setState(sSTATE_SNOWBALLAIR);
}
}
}
function verticalGravity() {
if (nPosY < nBeforeJumpingY) {
nVerticalSpeed = nVerticalSpeed + Config.getPlayer().nGRAVITY;
} else {
nVerticalSpeed = 0;
nPosY = nBeforeJumpingY;
_global.P.oSnd.stopBobSFX();
if (!bIsSnowBall) {
setState(sSTATE_LANDJUMP);
} else {
setState(sSTATE_SNOWBALLLAND);
}
}
}
function Idle() {
_global.P.oSnd.playBobIdle(false);
}
function IdleUp() {
_global.P.oSnd.playBobIdle(false);
}
function IdleDown() {
_global.P.oSnd.playBobIdle(false);
}
function StartMovingUp() {
_global.P.oSnd.playBobTurn();
if (isStateFinished()) {
setState(sSTATE_IDLEUP);
}
}
function StartMovingDown() {
_global.P.oSnd.playBobTurn();
if (isStateFinished()) {
setState(sSTATE_IDLEDOWN);
}
}
function SnowBallIdle() {
_global.P.oSnd.playSnowballIdle();
}
function OnJump() {
_global.P.oSnd.playBobOnJump();
}
function StartMidAir() {
_global.P.oSnd.playBobJump();
if (isStateFinished()) {
setState(sSTATE_INMIDAIR);
}
}
function InMidAir() {
_global.P.oSnd.playBobJump();
}
function LandJump() {
_global.P.oSnd.playBobLand();
if (isStateFinished()) {
setState(sSTATE_IDLE);
}
}
function Accel() {
}
function SlowedDown() {
if (isStateFinished()) {
setState(sSTATE_IDLE);
}
}
function SnowBallOnJump() {
_global.P.oSnd.playSnowballIdle();
}
function SnowBallInAir() {
_global.P.oSnd.playSnowballJump();
}
function SnowBallLand() {
_global.P.oSnd.playSnowballLand();
if (isStateFinished()) {
setState(sSTATE_SNOWBALLIDLE);
}
}
function SnowBallHurt() {
_global.P.oSnd.playSnowballIdle();
if (isStateFinished()) {
setState(sSTATE_SNOWBALLIDLE);
}
}
function get NbCharacters() {
return(nNbOfChar);
}
function get IsSnowBall() {
return(bIsSnowBall);
}
var DISTANCE_X1 = 17;
var DISTANCE_X2 = 17;
var DISTANCE_Y1 = 4;
var DISTANCE_Y2 = 6;
var sTRAIL_CHAR_LINKAGE = "CharactersCtn";
var nSNOWBALL_DISTANCE_X_MOD = -3;
var nSNOWBALL_DISTANCE_Y_MOD = 6;
var sSTATE_SNOWBALLIDLE = "SnowBallIdle";
var sSTATE_SNOWBALLONJUMP = "SnowBallOnJump";
var sSTATE_SNOWBALLAIR = "SnowBallInAir";
var sSTATE_SNOWBALLLAND = "SnowBallLand";
var sSTATE_SNOWBALLHURT = "SnowBallHurt";
var sSTATE_EEGG_IDLE = "without";
var sSTATE_EEGG_SHOW = "with";
}
Symbol 1100 MovieClip [__Packages.Game.Obstacles.Obstacle] Frame 0
class Game.Obstacles.Obstacle extends Game.State
{
var mcRef, oPlayer, nGridColumn, nGridRow, oOwner, bIsInRange, setState, sName, nDistanceX2, nDistanceX1, nDistanceY2, nDistanceY1, onCollision;
function Obstacle (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner) {
super(_mcRef, _sName);
mcRef = _mcRef;
oPlayer = _oPlayer;
nGridColumn = _nGridColumn;
nGridRow = _nGridRow;
oOwner = _oOwner;
bIsInRange = false;
setState("Idle");
}
function deleteMe() {
_global.C.oActionBroadcast.removeListener(this);
delete oOwner[sName];
}
function hitDetection() {
var _local2 = true;
var _local6;
var _local5;
var _local3;
var _local4;
if (oPlayer.mcRef._x >= mcRef._x) {
_local6 = mcRef._x;
_local5 = nDistanceX2;
_local3 = oPlayer.mcRef._x;
_local4 = oPlayer.getDistances().x1;
} else {
_local6 = oPlayer.mcRef._x;
_local5 = oPlayer.getDistances().x2;
_local3 = mcRef._x;
_local4 = nDistanceX1;
}
if (isSidesCollide(_local6, _local5, _local3, _local4)) {
if (((oPlayer.mcRef._y - oPlayer.getDistances().y1) > (mcRef._y + nDistanceY2)) || ((oPlayer.mcRef._y + oPlayer.getDistances().y2) < (mcRef._y - nDistanceY1))) {
_local2 = false;
}
} else {
_local2 = false;
}
return(_local2);
}
function isSidesCollide(_nPoint1, _nDistance1, _nPoint2, _nDistance2) {
var _local1 = false;
if (((_nPoint1 + _nDistance1) > (_nPoint2 - _nDistance2)) && (_nPoint1 < _nPoint2)) {
_local1 = true;
}
return(_local1);
}
function updateIsInRange(_oCharacter, _nPosY1, _nPosY2) {
var _local4 = false;
var _local2 = false;
if ((_oCharacter.mcRef._x + _oCharacter.getDistances().x2) >= (mcRef._x - nDistanceX1)) {
if ((_oCharacter.mcRef._x - _oCharacter.getDistances().x1) <= (mcRef._x + nDistanceX2)) {
_local4 = true;
}
}
if (_nPosY1 < _nPosY2) {
if (((mcRef._y - nDistanceY1) >= _nPosY1) && ((mcRef._y - nDistanceY1) < _nPosY2)) {
_local2 = true;
}
} else if (_nPosY1 > _nPosY2) {
if (((mcRef._y + nDistanceY2) <= _nPosY1) && ((mcRef._y + nDistanceY2) > _nPosY2)) {
_local2 = true;
}
}
if (_local4 && (_local2)) {
bIsInRange = true;
} else {
bIsInRange = false;
}
}
function moveObstacle() {
var _local2 = {x:mcRef._x, y:mcRef._y};
mcRef._parent.localToGlobal(_local2);
if (_local2.x <= Config.STAGE_WIDTH) {
mcRef._x = mcRef._x + nSPEED_X;
}
}
function Idle() {
moveObstacle();
if (hitDetection()) {
onCollision();
}
}
var nSPEED_X = 1;
}
Symbol 1101 MovieClip [__Packages.Game.ObjectsManager] Frame 0
class Game.ObjectsManager
{
var mcRef, oPlayer, oOwner, bPausable, aElements, nObjectIndex, nDistanceMoved, nCharNo, bLaserOnScreen, aReservedRows, nGridsBeforeChar;
function ObjectsManager (_mcRef, _oPlayer, _oOwner) {
mcRef = _mcRef;
oPlayer = _oPlayer;
oOwner = _oOwner;
bPausable = true;
aElements = new Array();
nObjectIndex = 0;
nDistanceMoved = 0;
nCharNo = 0;
bLaserOnScreen = false;
aReservedRows = new Array();
nGridsBeforeChar = Config.getLevel().nCharacterAppearanceDelay;
addElement(_oPlayer);
_global.C.oActionBroadcast.addListener(this);
}
function doAction() {
if ((!bPausable) || (!_global.C.bPause)) {
moveContainer();
showElements();
hideElements();
if (!oOwner.oPlayer.isInJumpState()) {
sortDepths();
}
}
}
function getObjectsInRange() {
var _local3 = new Array();
var _local2 = 0;
while (_local2 < aElements.length) {
if (aElements[_local2].bIsInRange) {
_local3.push(aElements[_local2]);
}
_local2++;
}
return(_local3);
}
function removeItem(_oObject) {
for (var _local2 in aElements) {
if (aElements[_local2] == _oObject) {
removeElement(_local2);
}
}
}
function clearRow(_nGridRow) {
var _local2 = 0;
while (_local2 < aReservedRows.length) {
if (aReservedRows[_local2] == _nGridRow) {
aReservedRows.splice(_local2, 1);
}
_local2++;
}
}
function deleteMe() {
_global.C.oActionBroadcast.removeListener(this);
for (var _local3 in aElements) {
aElements[_local3].deleteMe();
}
}
function createObstacle(_mcRef, _sType, _nGridColumn, _nGridRow) {
var _local2 = ("o" + _sType) + nObjectIndex;
switch (_sType) {
case sROCK_NAME :
this[_local2] = new Game.Obstacles.Rock(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
break;
case sTREE_NAME :
this[_local2] = new Game.Obstacles.Tree(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
break;
case sJUMP_NAME :
this[_local2] = new Game.Obstacles.Jump(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
break;
case sCORAL_NAME :
this[_local2] = new Game.Obstacles.Coral(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
break;
case sSHELL_NAME :
this[_local2] = new Game.Obstacles.Shell(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
break;
case sSNOWMAN_NAME :
this[_local2] = new Game.Obstacles.SnowMan(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
break;
case sSNOWBANK_NAME :
this[_local2] = new Game.Obstacles.SnowBank(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
break;
case sLASER_NAME :
this[_local2] = new Game.Obstacles.Laser(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
break;
case "Character" :
reserveRow(_nGridRow);
this[_local2] = new Game.Obstacles.Character(_mcRef, oPlayer, _nGridColumn, _nGridRow, nCharNo + 1, _local2, nObjectIndex + nDEPTH_START, this);
break;
case sPOWERUP_NAME :
reserveRow(_nGridRow);
this[_local2] = new Game.Obstacles.PowerUp(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
break;
case sANCHOVY_NAME :
reserveRow(_nGridRow);
this[_local2] = new Game.Obstacles.Anchovy(_mcRef, oPlayer, _nGridColumn, _nGridRow, _local2, _sType, nObjectIndex + nDEPTH_START, this);
}
addElement(this[_local2]);
nObjectIndex++;
}
function addElement(_oRef) {
aElements.push(_oRef);
}
function reserveRow(_nGridRow) {
aReservedRows.push(_nGridRow);
}
function moveContainer() {
var _local2 = mcRef._x;
_local2 = _local2 - oPlayer.nHorizSpeed;
nDistanceMoved = nDistanceMoved + oPlayer.nHorizSpeed;
mcRef._x = _local2;
}
function showElements() {
if (nDistanceMoved >= (Config.getLevel().nNB_COLUMNS * Config.getLevel().nELEMENTS_DISTANCE_X)) {
nDistanceMoved = 0;
var _local4 = false;
var _local3 = new Array();
_local3 = initGrid(Config.getLevel().nNB_COLUMNS, Config.getLevel().nNB_ROWS);
if ((nGridsBeforeChar < 0) && (nCharNo < Config.getLevel().nMAX_CHAR_PER_ROUND)) {
if (!oPlayer.__get__IsSnowBall()) {
_local4 = addObstacle(_local3, "Character");
} else {
_local4 = addObstacle(_local3, "SnowMan");
}
if (_local4) {
nCharNo++;
nGridsBeforeChar = Config.getLevel().nCharacterAppearanceDelay;
}
}
var _local2 = 0;
while (_local2 < Config.getLevel().aPriority.length) {
if (Config.getLevel().aPriority[_local2] == sLASER_NAME) {
if (!bLaserOnScreen) {
_local4 = addObstacle(_local3, Config.getLevel().aPriority[_local2]);
if (_local4) {
bLaserOnScreen = true;
}
}
} else {
addObstacle(_local3, Config.getLevel().aPriority[_local2]);
}
_local2++;
}
nGridsBeforeChar--;
}
}
function addObstacle(_aGrid, _sType) {
var _local13 = false;
var _local5 = 0;
while (_local5 < Config.getLevel()[("a" + _sType) + "Percent"].length) {
var _local8 = Math.floor(Math.random() * 100);
if (_local8 <= Config.getLevel()[("a" + _sType) + "Percent"][_local5]) {
var _local3 = findEmptyPos(_aGrid, Config.getObsGrid()[("n" + _sType) + "Height"], Config.getObsGrid()[("n" + _sType) + "Width"]);
if (_local3 != undefined) {
if (_sType == "Character") {
var _local4 = aCHAR_INSTANCES[nCharNo];
} else {
var _local4 = this[("s" + _sType.toUpperCase()) + "_NAME"];
var _local10 = Math.floor((Math.random() * Config.getObsGrid()[("n" + _sType) + "NbInstances"]) + 1);
_local4 = _local4 + _local10;
}
var _local7 = ((_local3.y * Config.getLevel().nELEMENTS_DISTANCE_X) + oPlayer.mcRef._x) + Config.getObsGrid().nBUFFER_IN;
var _local6 = (_local3.x * Config.getLevel().nELEMENTS_DISTANCE_Y) + Config.getLevel().nSTART_Y;
var _local9 = mcRef.attachMovie(_local4, _local4 + nObjectIndex, nDEPTH_START + nObjectIndex, {_x:_local7, _y:_local6});
_local13 = true;
createObstacle(_local9, _sType, _local3.y, _local3.x);
} else {
_local5 = Config.getLevel()[("a" + _sType) + "Percent"].length;
}
}
_local5++;
}
return(_local13);
}
function findEmptyPos(_aGrid, _nRows, _nColumns) {
var _local10;
var _local3 = 0;
var _local2 = 0;
var _local8 = new Array();
while (((_local3 + _nRows) - 1) <= (Config.getLevel().nNB_ROWS - 1)) {
_local2 = 0;
while (((_local2 + _nColumns) - 1) <= (Config.getLevel().nNB_COLUMNS - 1)) {
if (isSlotEmpty(_aGrid, _local3, _local2, _nRows, _nColumns)) {
_local8.push({x:(_local3 + _nRows) - 1, y:_local2});
}
_local2++;
}
_local3++;
}
if (_local8.length > 0) {
var _local11 = Math.floor(Math.random() * _local8.length);
_local10 = _local8[_local11];
setSlotOccupied(_aGrid, (_local10.x - _nRows) + 1, _local10.y, _nColumns, _nRows);
}
return(_local10);
}
function isSlotEmpty(_aGrid, _nRow, _nCol, _nRows, _nColumns) {
var _local4 = true;
var _local2 = _nRow;
while (_local2 <= ((_nRow + _nRows) - 1)) {
var _local1 = _nCol;
while (_local1 <= ((_nCol + _nColumns) - 1)) {
if (_aGrid[_local2][_local1] != 0) {
_local4 = false;
break;
}
_local1++;
}
if (!_local4) {
break;
}
_local2++;
}
return(_local4);
}
function setSlotOccupied(_aGrid, _nRow, _nCol, _nColumns, _nRows) {
var _local2 = _nRow;
while (_local2 <= ((_nRow + _nRows) - 1)) {
var _local1 = _nCol;
while (_local1 <= ((_nCol + _nColumns) - 1)) {
_aGrid[_local2][_local1] = 1;
_local1++;
}
_local2++;
}
}
function initGrid(_nWidth, _nHeight) {
var _local7 = new Array();
var _local5 = 0;
var _local3 = 0;
while (_local3 < _nHeight) {
var _local4 = new Array();
if (aReservedRows.indexOf(_local3) != -1) {
_local5 = 1;
} else {
_local5 = 0;
}
var _local2 = 0;
while (_local2 < _nWidth) {
_local4.push(_local5);
_local2++;
}
_local7.push(_local4);
_local3++;
}
return(_local7);
}
function removeElement(_nElementNo) {
if ((aElements[_nElementNo].sLinkageName.indexOf("Character") != -1) || (aElements[_nElementNo].sLinkageName.indexOf(sSNOWMAN_NAME) != -1)) {
if (nCharNo >= Config.getLevel().nCHAR_FOR_LEVEL) {
_global.P.upgradeLevel();
}
}
aElements[_nElementNo].mcRef.swapDepths(10);
aElements[_nElementNo].mcRef.removeMovieClip();
aElements[_nElementNo].deleteMe();
aElements.splice(_nElementNo, 1);
}
function hideElements() {
var _local2 = oPlayer.mcRef._x;
for (var _local3 in aElements) {
if ((_local2 - (aElements[_local3].mcRef._x + aElements[_local3].mcRef._width)) >= Config.getObsGrid().nBUFFER_OUT) {
removeElement(_local3);
}
}
}
function sortDepths() {
var _local2 = new Array();
for (var _local3 in aElements) {
if ((aElements[_local3].mcRef._x <= (oPlayer.mcRef._x + Config.getObsGrid().nBUFFER_IN)) && (aElements[_local3].mcRef._x >= (oPlayer.mcRef._x - Config.getObsGrid().nBUFFER_OUT))) {
_local2.push(aElements[_local3].mcRef);
}
}
_local2.push(oPlayer.mcRef);
for (var _local3 in oPlayer.aFollowingCharacters) {
_local2.push(oPlayer.aFollowingCharacters[_local3].mcRef);
}
_local2.sort(sortOnDepths);
}
function sortOnDepths(_mcRef1, _mcRef2) {
var _local3 = 0;
if (_mcRef1._y > _mcRef2._y) {
if (_mcRef1.getDepth() < _mcRef2.getDepth()) {
_mcRef1.swapDepths(_mcRef2);
}
_local3 = -1;
} else if (_mcRef1._y < _mcRef2._y) {
if (_mcRef1.getDepth() > _mcRef2.getDepth()) {
_mcRef1.swapDepths(_mcRef2);
}
_local3 = 1;
} else if (_mcRef1._x > _mcRef2._x) {
if (_mcRef1.getDepth() < _mcRef2.getDepth()) {
_mcRef1.swapDepths(_mcRef2);
}
_local3 = -1;
} else {
if (_mcRef1.getDepth() > _mcRef2.getDepth()) {
_mcRef1.swapDepths(_mcRef2);
}
_local3 = 1;
}
return(_local3);
}
var sROCK_NAME = "Rock";
var sTREE_NAME = "Tree";
var sJUMP_NAME = "Jump";
var sCORAL_NAME = "Coral";
var sSHELL_NAME = "Shell";
var sSNOWMAN_NAME = "SnowMan";
var sSNOWBANK_NAME = "SnowBank";
var sLASER_NAME = "Laser";
var sPOWERUP_NAME = "PowerUp";
var sANCHOVY_NAME = "Anchovy";
var aCHAR_INSTANCES = ["Character1", "Character2", "Character3", "Character4", "Character5", "Character6", "Character7"];
var nDEPTH_START = 100;
}
Symbol 1102 MovieClip [__Packages.Game.Obstacles.Rock] Frame 0
class Game.Obstacles.Rock extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, sState, setState, oPlayer, hitDetection;
function Rock (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!(sState === "Idle")) {
} else {
setState("Disperse");
}
if (!oPlayer.IsSnowBall) {
oPlayer.slowDown(this, sOBSTACLE_TYPE);
} else {
oPlayer.reduceBall(this, Config.getPlayer().nROCK_SCALE_MODIF, sOBSTACLE_TYPE);
oPlayer.easeUpByObstacle();
}
}
function Idle() {
if (hitDetection()) {
onCollision();
}
}
var DISTANCE_X1 = 22;
var DISTANCE_X2 = 15;
var DISTANCE_Y1 = 10;
var DISTANCE_Y2 = 0;
var sOBSTACLE_TYPE = "Rock";
}
Symbol 1103 MovieClip [__Packages.Game.Obstacles.Tree] Frame 0
class Game.Obstacles.Tree extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, sState, setState, oPlayer, hitDetection;
function Tree (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!(sState === "Idle")) {
} else {
setState("Disperse");
}
if (!oPlayer.IsSnowBall) {
oPlayer.slowDown(this, sOBSTACLE_TYPE);
} else {
oPlayer.reduceBall(this, Config.getPlayer().nTREE_SCALE_MODIF, sOBSTACLE_TYPE);
oPlayer.easeUpByObstacle();
}
}
function Idle() {
if (hitDetection()) {
onCollision();
}
}
var DISTANCE_X1 = 4;
var DISTANCE_X2 = 4;
var DISTANCE_Y1 = 5;
var DISTANCE_Y2 = 0;
var sOBSTACLE_TYPE = "Tree";
}
Symbol 1104 MovieClip [__Packages.Game.Obstacles.Jump] Frame 0
class Game.Obstacles.Jump extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, sState, setState, oPlayer, mcRef, isSidesCollide;
function Jump (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!(sState === "Idle")) {
} else {
setState("Disperse");
}
oPlayer.startJump(mcRef);
}
function hitDetection() {
var _local2 = true;
var _local6;
var _local5;
var _local3;
var _local4;
if (oPlayer.mcRef._x <= mcRef._x) {
_local6 = oPlayer.mcRef._x;
_local5 = oPlayer.DISTANCE_X2;
_local3 = mcRef._x;
_local4 = nDistanceX1;
if (isSidesCollide(_local6, _local5, _local3, _local4)) {
if (((oPlayer.mcRef._y - oPlayer.getDistances().y1) > (mcRef._y + nDistanceY2)) || ((oPlayer.mcRef._y + oPlayer.getDistances().y2) < (mcRef._y - nDistanceY1))) {
_local2 = false;
}
if (_local2) {
if (oPlayer.mcRef._y < mcRef._y) {
var _local7 = Math.sqrt(((oPlayer.mcRef._x - mcRef._x) * (oPlayer.mcRef._x - mcRef._x)) + ((oPlayer.mcRef._y - mcRef._y) * (oPlayer.mcRef._y - mcRef._y)));
if (_local7 > nMIN_DISTANCE) {
_local2 = false;
}
}
}
} else {
_local2 = false;
}
} else {
_local2 = false;
}
return(_local2);
}
function Idle() {
if (hitDetection()) {
onCollision();
}
}
var DISTANCE_X1 = 31;
var DISTANCE_X2 = 26;
var DISTANCE_Y1 = 10;
var DISTANCE_Y2 = 9;
var nMIN_DISTANCE = 38;
}
Symbol 1105 MovieClip [__Packages.Game.Obstacles.Coral] Frame 0
class Game.Obstacles.Coral extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, sState, setState, oPlayer, hitDetection;
function Coral (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!(sState === "Idle")) {
} else {
setState("Disperse");
}
if (!oPlayer.IsSnowBall) {
oPlayer.slowDown(this, sOBSTACLE_TYPE);
} else {
oPlayer.reduceBall(this, Config.getPlayer().nCORAL_SCALE_MODIF, sOBSTACLE_TYPE);
oPlayer.easeUpByObstacle();
}
}
function Idle() {
if (hitDetection()) {
onCollision();
}
}
var DISTANCE_X1 = 22;
var DISTANCE_X2 = 15;
var DISTANCE_Y1 = 10;
var DISTANCE_Y2 = 0;
var sOBSTACLE_TYPE = "Coral";
}
Symbol 1106 MovieClip [__Packages.Game.Obstacles.Shell] Frame 0
class Game.Obstacles.Shell extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, sState, setState, oPlayer, hitDetection;
function Shell (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!(sState === "Idle")) {
} else {
setState("Disperse");
}
if (!oPlayer.IsSnowBall) {
oPlayer.slowDown(this, sOBSTACLE_TYPE);
} else {
oPlayer.reduceBall(this, Config.getPlayer().nSHELL_SCALE_MODIF, sOBSTACLE_TYPE);
oPlayer.easeUpByObstacle();
}
}
function Idle() {
if (hitDetection()) {
onCollision();
}
}
var DISTANCE_X1 = 12;
var DISTANCE_X2 = 15;
var DISTANCE_Y1 = 6;
var DISTANCE_Y2 = 3;
var sOBSTACLE_TYPE = "Shell";
}
Symbol 1107 MovieClip [__Packages.Game.Obstacles.SnowMan] Frame 0
class Game.Obstacles.SnowMan extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, oPlayer, sState, setState, hitDetection, isStateFinished, deleteMe;
function SnowMan (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!oPlayer.isInJumpState()) {
_global.P.oSnd.playHitSnowMan();
if (!(sState === "Idle")) {
} else {
setState("Disperse");
}
oPlayer.growBall(this, Config.getPlayer().nSNOWMAN_SCALE_MODIF);
_global.C.oScoresManager.addScore(Config.score().nPtsSnowMan);
}
}
function updateIsInRange(_nPosY1, _nPosY2) {
bIsInRange = false;
}
function Idle() {
if (hitDetection()) {
onCollision();
}
}
function Disperse() {
if (isStateFinished()) {
_global.C.oObjectsManager.removeItem(this);
deleteMe();
}
}
var DISTANCE_X1 = 19;
var DISTANCE_X2 = 18;
var DISTANCE_Y1 = 10;
var DISTANCE_Y2 = 4;
}
Symbol 1108 MovieClip [__Packages.Game.Obstacles.SnowBank] Frame 0
class Game.Obstacles.SnowBank extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, oPlayer, sState, setState, hitDetection, isStateFinished, deleteMe;
function SnowBank (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!oPlayer.isInJumpState()) {
_global.P.oSnd.playHitSnowBank();
if (!(sState === "Idle")) {
} else {
setState("Disperse");
}
oPlayer.growBall(this, Config.getPlayer().nSNOWBANK_SCALE_MODIF);
_global.C.oScoresManager.addScore(Config.score().nPtsSnowBank);
}
}
function updateIsInRange(_nPosY1, _nPosY2) {
bIsInRange = false;
}
function Idle() {
if (hitDetection()) {
onCollision();
}
}
function Disperse() {
if (isStateFinished()) {
_global.C.oObjectsManager.removeItem(this);
deleteMe();
}
}
var DISTANCE_X1 = 25;
var DISTANCE_X2 = 21;
var DISTANCE_Y1 = 18;
var DISTANCE_Y2 = 4;
}
Symbol 1109 MovieClip [__Packages.Game.Obstacles.Laser] Frame 0
class Game.Obstacles.Laser extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, setState, oPlayer, mcRef, isStateFinished, hitDetection, deleteMe;
function Laser (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
_global.P.oSnd.stopHeatRay();
setState(sSTATE_PREHEAT);
}
function onCollision() {
oPlayer.reduceBall(this, Config.getPlayer().nLASER_SCALE_MODIF, sOBSTACLE_TYPE);
oPlayer.easeUpByObstacle();
}
function updateIsInRange(_nPosY1, _nPosY2) {
bIsInRange = false;
}
function moveLaser() {
mcRef._x = mcRef._x + oPlayer.nHorizSpeed;
}
function PreHeat() {
moveLaser();
_global.P.oSnd.playHeatRayAppears();
if (isStateFinished()) {
_global.P.oSnd.playHeatRayHurt();
setState(sSTATE_HURT);
}
}
function Hurt() {
moveLaser();
if (hitDetection()) {
onCollision();
}
if (isStateFinished()) {
_global.C.oObjectsManager.removeItem(this);
_global.C.oObjectsManager.bLaserOnScreen = false;
deleteMe();
}
}
var DISTANCE_X1 = 1235.8;
var DISTANCE_X2 = 0;
var DISTANCE_Y1 = 15;
var DISTANCE_Y2 = 15;
var sOBSTACLE_TYPE = "Laser";
var sSTATE_PREHEAT = "PreHeat";
var sSTATE_HURT = "Hurt";
}
Symbol 1110 MovieClip [__Packages.Game.Obstacles.Character] Frame 0
class Game.Obstacles.Character extends Game.Obstacles.Obstacle
{
var nCharNo, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, oPlayer, sState, setState, mcRef, nGridRow, sName, oOwner, moveObstacle, hitDetection, isStateFinished;
function Character (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _nCharNo, _sName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
nCharNo = _nCharNo;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!oPlayer.isInJumpState()) {
_global.P.oSnd.playGrabCharacter();
if (!(sState === "Idle")) {
} else {
setState("Disperse");
}
var _local4 = mcRef._x;
var _local3 = mcRef._y;
oPlayer.incrementNbOfChar();
_global.C.oObjectsManager.removeItem(this);
_global.C.oObjectsManager.clearRow(nGridRow);
oPlayer.addCharacter(nCharNo, _local4, _local3);
_global.C.oScoresManager.addScore(Config.score().nPtsCharacter);
}
}
function updateIsInRange(_nPosY1, _nPosY2) {
bIsInRange = false;
}
function deleteMe() {
_global.C.oObjectsManager.clearRow(nGridRow);
_global.C.oActionBroadcast.removeListener(this);
delete oOwner[sName];
}
function Idle() {
moveObstacle();
if (hitDetection()) {
onCollision();
}
}
function Disperse() {
if (hitDetection()) {
onCollision();
}
if (isStateFinished()) {
setState("IdleDispersed");
}
}
function IdleDispersed() {
if (hitDetection()) {
onCollision();
}
}
var DISTANCE_X1 = 24;
var DISTANCE_X2 = 25;
var DISTANCE_Y1 = 20;
var DISTANCE_Y2 = 20;
}
Symbol 1111 MovieClip [__Packages.Game.Obstacles.PowerUp] Frame 0
class Game.Obstacles.PowerUp extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, oPlayer, nGridRow, sName, oOwner, moveObstacle, hitDetection;
function PowerUp (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!oPlayer.isInJumpState()) {
_global.P.oSnd.playGrabGary();
_global.C.oObjectsManager.removeItem(this);
_global.C.oObjectsManager.clearRow(nGridRow);
oPlayer.easeUpMovement();
_global.C.oScoresManager.addScore(Config.score().nPtsPowerUp);
}
}
function updateIsInRange(_nPosY1, _nPosY2) {
bIsInRange = false;
}
function deleteMe() {
_global.C.oObjectsManager.clearRow(nGridRow);
_global.C.oActionBroadcast.removeListener(this);
delete oOwner[sName];
}
function Idle() {
moveObstacle();
_global.P.oSnd.playGaryIdle();
if (hitDetection()) {
onCollision();
}
}
var DISTANCE_X1 = 12;
var DISTANCE_X2 = 13;
var DISTANCE_Y1 = 10;
var DISTANCE_Y2 = 10;
}
Symbol 1112 MovieClip [__Packages.Game.Obstacles.Anchovy] Frame 0
class Game.Obstacles.Anchovy extends Game.Obstacles.Obstacle
{
var sLinkageName, nDistanceX1, nDistanceX2, nDistanceY1, nDistanceY2, nPosX, nPosY, bIsAttached, bIsInRange, nIndex, oPlayer, nGridRow, sName, oOwner, moveObstacle, hitDetection;
function Anchovy (_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _sLinkageName, _nIndex, _oOwner) {
super(_mcRef, _oPlayer, _nGridColumn, _nGridRow, _sName, _oOwner);
sLinkageName = _sLinkageName;
nDistanceX1 = DISTANCE_X1;
nDistanceX2 = DISTANCE_X2;
nDistanceY1 = DISTANCE_Y1;
nDistanceY2 = DISTANCE_Y2;
nPosX = _mcRef._x;
nPosY = _mcRef._y;
bIsAttached = false;
bIsInRange = false;
nIndex = _nIndex;
}
function onCollision() {
if (!oPlayer.isInJumpState()) {
_global.P.oSnd.playGrabAnchovy();
_global.C.oObjectsManager.removeItem(this);
_global.C.oObjectsManager.clearRow(nGridRow);
_global.C.oScoresManager.addScore(Config.score().nPtsAnchovy);
}
}
function updateIsInRange(_nPosY1, _nPosY2) {
bIsInRange = false;
}
function deleteMe() {
_global.C.oObjectsManager.clearRow(nGridRow);
_global.C.oActionBroadcast.removeListener(this);
delete oOwner[sName];
}
function Idle() {
moveObstacle();
if (hitDetection()) {
onCollision();
}
}
var DISTANCE_X1 = 8;
var DISTANCE_X2 = 8;
var DISTANCE_Y1 = 17;
var DISTANCE_Y2 = 3;
}
Symbol 1113 MovieClip [__Packages.Game.LifeMinus] Frame 0
class Game.LifeMinus extends Game.State
{
var oOwner, setState, mcRef, isStateFinished;
function LifeMinus (_mcRef, _sName, _oOwner) {
super(_mcRef, _sName);
oOwner = _oOwner;
setState(sSTATE_IDLE);
}
function showLife() {
mcRef._y = oOwner.mcRef._y;
setState(sSTATE_SHOWING);
}
function Idle() {
}
function Showing() {
if (isStateFinished()) {
setState(sSTATE_IDLE);
}
}
var sSTATE_IDLE = "Idle";
var sSTATE_SHOWING = "Showing";
}
Symbol 1114 MovieClip [__Packages.Game.TrailCharacter] Frame 0
class Game.TrailCharacter extends Game.DynamicCharacter
{
var oTarget, oOwner, sSTATE_IDLE, bPausable, sState, isInJumpState, bPrepareJump, checkLimits, applyVerticalSpeed, sSTATE_ONJUMP, getState, ascendOnJump, sSTATE_STARTMIDAIR, sSTATE_INMIDAIR, verticalGravity, checkBottomLimit, applyPosY, movePlayer, mcRef, nNbFrAnim, onStateEnd, nStartJumpingX, nStartJumpingY, mcJump, startJump, nVerticalSpeed, nHorizSpeed;
function TrailCharacter (_mcRef, _oTarget, _sName, _oOwner) {
super(_mcRef, _mcRef.mcCharacter, _sName, _oOwner);
oTarget = _oTarget;
oOwner = _oOwner;
setState(sSTATE_IDLE);
initVars();
_mcRef.swapDepths(1);
}
function doAction() {
if ((!bPausable) || (!_global.C.bPause)) {
this[sState]();
if (!isInJumpState()) {
updateSpeeds();
if (!bPrepareJump) {
checkLimits();
} else {
checkJumpStart();
applyVerticalSpeed();
}
} else {
applyVerticalSpeed();
switch (getState()) {
case sSTATE_ONJUMP :
ascendOnJump();
break;
case sSTATE_STARTMIDAIR :
case sSTATE_INMIDAIR :
verticalGravity();
checkBottomLimit();
}
}
applyPosY();
movePlayer();
}
}
function doPause() {
mcRef.mcCharacter.mcState.stop();
}
function doUnpause() {
mcRef.mcCharacter.mcState.play();
}
function setState(_sState) {
if (sState != _sState) {
sState = _sState;
mcRef.mcCharacter.gotoAndStop(sState);
nNbFrAnim = mcRef.mcCharacter.mcState._totalframes;
delete onStateEnd;
}
}
function isStateFinished() {
var _local2 = false;
if (mcRef.mcCharacter.mcState._currentframe == nNbFrAnim) {
_local2 = true;
}
return(_local2);
}
function initVars() {
super.initVars();
bPrepareJump = false;
nStartJumpingX = 0;
}
function setJumping(_nPosX, _nPosY, _mcJump) {
bPrepareJump = true;
nStartJumpingX = _nPosX;
nStartJumpingY = _nPosY;
mcJump = _mcJump;
}
function setTarget(_oTarget) {
oTarget = _oTarget;
}
function checkJumpStart() {
if (mcRef._x >= nStartJumpingX) {
bPrepareJump = false;
startJump(mcJump);
}
}
function updateSpeeds() {
var _local2 = (oTarget.mcRef._x - mcRef._x) - nMIN_DIST_FROM_TARGET;
if (bPrepareJump) {
var _local3 = nStartJumpingY - mcRef._y;
} else {
var _local3 = oTarget.mcRef._y - mcRef._y;
}
nVerticalSpeed = nSPEED_FACTOR * _local3;
nHorizSpeed = nSPEED_FACTOR * _local2;
if (_local2 < 0) {
if (nHorizSpeed < nMAX_HORIZ_APPROACH_SPEED) {
nHorizSpeed = nMAX_HORIZ_APPROACH_SPEED;
}
}
if (Math.abs(nVerticalSpeed - _local3) <= nMIN_DIST_TO_STOP_MOVING) {
nVerticalSpeed = _local3;
}
if (Math.abs(nHorizSpeed - _local2) <= nMIN_DIST_TO_STOP_MOVING) {
nHorizSpeed = _local2;
}
}
var nMIN_DIST_TO_STOP_MOVING = 2;
var nSPEED_FACTOR = 0.35;
var nMAX_HORIZ_APPROACH_SPEED = -4;
static var nMIN_DIST_FROM_TARGET = 20;
static var sCHAR_LABEL = "Character";
}
Symbol 1115 MovieClip [__Packages.Game.Avalanche] Frame 0
class Game.Avalanche extends Game.State
{
var oOwner, aCharInSnow, sState, mcRef, nNbFrAnim, onStateEnd, isStateFinished;
function Avalanche (_mcRef, _sName, _oOwner) {
super(_mcRef, _sName);
oOwner = _oOwner;
setState(sSTATE_IDLE);
}
function startAvalanche() {
_global.P.oSnd.playStartAvalanche();
setState(sSTATE_STARTSCENE);
}
function coverAll(_aCharInSnow) {
aCharInSnow = _aCharInSnow;
_global.P.oSnd.playCoverAvalanche();
setState(sSTATE_COVER);
}
function setState(_sState) {
if (sState != _sState) {
sState = _sState;
mcRef.gotoAndStop(sState);
nNbFrAnim = mcRef.mcState._totalframes;
delete onStateEnd;
showCharInSnow();
}
}
function showCharInSnow() {
var _local2 = 0;
while (_local2 < aCharInSnow.length) {
mcRef.mcState.mcCover["mcCharacter" + aCharInSnow[_local2]].gotoAndStop("Show");
_local2++;
}
}
function Idle() {
}
function StartScene() {
if (isStateFinished()) {
setState(sSTATE_IDLE);
_global.C.manageGameStep();
}
}
function Cover() {
if (isStateFinished()) {
setState(sSTATE_IDLECOVERED);
_global.C.manageGameStep();
}
}
var sSTATE_IDLE = "Idle";
var sSTATE_STARTSCENE = "StartScene";
var sSTATE_COVER = "Cover";
var sSTATE_IDLECOVERED = "IdleCovered";
}
Symbol 1116 MovieClip [__Packages.Game.Backgrounds.BGManager] Frame 0
class Game.Backgrounds.BGManager
{
var mcRef, oPlayer, oOwner, nScrollingSpeed, nNoBG, aBackgrounds, oCurrentBG;
function BGManager (_mcRef, _oPlayer, _sName, _oOwner) {
mcRef = _mcRef;
oPlayer = _oPlayer;
sName = _sName;
oOwner = _oOwner;
nScrollingSpeed = 0;
nNoBG = 0;
aBackgrounds = new Array();
addBackground(0);
_global.C.oActionBroadcast.addListener(this);
}
function doAction() {
if (!bPausable) {
} else if (!_global.C.bPause) {
manageHidedBG();
manageNewBG();
setScrollingSpeed();
}
}
function setScrollingSpeed() {
var _local3 = Math.floor(oPlayer.nHorizSpeed * nSPEED_PERCENTAGE);
var _local2 = 0;
while (_local2 < aBackgrounds.length) {
aBackgrounds[_local2].setScrollingSpeed(_local3);
_local2++;
}
}
function moveBGAfterBump(_nMoveX) {
var _local2 = mcRef._x;
_local2 = _local2 - _nMoveX;
mcRef._x = _local2;
}
function deleteMe() {
}
function addBackground(_nPosX) {
var _local3 = mcRef.attachMovie(sLINKAGE, sLINKAGE + nNoBG, mcRef.getNextHighestDepth(), {_x:_nPosX, _y:0});
var _local2 = new Game.Backgrounds.BG(_local3, sLINKAGE + nNoBG, this);
aBackgrounds.push(_local2);
oCurrentBG = _local2;
nNoBG++;
}
function manageHidedBG() {
for (var _local2 in aBackgrounds) {
if ((aBackgrounds[_local2].mcRef._x + nBG_WIDTH) <= nSCROLL_END) {
aBackgrounds[_local2].mcRef.swapDepths(10);
aBackgrounds[_local2].mcRef.removeMovieClip();
aBackgrounds[_local2].deleteMe();
aBackgrounds.splice(_local2, 1);
}
}
}
function manageNewBG() {
if (oCurrentBG != undefined) {
if ((oCurrentBG.mcRef._x + nBG_WIDTH) <= nSCROLL_START) {
addBackground((oCurrentBG.mcRef._x + nBG_WIDTH) - oCurrentBG.nScrollingSpeed);
}
}
}
var nSCROLL_START = 730;
var nSCROLL_END = -130;
var sLINKAGE = "mcSnowBG";
var nBG_WIDTH = 850;
var nSPEED_PERCENTAGE = 1;
var sName = "";
var bPausable = true;
}
Symbol 1117 MovieClip [__Packages.Game.Backgrounds.BG] Frame 0
class Game.Backgrounds.BG
{
var mcRef, oOwner, nScrollingSpeed;
function BG (_mcRef, _sName, _oOwner) {
mcRef = _mcRef;
sName = _sName;
oOwner = _oOwner;
nScrollingSpeed = 0;
_global.C.oActionBroadcast.addListener(this);
}
function doAction() {
if (!bPausable) {
} else if (!_global.C.bPause) {
moveBG();
}
}
function setScrollingSpeed(_nSpeed) {
nScrollingSpeed = _nSpeed;
}
function moveBGAfterBump(_nMoveX) {
var _local2 = mcRef._x;
_local2 = _local2 - _nMoveX;
mcRef._x = _local2;
}
function deleteMe() {
}
function moveBG() {
var _local2 = mcRef._x;
_local2 = _local2 - nScrollingSpeed;
mcRef._x = _local2;
}
var SCROLL_LIMIT_L = -3150;
var SCROLL_LIMIT_R = 800;
var sName = "";
var bPausable = true;
}
Symbol 1118 MovieClip [__Packages.Game.Backgrounds.SnowBGManager] Frame 0
class Game.Backgrounds.SnowBGManager extends Game.Backgrounds.BGManager
{
function SnowBGManager (_mcRef, _oPlayer, _sName, _oOwner) {
super(_mcRef, _oPlayer, _sName, _oOwner);
}
var nSCROLL_START = 730;
var nSCROLL_END = -130;
var sLINKAGE = "mcSnowBG";
var nBG_WIDTH = 1829;
}
Symbol 1119 MovieClip [__Packages.Game.Backgrounds.PanelFGManager] Frame 0
class Game.Backgrounds.PanelFGManager extends Game.Backgrounds.BGManager
{
function PanelFGManager (_mcRef, _oPlayer, _sName, _oOwner) {
super(_mcRef, _oPlayer, _sName, _oOwner);
}
var nSCROLL_START = 730;
var nSCROLL_END = -130;
var sLINKAGE = "mcPanelBG";
var nBG_WIDTH = 1829;
}
Symbol 1120 MovieClip [__Packages.Game.Backgrounds.SceneryBGManager] Frame 0
class Game.Backgrounds.SceneryBGManager extends Game.Backgrounds.BGManager
{
function SceneryBGManager (_mcRef, _oPlayer, _sName, _oOwner) {
super(_mcRef, _oPlayer, _sName, _oOwner);
}
var nSCROLL_START = 730;
var nSCROLL_END = -130;
var sLINKAGE = "mcSceneryBG";
var nBG_WIDTH = 1270;
var nSPEED_PERCENTAGE = 0.5;
}
Symbol 1121 MovieClip [__Packages.Game.Backgrounds.BGVerticalManager] Frame 0
class Game.Backgrounds.BGVerticalManager
{
var mcRef, oPlayer, oOwner, nScrollingSpeed, nNoBG, aBackgrounds, oCurrentBG;
function BGVerticalManager (_mcRef, _oPlayer, _sName, _oOwner) {
mcRef = _mcRef;
oPlayer = _oPlayer;
sName = _sName;
oOwner = _oOwner;
nScrollingSpeed = 0;
nNoBG = 0;
aBackgrounds = new Array();
addBackground(0);
_global.C.oActionBroadcast.addListener(this);
}
function doAction() {
if (!bPausable) {
} else if (!_global.C.bPause) {
if (bLOOPING) {
manageHidedBG();
manageNewBG();
}
setScrollingSpeed(nSPEED);
}
}
function setScrollingSpeed(_nSpeed) {
var _local2 = 0;
while (_local2 < aBackgrounds.length) {
aBackgrounds[_local2].setScrollingSpeed(_nSpeed);
_local2++;
}
}
function deleteMe() {
}
function addBackground(_nPosX) {
var _local3 = mcRef.attachMovie(sLINKAGE, sLINKAGE + nNoBG, mcRef.getNextHighestDepth(), {_x:0, _y:_nPosX});
var _local2 = new Game.Backgrounds.BGVertical(_local3, bLOOPING, sLINKAGE + nNoBG, this);
aBackgrounds.push(_local2);
oCurrentBG = _local2;
nNoBG++;
}
function manageHidedBG() {
for (var _local2 in aBackgrounds) {
if ((aBackgrounds[_local2].mcRef._y + nBG_HEIGHT) <= nSCROLL_END) {
aBackgrounds[_local2].mcRef.swapDepths(10);
aBackgrounds[_local2].mcRef.removeMovieClip();
aBackgrounds[_local2].deleteMe();
aBackgrounds.splice(_local2, 1);
}
}
}
function manageNewBG() {
if (oCurrentBG != undefined) {
if ((oCurrentBG.mcRef._y + nBG_HEIGHT) <= nSCROLL_START) {
addBackground((oCurrentBG.mcRef._y + nBG_HEIGHT) - oCurrentBG.nScrollingSpeed);
}
}
}
var nSCROLL_START = 0;
var nSCROLL_END = -420;
var sLINKAGE = "mcSkyBG";
var nBG_HEIGHT = 681;
var nSPEED = 1;
var bLOOPING = false;
var sName = "";
var bPausable = true;
}
Symbol 1122 MovieClip [__Packages.Game.Backgrounds.BGVertical] Frame 0
class Game.Backgrounds.BGVertical
{
var mcRef, bLooping, oOwner, nScrollingSpeed, nFrameNo;
function BGVertical (_mcRef, _bLooping, _sName, _oOwner) {
mcRef = _mcRef;
bLooping = _bLooping;
sName = _sName;
oOwner = _oOwner;
nScrollingSpeed = 0;
nFrameNo = 0;
_global.C.oActionBroadcast.addListener(this);
}
function doAction() {
if (!bPausable) {
} else if (!_global.C.bPause) {
moveBG();
}
}
function setScrollingSpeed(_nSpeed) {
nScrollingSpeed = _nSpeed;
}
function deleteMe() {
}
function moveBG() {
var _local2 = mcRef._y;
nFrameNo++;
if (nFrameNo >= nUPDATE_INTERVAL) {
nFrameNo = 0;
_local2 = _local2 - nScrollingSpeed;
if (!bLooping) {
_local2 = Math.max(_local2, SCROLL_LIMIT_UP);
}
mcRef._y = _local2;
}
}
var SCROLL_LIMIT_UP = -420;
var nUPDATE_INTERVAL = 5;
var sName = "";
var bPausable = true;
}
Symbol 1123 MovieClip [__Packages.Game.Backgrounds.SkyManager] Frame 0
class Game.Backgrounds.SkyManager extends Game.Backgrounds.BGVerticalManager
{
function SkyManager (_mcRef, _oPlayer, _sName, _oOwner) {
super(_mcRef, _oPlayer, _sName, _oOwner);
}
var nSCROLL_START = 0;
var nSCROLL_END = -420;
var sLINKAGE = "mcSkyBG";
var nBG_HEIGHT = 681;
var nSPEED = 1;
}
Symbol 1124 MovieClip [__Packages.Game.TimeManager] Frame 0
class Game.TimeManager
{
var oHud, oOwner, nTime;
function TimeManager (_oHud, _sName, _oOwner) {
oHud = _oHud;
sName = _sName;
oOwner = _oOwner;
_global.C.oActionBroadcast.addListener(this);
}
function resetTimer(_nTime) {
nTime = _nTime;
}
function doAction() {
if (!bPausable) {
} else if (!_global.C.bPause) {
updateTime();
}
}
function deleteMe() {
_global.C.oActionBroadcast.removeListener(this);
}
function updateTime() {
nTime--;
var _local3 = Math.floor(nTime / Config.STG_FPS);
oHud.updateTime(formatTime(_local3));
if (nTime <= 0) {
_global.C.manageGameStep();
}
}
function formatTime(_nTime) {
var _local3 = "";
var _local4 = Math.floor(_nTime / nSECONDS_BY_MINUTE);
var _local2 = Math.floor(_nTime - (_local4 * nSECONDS_BY_MINUTE));
if (_local2 < 10) {
var _local5 = "0" + _local2;
} else {
var _local5 = _local2.toString();
}
_local3 = (_local4 + " min ") + _local5;
return(_local3);
}
function get Time() {
return(nTime);
}
var nSECONDS_BY_MINUTE = 60;
var sName = "";
var bPausable = true;
}
Symbol 1125 MovieClip [__Packages.Game.ScoresManager] Frame 0
class Game.ScoresManager
{
var mcRef, sName, oOwner, oHud, nScore;
function ScoresManager (_mcRef, _oHud, _sName, _oOwner) {
mcRef = _mcRef;
sName = _sName;
oOwner = _oOwner;
oHud = _oHud;
initVars();
}
function initVars() {
nScore = _global.P.nScore;
oHud.updateScore(nScore);
}
function addScore(_nScore) {
nScore = nScore + _nScore;
if (nScore < 0) {
nScore = 0;
}
oHud.updateScore(nScore);
}
function addTimeBonus() {
nScore = nScore + Config.score().nPtsTimeFinish;
if (_global.P.nTime > 0) {
var _local3 = Math.floor(_global.P.nTime / Config.STG_FPS);
nScore = nScore + (Config.score().nPtsTimeBonus * _local3);
}
oHud.updateScore(nScore);
}
function saveScore() {
_global.P.nScore = nScore;
}
}
Symbol 1126 MovieClip [__Packages.Game.TrailManager] Frame 0
class Game.TrailManager extends Game.State
{
var sName, oOwner, oPlayer, mcTrail, mcRef, aPoints, nMovement, bPausable;
function TrailManager (_mcRef, _oPlayer, _sName, _oOwner) {
super(_mcRef);
sName = _sName;
oOwner = _oOwner;
oPlayer = _oPlayer;
initVars();
drawLines();
}
function initVars() {
mcTrail = mcRef.createEmptyMovieClip("mcTrail", 0);
aPoints = new Array();
nMovement = 0;
}
function doAction() {
var _local3 = false;
if (!bPausable) {
} else if (!_global.C.bPause) {
nMovement = nMovement + oPlayer.nHorizSpeed;
if (nMovement >= nMIN_MOVEMENT_TO_ADD_LINE) {
nMovement = 0;
if (aPoints.length >= nMAX_POINTS) {
aPoints.shift();
}
if ((!oPlayer.isInJumpState()) && (oPlayer.getState() != oPlayer.sSTATE_SLOWEDDOWN)) {
_local3 = true;
}
addPoint(_local3);
drawLines(oPlayer.getDistances().y1 + oPlayer.getDistances().y2);
}
}
}
function drawLines(_nTrailWidth) {
if (aPoints.length > 1) {
mcTrail.clear();
var _local3 = false;
mcTrail.lineStyle(_nTrailWidth - nLINE_REDUCER, 14150900, 100, true, "normal", "round", "round");
var _local2 = 1;
while (_local2 < aPoints.length) {
if (aPoints[_local2].bDraw && (aPoints[_local2 - 1].bDraw)) {
if (!_local3) {
mcTrail.moveTo(aPoints[_local2 - 1].nPosX, aPoints[_local2 - 1].nPosY);
_local3 = true;
}
} else if (!aPoints[_local2].bDraw) {
_local3 = false;
}
if (aPoints[_local2].bDraw && (aPoints[_local2 - 1].bDraw)) {
mcTrail.lineTo(aPoints[_local2].nPosX, aPoints[_local2].nPosY);
}
_local2++;
}
}
}
function deleteMe() {
_global.C.oActionBroadcast.removeListener(this);
}
function addPoint(_bDraw) {
var _local3 = 0;
var _local2 = 0;
if (oPlayer.__get__IsSnowBall()) {
_local3 = nPLAYER_X_MOD_ROUND2;
_local2 = nPLAYER_Y_MOD_ROUND2;
} else {
_local3 = nPLAYER_X_MOD_ROUND1;
_local2 = nPLAYER_Y_MOD_ROUND1;
}
var _local4 = new Game.LinePoint(oPlayer.mcRef._x + _local3, oPlayer.mcRef._y + _local2, _bDraw, "oLinePoint", this);
aPoints.push(_local4);
}
var nMAX_POINTS = 60;
var nMIN_MOVEMENT_TO_ADD_LINE = 5;
var nLINE_REDUCER = 5;
var nPLAYER_Y_MOD_ROUND1 = 0;
var nPLAYER_Y_MOD_ROUND2 = -4;
var nPLAYER_X_MOD_ROUND1 = 0;
var nPLAYER_X_MOD_ROUND2 = -20;
}
Symbol 1127 MovieClip [__Packages.Game.LinePoint] Frame 0
class Game.LinePoint
{
var nPosX, nPosY, bDraw, sName, oOwner;
function LinePoint (_nPosX, _nPosY, _bDraw, _sName, _oOwner) {
nPosX = _nPosX;
nPosY = _nPosY;
bDraw = _bDraw;
sName = _sName;
oOwner = _oOwner;
}
}
Symbol 26 MovieClip Frame 11
_global.MainRef.gotoAndStop("title");
Symbol 27 MovieClip Frame 1
stop();
Symbol 440 MovieClip Frame 1
stop();
Symbol 445 MovieClip Frame 1
stop();
Symbol 452 MovieClip Frame 1
stop();
Symbol 461 MovieClip Frame 1
stop();
Symbol 475 MovieClip Frame 1
stop();
Symbol 479 MovieClip Frame 1
stop();
Symbol 486 MovieClip Frame 1
stop();
Symbol 487 MovieClip Frame 1
stop();
Symbol 537 MovieClip Frame 1
stop();
Symbol 537 MovieClip Frame 2
gotoAndStop (1);
Symbol 541 MovieClip Frame 1
var initTime = getTimer();
this.onEnterFrame = function () {
fps = 1 / ((getTimer() - initTime) / 1000);
_global.FPS = fps;
initTime = getTimer();
};
Symbol 550 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.oTransit.goTo("Instruct");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 554 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.bSubmitScore = false;
_global.P.bAllowSubmit = false;
_global.P.oTransit.goTo("HighScore");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 557 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.resetParamAndStart();
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 558 MovieClip Frame 1
if (!HighScores.bDisplay) {
btnView._visible = false;
}
Symbol 571 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.muteMusic(true);
gotoAndStop ("Music_Off");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 573 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.muteMusic(false);
gotoAndStop ("Music_On");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 574 MovieClip Frame 1
stop();
Symbol 574 MovieClip Frame 11
stop();
Symbol 576 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.muteSFX(true);
gotoAndStop ("Sound_Off");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 578 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.muteSFX(false);
gotoAndStop ("Sound_On");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 579 MovieClip Frame 1
stop();
Symbol 579 MovieClip Frame 11
stop();
Symbol 585 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.oTransit.goTo("InGameInstructP1");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 588 Button
on (press) {
_global.P.oSnd.playBtnClick();
_global.P.oSnd.playMenuClose();
}
on (release, releaseOutside) {
_global.P.oPopUp.bOpenQuit = true;
_global.P.oPopUp.setClose();
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 591 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.oPopUp.bOpenQuit = false;
_global.P.oPopUp.setClose();
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 594 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.oPopUp.bRestart = true;
_global.P.oPopUp.setClose();
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 597 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.oTransit.goTo("InGameMenu");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 600 Button
on (release, releaseOutside) {
gotoAndStop ("P2");
}
Symbol 605 Button
on (release, releaseOutside) {
gotoAndStop ("InGameInstructP1");
}
Symbol 606 MovieClip Frame 1
stop();
Instance of Symbol 567 MovieClip in Symbol 606 MovieClip Frame 1
/* no clip actions */
Symbol 618 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.oPopUp.bOpenQuit = false;
_global.P.oPopUp.bQuitGame = true;
_global.P.oPopUp.bOpenMenu = false;
_global.P.oPopUp.setClose();
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 623 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.oPopUp.bOpenQuit = false;
_global.P.oPopUp.bQuitGame = false;
_global.P.oPopUp.bOpenMenu = true;
_global.P.oPopUp.setClose();
}
on (release) {
_global.Sfx.PlaySound("BarBounce1", -1, 0);
_global.P.oPopUp.bOpenMenu = true;
_global.P.oPopUp.setClose();
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 636 MovieClip Frame 1
nextFrame();
Symbol 636 MovieClip Frame 10
LockBtnTop.useHandCursor = false;
Symbol 636 MovieClip Frame 30
LockBtnTop.useHandCursor = false;
Symbol 636 MovieClip Frame 40
LockBtnTop.useHandCursor = false;
Symbol 636 MovieClip Frame 60
LockBtnTop.useHandCursor = false;
Symbol 705 MovieClip Frame 1
nextFrame();
Symbol 705 MovieClip Frame 10
LockBtn.useHandCursor = false;
Symbol 705 MovieClip Frame 20
LockBtn.useHandCursor = false;
Symbol 705 MovieClip Frame 30
LockBtn.useHandCursor = false;
Symbol 708 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
gotoAndStop ("P2");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 709 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.oTransit.goTo("Title");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 710 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
gotoAndStop ("P1");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 711 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
gotoAndStop ("P3");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 712 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
gotoAndStop ("P2");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 713 MovieClip Frame 1
stop();
Symbol 743 MovieClip Frame 1
stop();
Symbol 747 MovieClip Frame 1
stop();
Symbol 749 MovieClip Frame 1
stop();
Symbol 750 MovieClip Frame 1
stop();
Symbol 751 MovieClip Frame 1
stop();
Symbol 752 MovieClip Frame 1
stop();
Symbol 755 MovieClip Frame 1
stop();
Symbol 844 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release) {
_global.P.oPopUp.setOpen("Menu", true);
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Instance of Symbol 567 MovieClip in Symbol 875 MovieClip Frame 1
/* no clip actions */
Symbol 880 MovieClip Frame 1
_global.P.showHideFriends();
Instance of Symbol 543 MovieClip "Controller" in Symbol 881 MovieClip Frame 1
onClipEvent (load) {
_global.C = new GameController(this);
_global.C.initController();
}
Symbol 919 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
stop();
var _oSound = new Sound();
_oSound.stop();
_global.P.oTransit.goTo("Game");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 939 MovieClip Frame 206
stop();
var _oSound = new Sound();
_oSound.stop();
_global.P.oTransit.goTo("Game");
Symbol 1022 MovieClip Frame 191
stop();
var _oSound = new Sound();
_oSound.stop();
_global.P.oTransit.goTo("Game");
Symbol 1028 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
stop();
var _oSound = new Sound();
_oSound.stop();
_global.P.oTransit.goTo("WinScr");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 1042 MovieClip Frame 120
stop();
var _oSound = new Sound();
_oSound.stop();
_global.P.oTransit.goTo("WinScr");
Symbol 1047 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.bSubmitScore = true;
_global.P.oTransit.goTo("HighScore");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 1048 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.bSubmitScore = false;
if (_global.P.nScore > 0) {
_global.P.bAllowSubmit = true;
} else {
_global.P.bAllowSubmit = false;
}
_global.P.oTransit.goTo("HighScore");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 1051 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
_global.P.oTransit.goTo("Title");
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 1052 MovieClip Frame 1
if (HighScores.bDisplay) {
if (gProxyObj.getIsLoggedIn()) {
if (_global.P.nScore == 0) {
btnSubmit._visible = false;
}
} else {
btnSubmit._visible = false;
}
} else {
btnSubmit._visible = false;
btnView._visible = false;
}
Symbol 1055 MovieClip Frame 1
if (HighScores.bDisplay) {
if (gProxyObj.getIsLoggedIn()) {
if (_global.P.nScore == 0) {
btnSubmit._visible = false;
}
} else {
btnSubmit._visible = false;
}
} else {
btnSubmit._visible = false;
btnView._visible = false;
}
Symbol 1073 Button
on (press) {
_global.P.oSnd.playBtnClick();
ControlScroll.scrollUp = true;
}
on (release, releaseOutside) {
ControlScroll.scrollUp = false;
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 1074 Button
on (press) {
_global.P.oSnd.playBtnClick();
ControlScroll.scrollDown = true;
}
on (release, releaseOutside) {
ControlScroll.scrollDown = false;
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 1078 Button
on (press) {
_global.P.oSnd.playBtnClick();
}
on (release, releaseOutside) {
HighScores.submitScore(_global.P.nScore);
btnSubmit._visible = false;
}
on (rollOver) {
_global.P.oSnd.playBtnRollOver();
}
Symbol 1080 MovieClip Frame 1
if (gProxyObj.getIsLoggedIn()) {
} else {
btnSubmit._visible = false;
}
if (!_global.P.bAllowSubmit) {
btnSubmit._visible = false;
}
if (_global.P.bSubmitScore == true) {
HighScores.submitScore(_global.P.nScore);
btnSubmit._visible = false;
} else {
HighScores.requestScores();
}
HighScores.onSuccess = function () {
HighScores.populateFields(mcHighScore.txtNumber, mcHighScore.txtName, mcHighScore.txtScore);
};
Instance of Symbol 1077 MovieClip "ControlScroll" in Symbol 1080 MovieClip Frame 1
onClipEvent (load) {
scrollUp = false;
scrollDown = false;
}
onClipEvent (enterFrame) {
if (scrollUp == true) {
_parent.mcHighScore.txtName.scroll--;
_parent.mcHighScore.txtScore.scroll--;
_parent.mcHighScore.txtNumber.scroll--;
} else if (scrollDown == true) {
_parent.mcHighScore.txtName.scroll++;
_parent.mcHighScore.txtScore.scroll++;
_parent.mcHighScore.txtNumber.scroll++;
}
}