Frame 1
var _oPreloaderScreen = (new com.disney.gem.games.tirade.screens.PreloaderScreen(mcScreens.mcPreloader));
com.sarbakan.BaseDisneyController.bDEBUG = false;
new com.disney.gem.games.tirade.Controller(this, _oPreloaderScreen);
Symbol 1567 MovieClip [__Packages.com.sarbakan.utils.StateManaged] Frame 0
class com.sarbakan.utils.StateManaged
{
var mcRef, bPausable, sNextState, sState;
function StateManaged (_mcRef) {
setMC(_mcRef);
setPausable(true);
}
function setMC(_mcRef) {
mcRef = _mcRef;
}
function setPausable(_bPausable) {
bPausable = _bPausable;
}
function setState(_sState, _bInstant, _bForce) {
sNextState = _sState;
if (_bInstant) {
onUpdate();
}
if (_bForce) {
mcRef.mcState.gotoAndPlay(1);
}
}
function getState() {
return(sState);
}
function stateStarting() {
return(mcRef.mcState._currentframe == 1);
}
function stateFinished() {
return(mcRef.mcState._currentframe == mcRef.mcState._totalframes);
}
function stateCurrentFrame() {
return(mcRef.mcState._currentframe);
}
function stateIsNot() {
var _local4 = false;
var _local3 = arguments.length - 1;
while (_local3 >= 0) {
if (arguments[_local3] == sState) {
_local4 = true;
break;
}
_local3--;
}
return(!_local4);
}
function destroy() {
delete mcRef;
}
function onUpdate() {
if (sNextState != undefined) {
this[("state_" + sState) + "_end"]();
sState = sNextState;
sNextState = undefined;
mcRef.gotoAndStop(sState);
this[("state_" + sState) + "_init"]();
}
this["state_" + sState]();
}
function onUpdatePaused() {
if (bPausable == false) {
onUpdate();
}
}
function onPause() {
if (bPausable) {
mcRef.mcState.stop();
}
}
function onUnPause() {
if (bPausable) {
mcRef.mcState.play();
}
}
}
Symbol 1568 MovieClip [__Packages.com.sarbakan.utils.ScreenController] Frame 0
class com.sarbakan.utils.ScreenController extends com.sarbakan.utils.StateManaged
{
var setMC, setState, setPausable, oController, bInOut, fHideCallBack, mcRef, sState, stateFinished;
function ScreenController (_mcRef) {
super();
setMC(_mcRef);
setState(sSTATE_HIDDEN);
setPausable(false);
}
function setGameController(_oController) {
oController = _oController;
}
function show(_bInOut) {
bInOut = _bInOut;
if (bInOut) {
setState(sSTATE_IN, true);
} else {
setState(sSTATE_IDLE, true);
}
}
function hide(_fHideCallBack, _bInOutOverride) {
fHideCallBack = _fHideCallBack;
var _local2 = bInOut;
if (_bInOutOverride != undefined) {
_local2 = _bInOutOverride;
}
if (_local2) {
setState(sSTATE_OUT);
} else {
setState(sSTATE_HIDDEN, true);
fHideCallBack();
}
}
function getRef() {
return(mcRef);
}
function isInOutTransitionning() {
return(sState != sSTATE_IDLE);
}
function state_in() {
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function state_out() {
if (stateFinished()) {
setState(sSTATE_HIDDEN, true);
fHideCallBack();
}
}
function state_in_init() {
mcRef.btBlocker.useHandCursor = false;
}
function state_idle_init() {
mcRef.btBlocker.useHandCursor = false;
}
function state_out_init() {
mcRef.btBlocker.useHandCursor = false;
}
static var sSTATE_HIDDEN = "hidden";
static var sSTATE_IN = "in";
static var sSTATE_IDLE = "idle";
static var sSTATE_OUT = "out";
}
Symbol 1569 MovieClip [__Packages.com.disney.gem.games.tirade.screens.PreloaderScreen] Frame 0
class com.disney.gem.games.tirade.screens.PreloaderScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function PreloaderScreen (_mcRef) {
super(_mcRef);
}
function state_idle() {
var _local2 = com.disney.gem.games.tirade.Controller(oController).mcTimeline.getBytesLoaded() / com.disney.gem.games.tirade.Controller(oController).mcTimeline.getBytesTotal();
if (_local2 == 1) {
com.disney.gem.games.tirade.Controller(oController).onPreloadingDone();
}
var _local3 = Math.round(_local2 * 100);
if (mcRef.mcState.mcBar._currentframe < _local3) {
mcRef.mcState.mcBar.nextFrame();
} else {
mcRef.mcState.mcBar.stop();
}
}
}
Symbol 1570 MovieClip [__Packages.com.sarbakan.BaseDisneyController] Frame 0
class com.sarbakan.BaseDisneyController
{
static var oInstance;
var mcTimeline, oPreloaderScreen, oMainBroadcaster, aPopups, oTransitionManager, bSoundMuted, nLastSoundToggleTimer, bPaused, oDXDControllerWrapper, nGamePhase, oCurrentScreen, fScreenShowTransitionCallBack, fScreenHideCallBack, nLevel, nScore, bInstructionCanBeDisplayed, bInstructionActive, nLastUpdateTimer;
function BaseDisneyController (_mcTimeline, _oPreloaderScreen) {
oInstance = this;
mcTimeline = _mcTimeline;
_mcTimeline.stop();
oPreloaderScreen = _oPreloaderScreen;
oMainBroadcaster = new Object();
AsBroadcaster.initialize(oMainBroadcaster);
oMainBroadcaster.addListener(this);
if (bDEBUG) {
} else {
Stage.showMenu = false;
mcTimeline._focusrect = false;
}
aPopups = new Array();
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
setDXDCallback();
} else {
initStandAloneController();
}
}
static function getInstance() {
return(oInstance);
}
function init() {
setGamePhase(nGAME_PHASE_PACKAGING);
stopScreenContainers();
oTransitionManager = new com.sarbakan.utils.TransitionManager(mcTimeline.mcTransitions);
oMainBroadcaster.addListener(oTransitionManager);
bSoundMuted = false;
nLastSoundToggleTimer = getTimer();
}
function update(_nElapsed) {
if (bPaused) {
oMainBroadcaster.broadcastMessage("onUpdatePaused", _nElapsed);
} else {
oMainBroadcaster.broadcastMessage("onUpdate", _nElapsed);
}
checkGlobalKeys();
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
bSoundMuted = oDXDControllerWrapper.isMuted();
}
}
function pause() {
if (!bPaused) {
bPaused = true;
oMainBroadcaster.broadcastMessage("onPause");
}
}
function unpause() {
if (bPaused) {
bPaused = false;
oMainBroadcaster.broadcastMessage("onUnPause");
}
}
function togglePause() {
if (bPaused) {
unpause();
} else {
pause();
}
}
function getControllerMode() {
var _local1;
if (com.disney.gem.base.BaseObject == undefined) {
_local1 = nCONTROLLER_MODE_STANDALONE;
} else {
_local1 = nCONTROLLER_MODE_DXD;
}
return(_local1);
}
function setGamePhase(_nPhase) {
nGamePhase = _nPhase;
switch (_nPhase) {
case nGAME_PHASE_PRELOADER :
mcTimeline.gotoAndStop("preloader");
break;
case nGAME_PHASE_PACKAGING :
mcTimeline.gotoAndStop("packaging");
break;
case nGAME_PHASE_INGAME :
mcTimeline.gotoAndStop("game");
}
}
function getGamePhase() {
return(nGamePhase);
}
function gameLog(_sText) {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.gameLog(_sText);
} else {
trace(_sText);
}
}
function showScreen(_oScreenController, _bInOut, _sTransitionID, _fMidTransitionCallBack) {
if (oCurrentScreen) {
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, showScreen, _oScreenController, _bInOut), _sTransitionID);
} else {
oCurrentScreen = _oScreenController;
oCurrentScreen.setGameController(this);
if (_sTransitionID != undefined) {
fScreenShowTransitionCallBack = _fMidTransitionCallBack;
oTransitionManager.playTransition(_sTransitionID, com.sarbakan.utils.Delegate.create(this, onScreenShowTransitionMiddle, _bInOut));
} else {
oCurrentScreen.show(_bInOut);
}
oMainBroadcaster.addListener(oCurrentScreen);
}
}
function hideCurrentScreen(_fHideCallBack, _sTransition) {
fScreenHideCallBack = _fHideCallBack;
if (_sTransition != undefined) {
oTransitionManager.playTransition(_sTransition, com.sarbakan.utils.Delegate.create(oCurrentScreen, oCurrentScreen.hide, com.sarbakan.utils.Delegate.create(this, onScreenHidden)));
} else {
oCurrentScreen.hide(com.sarbakan.utils.Delegate.create(this, onScreenHidden));
}
}
function showPopup(_oPopupController, _bInOut) {
var _local5 = false;
var _local2 = aPopups.length - 1;
while (_local2 >= 0) {
var _local3 = aPopups[_local2];
if (_oPopupController.getRef() == _local3.getRef()) {
_local5 = true;
_local3.destroy();
oMainBroadcaster.removeListener(_local3);
aPopups[_local2] = _oPopupController;
break;
}
_local2--;
}
if (!_local5) {
aPopups.push(_oPopupController);
}
_oPopupController.setGameController(this);
_oPopupController.show(_bInOut);
oMainBroadcaster.addListener(_oPopupController);
}
function setLevel(_nLevel) {
nLevel = _nLevel;
}
function getLevel() {
return(nLevel);
}
function setScore(_nScore) {
nScore = _nScore;
}
function increaseScore(_nIncrement) {
nScore = nScore + _nIncrement;
}
function getScore() {
return(nScore);
}
function allowInstructions() {
bInstructionCanBeDisplayed = true;
}
function disallowInstructions() {
bInstructionCanBeDisplayed = false;
}
function showInstructions() {
if (canShowInstructions()) {
bInstructionActive = true;
showInstructionsScreen();
}
}
function hideInstructions() {
if (canHideInstructions()) {
bInstructionActive = false;
hideInstructionsScreen();
}
}
function toggleSound() {
if ((getTimer() - nLastSoundToggleTimer) >= nSOUND_TOGGLE_DELAY) {
bSoundMuted = !bSoundMuted;
nLastSoundToggleTimer = getTimer();
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.toggleSound();
} else {
toggleSoundStandalone();
}
}
}
function onPreloadingDone() {
hideCurrentScreen();
init();
}
function onGameStart() {
setLevel(1);
setScore(0);
}
function onLevelStart() {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.startLevel(nLevel, nScore);
}
}
function onLevelEnd() {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.endLevel(nLevel, nScore);
}
}
function onGameEnd() {
if (getControllerMode() == nCONTROLLER_MODE_DXD) {
oDXDControllerWrapper.endGame(nLevel, nScore);
}
}
function onTransitionStart(_mcTransition) {
}
function onTransitionMiddle(_mcTransition) {
}
function onEnterFrame() {
var _local2 = getTimer();
update(_local2 - nLastUpdateTimer);
nLastUpdateTimer = _local2;
}
function onScreenShowTransitionMiddle(_bInOut) {
fScreenShowTransitionCallBack();
oCurrentScreen.show(_bInOut);
}
function onScreenHidden() {
oMainBroadcaster.removeListener(oCurrentScreen);
delete oCurrentScreen;
fScreenHideCallBack();
}
function setDXDCallback() {
mcTimeline.init = com.sarbakan.utils.Delegate.create(this, initDXDController);
}
function initDXDController(_oOwner) {
oDXDControllerWrapper = new com.sarbakan.DXDControllerWrapper(this, mcTimeline, _oOwner);
return(oDXDControllerWrapper);
}
function initStandAloneController() {
mcTimeline.onEnterFrame = com.sarbakan.utils.Delegate.create(this, onEnterFrame);
nLastUpdateTimer = getTimer();
initPreloader();
}
function initPreloader() {
setGamePhase(nGAME_PHASE_PRELOADER);
showScreen(oPreloaderScreen);
}
function checkGlobalKeys() {
if (Key.isDown(nKEY_INSTRUCTIONS)) {
if (!bInstructionActive) {
showInstructions();
} else {
hideInstructions();
}
}
if (Key.isDown(nKEY_SOUND)) {
toggleSound();
}
}
function toggleSoundStandalone() {
var _local2 = new Sound(mcTimeline);
if (!bSoundMuted) {
_local2.setVolume(100);
} else {
_local2.setVolume(0);
}
}
function canShowInstructions() {
return((((!bInstructionActive) && (bInstructionCanBeDisplayed)) && (!oCurrentScreen.isInOutTransitionning())) && (!oTransitionManager.isTransitionning()));
}
function canHideInstructions() {
return(((bInstructionActive && (bInstructionCanBeDisplayed)) && (!oCurrentScreen.isInOutTransitionning())) && (!oTransitionManager.isTransitionning()));
}
function showInstructionsScreen() {
}
function hideInstructionsScreen() {
}
function stopScreenContainers() {
var _local3 = [mcTimeline.mcPopups, mcTimeline.mcScreens];
var _local2 = _local3.length - 1;
while (_local2 >= 0) {
for (var _local4 in _local3[_local2]) {
_local3[_local2][_local4].stop();
}
_local2--;
}
}
static var bDEBUG = true;
static var nFRAME_RATE = 30;
static var nCONTROLLER_MODE_STANDALONE = 1;
static var nCONTROLLER_MODE_DXD = 2;
static var nGAME_PHASE_PRELOADER = 1;
static var nGAME_PHASE_PACKAGING = 2;
static var nGAME_PHASE_INGAME = 3;
static var nKEY_INSTRUCTIONS = 72;
static var nKEY_SOUND = 77;
static var nGAME_STAGE_WIDTH = 580;
static var nGAME_STAGE_HEIGHT = 400;
static var nSOUND_TOGGLE_DELAY = 100;
}
Symbol 1571 MovieClip [__Packages.com.sarbakan.utils.TransitionManager] Frame 0
class com.sarbakan.utils.TransitionManager extends com.sarbakan.utils.StateManaged
{
var setPausable, mcTransitionContainer, mcTransition, fMiddleCallBack, fEndCallBack, bTransitionning, setMC, setState, stateFinished, mcRef;
function TransitionManager (_mcTransition) {
super();
setPausable(false);
mcTransitionContainer = _mcTransition;
for (var _local3 in mcTransitionContainer) {
mcTransitionContainer[_local3].stop();
}
}
function playTransition(_sTransitionID, _fMiddleCallBack, _fEndCallBack) {
mcTransition = mcTransitionContainer["mc" + com.sarbakan.utils.MoreString.upperFirstChar(_sTransitionID)];
fMiddleCallBack = _fMiddleCallBack;
fEndCallBack = _fEndCallBack;
if (mcTransition == undefined) {
trace(("TransitionManager error: Unable to find mc" + com.sarbakan.utils.MoreString.upperFirstChar(_sTransitionID)) + " in transition movieclip");
} else {
bTransitionning = true;
setMC(mcTransition);
setState(sSTATE_IN);
}
}
function isTransitionning() {
return(bTransitionning);
}
function state_in() {
if (stateFinished()) {
setState(sSTATE_OUT);
fMiddleCallBack();
}
}
function state_out() {
if (stateFinished()) {
bTransitionning = false;
setState(sSTATE_HIDDEN);
fEndCallBack();
}
}
function state_in_init() {
com.sarbakan.BaseDisneyController.getInstance().onTransitionStart(mcTransition);
mcRef.btBlocker.useHandCursor = false;
}
function state_out_init() {
com.sarbakan.BaseDisneyController.getInstance().onTransitionMiddle(mcTransition);
mcRef.btBlocker.useHandCursor = false;
}
static var sSTATE_IN = "in";
static var sSTATE_OUT = "out";
static var sSTATE_HIDDEN = "hidden";
}
Symbol 1572 MovieClip [__Packages.com.sarbakan.utils.MoreString] Frame 0
class com.sarbakan.utils.MoreString
{
function MoreString () {
}
static function pad(_sToPad, _sCharPad, _nMinLength, _sSideToPad) {
var _local1 = String(_sToPad);
while (_local1.length < _nMinLength) {
if (_sSideToPad == "RIGHT") {
_local1 = _local1 + _sCharPad;
} else {
_local1 = _sCharPad + _local1;
}
}
return(_local1);
}
static function trim(_sToTrim, _sCharTrim, _sSideToTrim) {
var _local1 = String(_sToTrim);
if (_sSideToTrim == "RIGHT") {
while (_local1.substr(_local1.length - 2, 1) == _sCharTrim) {
_local1 = _local1.slice(-1);
}
} else {
while (_local1.substr(0, 1) == _sCharTrim) {
_local1 = _local1.slice(1);
}
}
return(_local1);
}
static function replace(_sString, _sFind, _sReplace) {
return(_sString.split(_sFind).join(_sReplace));
}
static function formatTime(_nTime) {
var _local2 = _nTime;
var _local1 = Math.floor(_local2 / 60);
var _local3 = Math.round(_local2 - (_local1 * 60));
return((pad(String(_local1), "0", 2) + ":") + pad(String(_local3), "0", 2));
}
static function formatNumber(__sNumber, __nMinimumChar) {
var _local1 = String(__sNumber);
var _local3 = "";
var _local4 = _local1.length;
_local4 = _local4 / 3;
var _local5;
var _local2;
if (_local4 <= 1) {
_local5 = _local1;
if (_local5.length < __nMinimumChar) {
_local5 = "0" + _local5;
}
} else {
_local2 = _local4;
while (_local2 > 1) {
_local3 = (" " + _local1.substr(-3)) + _local3;
_local1 = _local1.substr(0, -3);
_local2--;
}
_local5 = _local1 + _local3;
if (_local5.length < __nMinimumChar) {
_local5 = "0" + _local5;
}
}
return(_local5);
}
static function upperFirstChar(_sString) {
return(_sString.substr(0, 1).toUpperCase() + _sString.substr(1));
}
static function lowerFirstChar(_sString) {
return(_sString.substr(0, 1).toLowerCase() + _sString.substr(1));
}
static function convertToBoolean(_sString) {
return(_sString.toLowerCase() == "true");
}
static function formatMoney(_nMoney, _sDelimiteur, _bDecimalOpt) {
var _local5;
var _local3;
var _local2;
var _local1;
var _local6;
if (_bDecimalOpt == undefined) {
_local6 = true;
} else {
_local6 = _bDecimalOpt;
}
_local5 = String(_nMoney).split(".");
if (_local5[1] != undefined) {
_local3 = _local5[1].substr(0, 2);
switch (_local3.length) {
case 0 :
_local3 = _local3 + "00";
break;
case 1 :
_local3 = _local3 + "0";
break;
case 2 :
break;
default :
_local3 = "00";
}
} else {
_local3 = "00";
}
_local1 = _local5[0];
_local2 = "";
while (_local1.length > 3) {
_local2 = (_sDelimiteur + _local1.substr(_local1.length - 3)) + _local2;
_local1 = _local1.substr(0, _local1.length - 3);
}
_local2 = _local1 + _local2;
if (_local6) {
return(((_local2 + ".") + _local3) + "$");
}
return(_local2 + " $");
}
static function getOrdinalSuffix(_nNumber) {
var _local2;
var _local1 = String(_nNumber);
if (((_local1.substr(-2, 2) == 11) || (_local1.substr(-2, 2) == 12)) || (_local1.substr(-2, 2) == 13)) {
_local2 = "th";
} else if (_local1.substr(-1, 1) == 1) {
_local2 = "st";
} else if (_local1.substr(-1, 1) == 2) {
_local2 = "nd";
} else if (_local1.substr(-1, 1) == 3) {
_local2 = "rd";
} else {
_local2 = "th";
}
return(_local2);
}
}
Symbol 1573 MovieClip [__Packages.com.sarbakan.DXDControllerWrapper] Frame 0
class com.sarbakan.DXDControllerWrapper extends com.disney.gem.games.BaseGameController
{
var oRealController, __owner;
function DXDControllerWrapper (_oRealController, _mcTimeline, _oOwner) {
super(_mcTimeline, _oOwner);
oRealController = _oRealController;
}
function init() {
super.init();
oRealController.init();
}
function update(_nElapsed) {
oRealController.update(_nElapsed);
}
function toggleSound() {
__owner.onToggleSound();
}
function isMuted() {
return(!__owner.__soundOn);
}
function gameLog(_sText) {
__owner.gameLog(_sText, "game");
}
}
Symbol 1574 MovieClip [__Packages.com.disney.gem.games.GameContainer] Frame 0
interface com.disney.gem.games.GameContainer
{
}
Symbol 1575 MovieClip [__Packages.com.sarbakan.utils.FrameRateDisplayer] Frame 0
class com.sarbakan.utils.FrameRateDisplayer
{
var nMovieFPS, nUpdateCounter, nAverageFps, nCurrentFPS, nUpdateCount, mcDebug, nLastGetTimer;
function FrameRateDisplayer (_mcTimeline, _nMovieFPS, _nStageWidth) {
nMovieFPS = _nMovieFPS;
nUpdateCounter = 0;
nAverageFps = 0;
nCurrentFPS = nMovieFPS;
reset();
startDebug(_mcTimeline, _nStageWidth);
}
function get fps() {
return(nCurrentFPS);
}
function onUpdate() {
if ((++nUpdateCount) == nMovieFPS) {
computeFrameRate();
updateDebug();
}
}
function onUpdatePaused() {
onUpdate();
}
function startDebug(_mcTimeline, _nStageWidth) {
mcDebug = _mcTimeline.createEmptyMovieClip("PerformanceWatcherDebug", DEBUG_DEPTH);
mcDebug._x = (_nStageWidth - DEBUG_RIGHT_MARGIN) - 400;
mcDebug._y = DEBUG_TOP_MARGIN;
mcDebug.createTextField("field", 2, 0, 0, 400, 50);
var _local2 = new TextFormat();
_local2.font = DEBUG_FONT;
_local2.size = DEBUG_FONT_SIZE;
_local2.color = DEBUG_FONT_COLOR;
_local2.align = "right";
mcDebug.field.setNewTextFormat(_local2);
mcDebug.field.selectable = false;
mcDebug.createTextField("fieldShadow", 1, 1, 1, 400, 50);
var _local3 = new TextFormat();
_local3.font = DEBUG_FONT;
_local3.size = DEBUG_FONT_SIZE;
_local3.color = DEBUG_FONT_SHADOW_COLOR;
_local3.align = "right";
mcDebug.fieldShadow.setNewTextFormat(_local3);
mcDebug.fieldShadow.selectable = false;
}
function reset() {
nUpdateCount = 0;
nLastGetTimer = getTimer();
}
function computeFrameRate() {
var _local2 = getTimer() - nLastGetTimer;
var _local3 = _local2 / 1000;
nCurrentFPS = Math.round(nMovieFPS / _local3);
reset();
}
function updateDebug() {
if (mcDebug != undefined) {
nUpdateCounter++;
var _local2 = ((nCurrentFPS + " fps (avg ") + getAverage()) + ")";
mcDebug.field.text = _local2;
mcDebug.fieldShadow.text = _local2;
}
}
function getAverage() {
nAverageFps = nAverageFps + ((nCurrentFPS - nAverageFps) * (1 / nUpdateCounter));
var _local3 = "";
var _local2 = String(nAverageFps).split(".");
if (_local2[1] == undefined) {
_local3 = nAverageFps + ".00";
} else if (_local2[1].length == 1) {
_local3 = (_local2[0] + ".0") + _local2[1];
} else {
_local3 = (_local2[0] + ".") + _local2[1].substr(0, 2);
}
return(_local3);
}
static var DEBUG_DEPTH = 123456;
static var DEBUG_RIGHT_MARGIN = 0;
static var DEBUG_TOP_MARGIN = 0;
static var DEBUG_FONT = "Verdana";
static var DEBUG_FONT_SIZE = 10;
static var DEBUG_FONT_COLOR = 16777215;
static var DEBUG_FONT_SHADOW_COLOR = 0;
}
Symbol 1576 MovieClip [__Packages.com.sarbakan.utils.Delegate] Frame 0
class com.sarbakan.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 1577 MovieClip [__Packages.com.disney.gem.games.tirade.Controller] Frame 0
class com.disney.gem.games.tirade.Controller extends com.sarbakan.BaseDisneyController
{
var mcTimeline, allowInstructions, onGameStart, setLevel, nLife, oGame, onGameEnd, nGamePhase, pause, unpause, showPopup, oMusic, sNextMusicLinkage, oRollSound, oClickSound, bInitGameAtNextFrame, bDestroyingGame, getLevel, bResetingLevel, oCurrentScreen, fScreenShowTransitionCallBack, oTransitionManager, onScreenShowTransitionMiddle, oMainBroadcaster, fScreenHideCallBack, increaseScore, bInstructionActive, setGamePhase, onLevelStart;
function Controller (_mcTimeline, _oPreloaderScreen) {
super(_mcTimeline, _oPreloaderScreen);
}
static function getInstance() {
return(com.disney.gem.games.tirade.Controller(com.sarbakan.BaseDisneyController.oInstance));
}
function init() {
super.init();
com.sarbakan.sound.SoundManager.doInit(mcTimeline);
_global.ASSetPropFlags(Array.prototype, null, 1, 1);
showTitleScreen();
}
function showTitleScreen(_fTransitionCallBack) {
showScreen(new com.disney.gem.games.tirade.screens.TitleScreen(mcTimeline.mcScreens.mcTitle), false, sTRANSITION_DEFAULT, _fTransitionCallBack);
allowInstructions();
setMusic("Pirates_Turners_Tirade_Music_Packaging.wav");
}
function startNewGame() {
onGameStart();
setLevel(1);
nLife = com.disney.gem.games.tirade.GameData.nGAME_LIFE;
initGameEngine();
hideCurrentScreen(null, sTRANSITION_LOADING);
setMusic("Pirates_Turners_Tirade_Music_In_Game.wav");
}
function quitGame() {
oGame.oPlayer.bControlsLock = true;
onGameEnd();
showTitleScreen(com.sarbakan.utils.Delegate.create(this, destroyGameEngine));
}
function showInstructionsScreen() {
if (nGamePhase == com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME) {
pause();
}
showScreen(new com.disney.gem.games.tirade.screens.HelpScreen(mcTimeline.mcScreens.mcHelp), false, sTRANSITION_DEFAULT);
}
function hideInstructionsScreen() {
if (nGamePhase == com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME) {
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, unpause), sTRANSITION_DEFAULT);
} else {
showScreen(new com.disney.gem.games.tirade.screens.TitleScreen(mcTimeline.mcScreens.mcTitle), false, sTRANSITION_DEFAULT);
}
}
function showInGameMenu() {
pause();
oGame.oView.pause();
showPopup(new com.disney.gem.games.tirade.popups.MenuPopup(mcTimeline.mcPopups.mcMenu), true);
}
function hideInGameMenu() {
unpause();
}
function setMusic(_sLinkage, _sNextLinkage) {
oMusic.doFadeTo(0, true);
if (!_sNextLinkage) {
oMusic = com.sarbakan.sound.SoundManager.doPlaySound(_sLinkage, com.disney.gem.games.tirade.GameData.nVOLUME_MUSIC, 99999);
} else {
oMusic = com.sarbakan.sound.SoundManager.doPlaySound(_sLinkage, com.disney.gem.games.tirade.GameData.nVOLUME_MUSIC, 1);
sNextMusicLinkage = _sNextLinkage;
oMusic.doAddListener(this);
}
}
function stopMusic() {
oMusic.doFadeTo(0, true);
}
function playRollSound(_bPaperButton) {
oRollSound.doStop();
if (_bPaperButton) {
oRollSound = com.sarbakan.sound.SoundManager.doPlaySound("Button_Roll_Paper.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BUTTON_ROLL);
} else {
oRollSound = com.sarbakan.sound.SoundManager.doPlaySound("Button_Roll.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BUTTON_ROLL);
}
}
function playClickSound(_bPaperButton) {
oClickSound.doStop();
if (_bPaperButton) {
oClickSound = com.sarbakan.sound.SoundManager.doPlaySound("Button_Click_Paper.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BUTTON_CLICK);
} else {
oClickSound = com.sarbakan.sound.SoundManager.doPlaySound("Button_Click.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BUTTON_CLICK);
}
}
function onUpdate() {
if (bInitGameAtNextFrame) {
bInitGameAtNextFrame = false;
initGameEngine();
}
if ((com.sarbakan.BaseDisneyController.bDEBUG && (Key.isDown(8))) && (!bDestroyingGame)) {
onLevelEnd();
}
}
function onPause() {
oGame.oView.pause();
}
function onUnPause() {
oGame.oView.unpause();
}
function onNextTransitionMiddle() {
setLevel(getLevel() + 1);
destroyGameEngine();
bInitGameAtNextFrame = true;
}
function onResetTransitionMiddle() {
oGame.oPlayer.respawn();
oGame.oPlayer.bControlsLock = true;
setMusic("Pirates_Turners_Tirade_Music_In_Game.wav");
}
function onNextTransitionEnd() {
oGame.oPlayer.bControlsLock = false;
}
function onResetTransitionEnd() {
oGame.oPlayer.bControlsLock = false;
bResetingLevel = false;
}
function showScreen(_oScreenController, _bInOut, _sTransitionID, _fMidTransitionCallBack) {
if (oCurrentScreen) {
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, showScreen, _oScreenController, _bInOut), _sTransitionID);
} else {
oCurrentScreen = _oScreenController;
oCurrentScreen.setGameController(this);
if (_sTransitionID != undefined) {
fScreenShowTransitionCallBack = _fMidTransitionCallBack;
oGame.oPlayer.bControlsLock = true;
oTransitionManager.playTransition(_sTransitionID, com.sarbakan.utils.Delegate.create(this, onScreenShowTransitionMiddle, _bInOut), com.sarbakan.utils.Delegate.create(this, onNextTransitionEnd));
} else {
oCurrentScreen.show(_bInOut);
}
oMainBroadcaster.addListener(oCurrentScreen);
}
}
function hideCurrentScreen(_fHideCallBack, _sTransition) {
fScreenHideCallBack = _fHideCallBack;
if (_sTransition != undefined) {
oGame.oPlayer.bControlsLock = true;
oTransitionManager.playTransition(_sTransition, com.sarbakan.utils.Delegate.create(oCurrentScreen, oCurrentScreen.hide, com.sarbakan.utils.Delegate.create(this, onScreenHidden)), com.sarbakan.utils.Delegate.create(this, onNextTransitionEnd));
} else {
oCurrentScreen.hide(com.sarbakan.utils.Delegate.create(this, onScreenHidden));
}
}
function onDie() {
if ((!bResetingLevel) && (!bDestroyingGame)) {
if ((--nLife) == 0) {
bDestroyingGame = true;
setMusic("Loose.wav", "Pirates_Turners_Tirade_Music_Packaging.wav");
showScreen(new com.disney.gem.games.tirade.screens.EndScreen(mcTimeline.mcScreens.mcLose), false, sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, destroyGameEngine));
onGameEnd();
} else {
bResetingLevel = true;
oGame.oPlayer.bControlsLock = true;
oTransitionManager.playTransition(sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, onResetTransitionMiddle), com.sarbakan.utils.Delegate.create(this, onResetTransitionEnd));
}
}
}
function onLevelEnd() {
super.onLevelEnd();
oGame.oPlayer.bControlsLock = true;
oGame.oPlayer.nSpeedX = 0;
increaseScore(com.disney.gem.games.tirade.GameData.nSCORE_LEVEL);
if (getLevel() < com.disney.gem.games.tirade.GameData.nTOTAL_LEVEL) {
oGame.oPlayer.bControlsLock = true;
oTransitionManager.playTransition(sTRANSITION_LOADING, com.sarbakan.utils.Delegate.create(this, onNextTransitionMiddle), com.sarbakan.utils.Delegate.create(this, onNextTransitionEnd));
} else {
bDestroyingGame = true;
setMusic("Win.wav", "Pirates_Turners_Tirade_Music_Packaging.wav");
showScreen(new com.disney.gem.games.tirade.screens.EndScreen(mcTimeline.mcScreens.mcWin), false, sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, destroyGameEngine));
onGameEnd();
}
}
function onScreenHidden() {
bInstructionActive = false;
super.onScreenHidden();
}
function doSoundEvent(_nEventType, _oSound) {
setMusic(sNextMusicLinkage);
}
function onTransitionInSound() {
com.sarbakan.sound.SoundManager.doPlaySound("TransitionIn.wav", com.disney.gem.games.tirade.GameData.nVOLUME_TRANSITION, 1, true);
}
function onTransitionOutSound() {
com.sarbakan.sound.SoundManager.doPlaySound("TransitionOut.wav", com.disney.gem.games.tirade.GameData.nVOLUME_TRANSITION, 1, true);
}
function initGameEngine() {
setGamePhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME);
oGame = new com.disney.gem.games.tirade.GameEngine(this, mcTimeline.mcGame);
oMainBroadcaster.addListener(oGame);
onLevelStart();
}
function destroyGameEngine() {
setGamePhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING);
oMainBroadcaster.removeListener(oGame);
oGame.destroy();
oGame = null;
bDestroyingGame = false;
}
static var sTRANSITION_DEFAULT = "default";
static var sTRANSITION_LOADING = "loading";
}
Symbol 1578 MovieClip [__Packages.com.disney.gem.games.tirade.GameEngine] Frame 0
class com.disney.gem.games.tirade.GameEngine
{
var oController, mcGame, oHUD, oView, oCam, oLayerBG, oLayerGame, oLayerFG, oPlayer;
function GameEngine (_oController, _mcGame) {
oController = _oController;
mcGame = _mcGame;
oHUD = new com.disney.gem.games.tirade.HUD(oController, mcGame.mcHUD);
mcGame.mcLevels.gotoAndStop("level" + oController.getLevel());
var _local2 = mcGame.mcLevels.mcLevel;
oView = new com.disney.gem.games.tirade.sarbakan.visual.layer.LayerManager(_local2._width, _local2._height, 580, 410);
oCam = oView.getCamera();
setNormalCamSpeed();
oLayerBG = new com.disney.gem.games.tirade.sarbakan.visual.layer.Layer(_local2.mcBG, new com.disney.gem.games.tirade.sarbakan.visual.activation.GridActivation());
var _local3 = com.disney.gem.games.tirade.GameData.aPARALLAX_RATE_BG[oController.getLevel() - 1];
oView.addLayer(oLayerBG, _local3.x, _local3.y);
oLayerGame = new com.disney.gem.games.tirade.sarbakan.visual.layer.Layer(_local2.mcGame, new com.disney.gem.games.tirade.sarbakan.visual.activation.GridActivation());
oLayerGame.addCollisionMap(new com.disney.gem.games.tirade.sarbakan.visual.layer.CollisionMap("floor", oLayerGame, 16732159));
oLayerGame.getCollisionMap("floor").setNewSource(_local2.mcGame.mcFloorCollisionMap);
oLayerGame.addCollisionMap(new com.disney.gem.games.tirade.sarbakan.visual.layer.CollisionMap("wall", oLayerGame, 16776960));
oLayerGame.getCollisionMap("wall").setNewSource(_local2.mcGame.mcWallCollisionMap);
oLayerGame.addCollisionMap(new com.disney.gem.games.tirade.sarbakan.visual.layer.CollisionMap("ceiling", oLayerGame, 13260));
oLayerGame.getCollisionMap("ceiling").setNewSource(_local2.mcGame.mcCeilingCollisionMap);
oView.addLayer(oLayerGame, com.disney.gem.games.tirade.GameData.nPARALLAX_RATE_GAME_X, com.disney.gem.games.tirade.GameData.nPARALLAX_RATE_GAME_Y);
oLayerFG = new com.disney.gem.games.tirade.sarbakan.visual.layer.Layer(_local2.mcFG, new com.disney.gem.games.tirade.sarbakan.visual.activation.GridActivation());
oView.addLayer(oLayerFG, com.disney.gem.games.tirade.GameData.nPARALLAX_RATE_FG_X, com.disney.gem.games.tirade.GameData.nPARALLAX_RATE_FG_Y);
oPlayer = new com.disney.gem.games.tirade.elements.characters.Player(_local2.mcGame.mcPlayer);
oLayerGame.addDynamicElement(oPlayer);
oCam.lockOn(com.sarbakan.utils.Delegate.create(oPlayer, oPlayer.getCoord), true);
}
function destroy() {
mcGame.mcLevels.gotoAndStop("reset");
oView.destroy();
}
function addDynamicElement(_oElement) {
oLayerGame.addDynamicElement(_oElement);
}
function addStaticElement(_oElement) {
oLayerGame.addStaticElement(_oElement);
}
function setNormalCamSpeed() {
oCam.setSpeed(com.disney.gem.games.tirade.GameData.nCAMERA_SPEED_NORMAL);
}
function setFastCamSpeed() {
oCam.setSpeed(com.disney.gem.games.tirade.GameData.nCAMERA_SPEED_FAST);
}
function onUpdate() {
oView.update();
oHUD.update();
}
function onUpdatePaused() {
onUpdate();
}
}
Symbol 1579 MovieClip [__Packages.mx.transitions.easing.Regular] Frame 0
class mx.transitions.easing.Regular
{
function Regular () {
}
static function easeIn(t, b, c, d) {
t = t / d;
return(((c * t) * t) + b);
}
static function easeOut(t, b, c, d) {
t = t / d;
return((((-c) * t) * (t - 2)) + b);
}
static function easeInOut(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
static var version = "1.1.0.52";
}
Symbol 1580 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.Camera] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.Camera
{
static var oEnterFrameListener;
var nViewZoneW, nViewZoneH, aViewZones, nStageW, nStageH, bLockedOn, nX, nY, nSpeed, bTravelling, oTweenX, fEasing, oTweenY, nTravelDestX, nTravelDestY, fEndListener, fLockedFunction, bWrappedX, __get__x, bWrappedY, __get__y;
function Camera (_viewZoneW, _viewZoneH, _nStageW, _nStageH) {
mx.transitions.OnEnterFrameBeacon.init();
oEnterFrameListener = new Object();
oEnterFrameListener.onEnterFrame = com.disney.gem.games.tirade.sarbakan.utils.Delegate.create(this, update);
MovieClip.removeListener(oEnterFrameListener);
MovieClip.addListener(oEnterFrameListener);
resetPosition();
nViewZoneW = _viewZoneW;
nViewZoneH = _viewZoneH;
aViewZones = [];
nStageW = _nStageW;
nStageH = _nStageH;
setSpeed(DEFAULT_SPEED);
setEasing(DEFAULT_EASING);
bLockedOn = false;
}
function resetPosition() {
nX = 0;
nY = 0;
}
function travelTo(_nDestX, _nDestY, _fListener) {
var _local2 = Math.round(com.disney.gem.games.tirade.sarbakan.utils.MoreMath.getDistance(nX * -1, nY * -1, _nDestX, _nDestY) / nSpeed);
if (_local2 == 0) {
_local2 = 1;
}
if (!bTravelling) {
oTweenX = new mx.transitions.Tween(this, "x", fEasing, nX * -1, _nDestX, _local2, false);
oTweenY = new mx.transitions.Tween(this, "y", fEasing, nY * -1, _nDestY, _local2, false);
oTweenX.onMotionFinished = com.disney.gem.games.tirade.sarbakan.utils.Delegate.create(this, onTravelFinished);
} else {
oTweenX.continueTo(_nDestX, _local2);
oTweenY.continueTo(_nDestY, _local2);
}
nTravelDestX = _nDestX;
nTravelDestY = _nDestY;
if (_fListener) {
fEndListener = _fListener;
}
bTravelling = true;
}
function moveTo(_nDestX, _nDestY) {
x = (_nDestX);
y = (_nDestY);
}
function lockOn(_fLockFunction, _bInstant, _fEndListener) {
bLockedOn = true;
fLockedFunction = _fLockFunction;
var _local2 = fLockedFunction();
if ((_local2.x != nX) || (_local2.y != nY)) {
if (_bInstant) {
moveTo(_local2.x, _local2.y);
} else {
travelTo(_local2.x, _local2.y, _fEndListener);
}
}
}
function relock() {
lockOn(fLockedFunction);
}
function unlock() {
bLockedOn = false;
}
function setSpeed(_nSpeed) {
if (_nSpeed) {
nSpeed = _nSpeed;
} else {
setSpeed(DEFAULT_SPEED);
}
}
function setEasing(_fEasing) {
if (_fEasing) {
fEasing = _fEasing;
} else {
setEasing(DEFAULT_EASING);
}
}
function set x(_nX) {
if (hasViewZones()) {
if (((isInViewZone(_nX, nY * -1) && (isInViewZone(_nX + nStageW, (nY * -1) + nStageH))) && (isInViewZone(_nX + nStageW, nY * -1))) && (isInViewZone(_nX, (nY * -1) + nStageH))) {
nX = _nX * -1;
bWrappedX = false;
} else {
bWrappedX = true;
}
} else {
nX = _nX;
if (nX < 0) {
nX = 0;
}
if (nX > (nViewZoneW - nStageW)) {
nX = Math.round(nViewZoneW - nStageW);
}
nX = nX * -1;
bWrappedX = false;
}
//return(__get__x());
}
function set y(_nY) {
if (hasViewZones()) {
if (((isInViewZone(nX * -1, _nY) && (isInViewZone((nX * -1) + nStageW, _nY + nStageH))) && (isInViewZone((nX * -1) + nStageW, _nY))) && (isInViewZone(nX * -1, _nY + nStageH))) {
nY = _nY * -1;
bWrappedY = false;
} else {
bWrappedY = true;
}
} else {
nY = _nY;
if (nY < 0) {
nY = 0;
}
if (nY > (nViewZoneH - nStageH)) {
nY = Math.round(nViewZoneH - nStageH);
}
nY = nY * -1;
bWrappedY = false;
}
//return(__get__y());
}
function getX() {
return(nX);
}
function getY() {
return(nY);
}
function addViewZone(_mcZone) {
aViewZones.push(new flash.geom.Rectangle(_mcZone._x, _mcZone._y, _mcZone._width, _mcZone._height));
_mcZone.swapDepths(90210);
_mcZone.removeMovieClip();
}
function destroy() {
MovieClip.removeListener(oEnterFrameListener);
}
function pause() {
oTweenX.stop();
oTweenY.stop();
}
function unpause() {
oTweenX.resume();
oTweenY.resume();
}
function update() {
if (bLockedOn) {
var _local2 = fLockedFunction();
if (bTravelling) {
if ((_local2.x != nTravelDestX) || (_local2.y != nTravelDestY)) {
travelTo(_local2.x, _local2.y, fEndListener);
}
} else {
var _local6 = bWrappedX || (bWrappedY);
var _local4 = nX;
var _local3 = nY;
moveTo(_local2.x, _local2.y);
var _local5 = bWrappedX || (bWrappedY);
if ((_local6 == true) && (_local5 == false)) {
nX = _local4;
nY = _local3;
relock();
}
}
}
}
function onTravelFinished() {
bTravelling = false;
if (fEndListener) {
fEndListener();
fEndListener = undefined;
}
}
function isInViewZone(_nX, _nY) {
var _local3 = false;
var _local2 = aViewZones.length - 1;
while (_local2 >= 0) {
if (aViewZones[_local2].contains(_nX, _nY)) {
_local3 = true;
break;
}
_local2--;
}
return(_local3);
}
function hasViewZones() {
return(aViewZones.length > 0);
}
static var DEFAULT_SPEED = 5;
static var DEFAULT_EASING = mx.transitions.easing.Regular.easeOut;
}
Symbol 1581 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 1582 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 1583 MovieClip [__Packages.mx.transitions.Tween] Frame 0
class mx.transitions.Tween
{
var obj, prop, begin, useSeconds, _listeners, addListener, prevTime, _time, looping, _duration, broadcastMessage, isPlaying, _fps, prevPos, _pos, change, _intervalID, _startTime;
function Tween (obj, prop, func, begin, finish, duration, useSeconds) {
mx.transitions.OnEnterFrameBeacon.init();
if (!arguments.length) {
return;
}
this.obj = obj;
this.prop = prop;
this.begin = begin;
position = (begin);
this.duration = (duration);
this.useSeconds = useSeconds;
if (func) {
this.func = func;
}
this.finish = (finish);
_listeners = [];
addListener(this);
start();
}
function set time(t) {
prevTime = _time;
if (t > duration) {
if (looping) {
rewind(t - _duration);
update();
broadcastMessage("onMotionLooped", this);
} else {
if (useSeconds) {
_time = _duration;
update();
}
stop();
broadcastMessage("onMotionFinished", this);
}
} else if (t < 0) {
rewind();
update();
} else {
_time = t;
update();
}
//return(time);
}
function get time() {
return(_time);
}
function set duration(d) {
_duration = (((d == null) || (d <= 0)) ? (_global.Infinity) : (d));
//return(duration);
}
function get duration() {
return(_duration);
}
function set FPS(fps) {
var _local2 = isPlaying;
stopEnterFrame();
_fps = fps;
if (_local2) {
startEnterFrame();
}
//return(FPS);
}
function get FPS() {
return(_fps);
}
function set position(p) {
setPosition(p);
//return(position);
}
function setPosition(p) {
prevPos = _pos;
obj[prop] = (_pos = p);
broadcastMessage("onMotionChanged", this, _pos);
updateAfterEvent();
}
function get position() {
return(getPosition());
}
function getPosition(t) {
if (t == undefined) {
t = _time;
}
return(func(t, begin, change, _duration));
}
function set finish(f) {
change = f - begin;
//return(finish);
}
function get finish() {
return(begin + change);
}
function continueTo(finish, duration) {
begin = position;
this.finish = (finish);
if (duration != undefined) {
this.duration = (duration);
}
start();
}
function yoyo() {
continueTo(begin, time);
}
function startEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.addListener(this);
} else {
_intervalID = setInterval(this, "onEnterFrame", 1000 / _fps);
}
isPlaying = true;
}
function stopEnterFrame() {
if (_fps == undefined) {
_global.MovieClip.removeListener(this);
} else {
clearInterval(_intervalID);
}
isPlaying = false;
}
function start() {
rewind();
startEnterFrame();
broadcastMessage("onMotionStarted", this);
}
function stop() {
stopEnterFrame();
broadcastMessage("onMotionStopped", this);
}
function resume() {
fixTime();
startEnterFrame();
broadcastMessage("onMotionResumed", this);
}
function rewind(t) {
_time = ((t == undefined) ? 0 : (t));
fixTime();
update();
}
function fforward() {
time = (_duration);
fixTime();
}
function nextFrame() {
if (useSeconds) {
time = ((getTimer() - _startTime) / 1000);
} else {
time = (_time + 1);
}
}
function onEnterFrame() {
nextFrame();
}
function prevFrame() {
if (!useSeconds) {
time = (_time - 1);
}
}
function toString() {
return("[Tween]");
}
function fixTime() {
if (useSeconds) {
_startTime = getTimer() - (_time * 1000);
}
}
function update() {
position = (getPosition(_time));
}
static var version = "1.1.0.52";
static var __initBeacon = mx.transitions.OnEnterFrameBeacon.init();
static var __initBroadcaster = mx.transitions.BroadcasterMX.initialize(mx.transitions.Tween.prototype, true);
function func(t, b, c, d) {
return(((c * t) / d) + b);
}
}
Symbol 1584 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.utils.Delegate] Frame 0
class com.disney.gem.games.tirade.sarbakan.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 1585 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.utils.MoreMath] Frame 0
class com.disney.gem.games.tirade.sarbakan.utils.MoreMath
{
function MoreMath () {
}
static function random(_nMin, _nMax) {
_nMax++;
return(Math.floor(Math.random() * (_nMax - _nMin)) + _nMin);
}
static function randomFromPredefined(_oPredefined, _nMin, _nMax) {
return(Math.floor(_oPredefined.get() * (_nMax - _nMin)) + _nMin);
}
static function getDistance(_x1, _y1, _x2, _y2) {
return(Math.sqrt(Math.pow(Math.abs(_x2 - _x1), 2) + Math.pow(Math.abs(_y2 - _y1), 2)));
}
static function getManhattanDistance(_x1, _y1, _x2, _y2) {
return(Math.abs(_x1 - _x2) + Math.abs(_y1 - _y2));
}
static function wrapInRange(_nNumber, _nMin, _nMax) {
_nNumber = Math.max(_nNumber, _nMin);
_nNumber = Math.min(_nNumber, _nMax);
return(_nNumber);
}
static function convertToRadians(_nAngle) {
return((_nAngle * Math.PI) / 180);
}
static function getAngle(_oPt1, _oPt2) {
var _local2 = 0;
var _local3 = 0;
var _local1 = 0;
var _local4 = 0;
_local2 = (_oPt1.x - _oPt2.x) * -1;
_local3 = (_oPt1.y - _oPt2.y) * -1;
_local1 = Math.atan2(_local3, _local2);
_local1 = (_local1 * 180) / Math.PI;
if (_local1 < 0) {
_local1 = _local1 * -1;
_local4 = 180 - _local1;
_local1 = 180 + _local4;
}
if (_local1 < 0) {
_local1 = _local1 + 360;
}
return(_local1);
}
static function getRadian(_oPt1, _oPt2) {
var _local1 = 0;
var _local2 = 0;
var _local3 = 0;
_local1 = (_oPt1.x - _oPt2.x) * -1;
_local2 = (_oPt1.y - _oPt2.y) * -1;
_local3 = Math.atan2(_local2, _local1);
return(_local3);
}
static function getLowestValue() {
var _local3 = arguments[arguments.length - 1];
var _local2 = arguments.length - 1;
while (_local2 >= 0) {
if (arguments[_local2] > _local3) {
_local3 = arguments[_local2];
}
_local2--;
}
return(_local3);
}
static function getHighestValue() {
var _local3 = arguments[arguments.length - 1];
var _local2 = arguments.length - 1;
while (_local2 >= 0) {
if (arguments[_local2] < _local3) {
_local3 = arguments[_local2];
}
_local2--;
}
return(_local3);
}
}
Symbol 1586 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.utils.PredefinedRandom] Frame 0
class com.disney.gem.games.tirade.sarbakan.utils.PredefinedRandom
{
var nListSize, aList, aOriginalList;
function PredefinedRandom (_nListSize) {
if (_nListSize) {
nListSize = _nListSize;
} else {
nListSize = DEFAULT_LIST_SIZE;
}
regenerate();
}
function reset() {
aList = com.disney.gem.games.tirade.sarbakan.utils.Tools.copyArray(aOriginalList);
}
function regenerate() {
aList = [];
var _local2 = 0;
while (_local2 < nListSize) {
aList.push(Math.random());
_local2++;
}
aOriginalList = com.disney.gem.games.tirade.sarbakan.utils.Tools.copyArray(aList);
}
function get() {
var _local2 = aList.pop();
aList.unshift(_local2);
return(_local2);
}
function getLastGetted() {
return(aList[0]);
}
static var DEFAULT_LIST_SIZE = 50;
}
Symbol 1587 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.utils.Tools] Frame 0
class com.disney.gem.games.tirade.sarbakan.utils.Tools
{
function Tools () {
}
static function copyArray(_aArraySource) {
var _local3 = new Array();
var _local1 = 0;
_local1 = 0;
while (_local1 < _aArraySource.length) {
if (_aArraySource[_local1] instanceof Array) {
_local3.push(copyArray(_aArraySource[_local1]));
} else {
_local3.push(_aArraySource[_local1]);
}
_local1++;
}
return(_local3);
}
static function copyObject(_oObjectSource) {
var _local2 = new Object();
for (var _local3 in _oObjectSource) {
if (_oObjectSource[_local3] === _oObjectSource) {
_local2[_local3] = _local2;
} else {
_local2[_local3] = ((typeof(_oObjectSource[_local3]) == "object") ? (copyObject(_oObjectSource[_local3])) : (_oObjectSource[_local3]));
}
}
return(_local2);
}
static function spliceRandomValue(_aArray) {
return(_aArray.splice(com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(0, _aArray.length - 1), 1)[0]);
}
static function getObjectSize(_oObject) {
var _local1 = 0;
for (var _local2 in _oObject) {
_local1++;
}
return(_local1);
}
static function updateProperties(_oBaseObject, _oUpdateObject) {
for (var _local4 in _oBaseObject) {
for (var _local3 in _oUpdateObject) {
if (_local4 == _local3) {
trace((("###########" + _local4) + " =>") + _oUpdateObject[_local3]);
_oBaseObject[_local4] = _oUpdateObject[_local3];
break;
}
}
}
return(_oUpdateObject);
}
static function getObjectTotalElements(_oTargetObject) {
var _local1 = {mc:0, objects:0, vars:0};
for (var _local6 in _oTargetObject) {
if (typeof(_oTargetObject[_local6]) == "movieclip") {
_local1.mc++;
var _local4 = getObjectTotalElements(_oTargetObject[_local6]);
_local1.mc = _local1.mc + _local4.mc;
_local1.objects = _local1.objects + _local4.objects;
_local1.vars = _local1.vars + _local4.vars;
} else if (typeof(_oTargetObject[_local6]) == "object") {
_local1.objects++;
var _local3 = getObjectTotalElements(_oTargetObject[_local6]);
_local1.mc = _local1.mc + _local3.mc;
_local1.objects = _local1.objects + _local3.objects;
_local1.vars = _local1.vars + _local3.vars;
} else if (typeof(_oTargetObject[_local6]) == "array") {
var _local5 = getObjectTotalElements(_oTargetObject[_local6]);
_local1.mc = _local1.mc + _local5.mc;
_local1.objects = _local1.objects + _local5.objects;
_local1.vars = _local1.vars + _local5.vars;
} else {
_local1.vars++;
}
}
return(_local1);
}
static function getObjectTotalSize(_oTargetObject, _nMaxLevel, _ObjectsLevel) {
if (_nMaxLevel == undefined) {
_nMaxLevel = 1;
}
if (_ObjectsLevel == undefined) {
_ObjectsLevel = 0;
}
var _local2 = {mcs:0, size:0};
for (var _local9 in _oTargetObject) {
if (typeof(_oTargetObject[_local9]) == "movieclip") {
var _local7 = _oTargetObject[_local9]._target.split("/");
if (_local7.length > _ObjectsLevel) {
_local2.mcs++;
var _local6 = _oTargetObject[_local9].getBytesLoaded();
if (_local6 != undefined) {
_local2.size = _local2.size + _local6;
}
if (_nMaxLevel > 0) {
var _local4 = getObjectTotalSize(_oTargetObject[_local9], _nMaxLevel - 1, _local7.length);
_local2.mcs = _local2.mcs + _local4.mcs;
if (_local4.size != undefined) {
_local2.size = _local2.size + _local4.size;
}
}
}
} else if (typeof(_oTargetObject[_local9]) == "object") {
if (_nMaxLevel > 0) {
var _local3 = getObjectTotalSize(_oTargetObject[_local9], _nMaxLevel - 1, _ObjectsLevel);
_local2.mcs = _local2.mcs + _local3.mcs;
if (_local3.size != undefined) {
_local2.size = _local2.size + _local3.size;
}
}
}
}
return(_local2);
}
}
Symbol 1588 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.layer.LayerManager] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.layer.LayerManager
{
var nStageW, nStageH, oCam, aLayers, bPaused, bWillPause;
function LayerManager (_nViewZoneW, _nViewZoneH, _nStageW, _nStageH) {
nStageW = _nStageW;
nStageH = _nStageH;
oCam = new com.disney.gem.games.tirade.sarbakan.visual.Camera(_nViewZoneW, _nViewZoneH, nStageW, nStageH);
aLayers = [];
bPaused = false;
bWillPause = false;
}
function addLayer(_oLayer, _parallaxRatioX, _parallaxRatioY) {
aLayers.push({layer:_oLayer, mc:_oLayer.mc, ratioX:_parallaxRatioX, ratioY:_parallaxRatioY});
_oLayer.init(nStageW, nStageH);
}
function getCamera() {
return(oCam);
}
function destroy() {
var _local2 = 0;
while (_local2 < aLayers.length) {
aLayers[_local2].layer.destroy();
_local2++;
}
oCam.destroy();
}
function pause() {
bWillPause = true;
}
function unpause() {
if (bPaused) {
var _local2 = 0;
while (_local2 < aLayers.length) {
aLayers[_local2].layer.unpause();
_local2++;
}
oCam.unpause();
com.disney.gem.games.tirade.sarbakan.visual.PauseManager.unpause();
}
bPaused = false;
bWillPause = false;
}
function togglePause() {
if (!bPaused) {
pause();
} else {
unpause();
}
}
function update() {
if (bWillPause) {
bPaused = true;
bWillPause = false;
var _local2 = 0;
while (_local2 < aLayers.length) {
aLayers[_local2].layer.pause();
_local2++;
}
oCam.pause();
com.disney.gem.games.tirade.sarbakan.visual.PauseManager.pause();
}
if (!bPaused) {
var _local2 = 0;
while (_local2 < aLayers.length) {
aLayers[_local2].layer.update();
_local2++;
}
updateCameraPosition();
}
}
function updateCameraPosition() {
var _local4 = oCam.getX();
var _local3 = oCam.getY();
var _local2 = 0;
while (_local2 < aLayers.length) {
aLayers[_local2].mc._x = Math.round(_local4 * aLayers[_local2].ratioX);
aLayers[_local2].mc._y = Math.round(_local3 * aLayers[_local2].ratioY);
_local2++;
}
}
}
Symbol 1589 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.layer.Layer] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.layer.Layer
{
var mc, oDynamicElements, aStaticElements, oCollisionMaps, oActivationManager, nHighestDepth, aReservedDepth, nOriginalX, nOriginalY, nStageWHalf, nStageHHalf;
function Layer (_mc, _oActivationManager) {
mc = _mc;
oDynamicElements = {};
aStaticElements = [];
oCollisionMaps = {};
oActivationManager = _oActivationManager;
nHighestDepth = 0;
aReservedDepth = [];
nOriginalX = _mc._x;
nOriginalY = _mc._y;
}
function init(_nStageW, _nStageH) {
nStageWHalf = _nStageW / 2;
nStageHHalf = _nStageH / 2;
oActivationManager.init(_nStageW, _nStageH);
}
function addDynamicElement(_oElement) {
oDynamicElements[_oElement.id] = _oElement;
_oElement.setOwner(this);
_oElement.init();
if (oDynamicElements[_oElement.id] != undefined) {
if (!_oElement.bAlwaysActive) {
var _local3 = _oElement.getGlobalPos(_oElement.mc);
oActivationManager.addDynamicElement(_oElement, _local3.x, _local3.y, _oElement.mc._width, _oElement.mc._height);
} else {
oActivationManager.addAlwaysActiveElement(_oElement);
}
_oElement.disable();
updateActivation(true);
}
}
function changeDynamicElementID(_oElement, _sNewID) {
delete oDynamicElements[_oElement.id];
_oElement.id = _sNewID;
oDynamicElements[_oElement.id] = _oElement;
}
function removeDynamicElement(_oElement) {
if (_oElement.bAlwaysActive) {
oActivationManager.removeAlwaysActiveElement(_oElement);
} else {
oActivationManager.removeDynamicElement(_oElement);
}
delete oDynamicElements[_oElement.id];
}
function addStaticElement(_oElement) {
_oElement.setOwner(this);
_oElement.init();
oActivationManager.addStaticElement(_oElement, _oElement.mc._x, _oElement.mc._y, _oElement.mc._width, _oElement.mc._height);
_oElement.disable();
updateActivation(true);
aStaticElements.push(_oElement);
}
function getDisplacementX() {
return(nOriginalX - mc._x);
}
function getDisplacementY() {
return(nOriginalY - mc._y);
}
function addCollisionMap(_oCollisionMap) {
oCollisionMaps[_oCollisionMap.id] = _oCollisionMap;
}
function getCollisionMap(_sCollisionMapID) {
return(oCollisionMaps[_sCollisionMapID]);
}
function reserveDepth(_nDepth) {
if (_nDepth > nHighestDepth) {
nHighestDepth = _nDepth;
}
aReservedDepth[_nDepth] = true;
}
function isDepthReserved(_nDepth) {
return(aReservedDepth[_nDepth] == true);
}
function getNextDepth() {
return(++nHighestDepth);
}
function update() {
updateActivation(false);
var _local2 = oActivationManager.getActiveElements();
for (var _local3 in _local2) {
if (_local2[_local3].bGarbaged != true) {
_local2[_local3].update();
}
}
}
function reset() {
for (var _local2 in oDynamicElements) {
oDynamicElements[_local2].reset();
}
updateActivation(true);
}
function pause() {
var _local2;
_local2 = oActivationManager.getActiveElements();
for (var _local3 in _local2) {
_local2[_local3].pause();
}
}
function unpause() {
var _local2;
_local2 = oActivationManager.getActiveElements();
for (var _local3 in _local2) {
_local2[_local3].unpause();
}
}
function destroy() {
for (var _local2 in oDynamicElements) {
oDynamicElements[_local2].remove();
}
var _local2 = aStaticElements.length - 1;
while (_local2 >= 0) {
aStaticElements[_local2].removeMovieClip();
_local2--;
}
for (_local2 in oCollisionMaps) {
oCollisionMaps[_local2].remove();
}
mc._x = nOriginalX;
mc._y = nOriginalY;
}
function updateActivation(_bForceUpdate) {
oActivationManager.updateActivation((mc._x - nStageWHalf) * -1, (mc._y - nStageHHalf) * -1, _bForceUpdate);
}
}
Symbol 1590 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.activation.ActivationManager] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.activation.ActivationManager
{
var nZoneWidth, nZoneHeight;
function ActivationManager () {
}
function init(_nZoneWidth, _nZoneHeight) {
nZoneWidth = _nZoneWidth;
nZoneHeight = _nZoneHeight;
}
function addDynamicElement(_oElement, _nX, _nY, _nWidth, _nHeight) {
}
function updateDynamicElement(_oElement, _nX, _nY, _nWidth, _nHeight) {
removeDynamicElement(_oElement);
addDynamicElement(_oElement, _nX, _nY, _nWidth, _nHeight);
}
function addAlwaysActiveElement(_oElement) {
}
function removeAlwaysActiveElement(_oElement) {
}
function removeDynamicElement(_oElement) {
}
function addStaticElement(_oElement, _nX, _nY, _nWidth, _nHeight) {
}
function removeStaticElement(_oElement) {
}
function updateActivation(_nX, _nY) {
}
function getActiveElements() {
return([]);
}
}
Symbol 1591 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement
{
static var nNextID;
var id, oAttachProperties, oOwner, mc, sLinkage, nAttachDepth, bActive;
function BaseElement (_sID) {
id = _sID;
oAttachProperties = {};
}
function init() {
}
function setOwner(_oOwner) {
oOwner = _oOwner;
}
function setMC(_mc) {
mc = _mc;
if (mc.onElementCreated) {
mc.onElementCreated(this);
delete mc.onElementCreated;
}
}
function getMC() {
return(mc);
}
function setLinkage(_sLinkage) {
sLinkage = _sLinkage;
}
function attachMC(_mcAttach) {
if (nAttachDepth == undefined) {
nAttachDepth = oOwner.getNextDepth();
oOwner.reserveDepth(nAttachDepth);
}
if (_mcAttach == undefined) {
_mcAttach = oOwner.mc;
}
setMC(_mcAttach.attachMovie(sLinkage, id, nAttachDepth, oAttachProperties));
}
function detachMC() {
if (mc != undefined) {
oAttachProperties = {_x:mc._x, _y:mc._y, _xscale:mc._xscale, _yscale:mc._yscale, _height:mc._height, _width:mc._width, _rotation:mc._rotation, _alpha:mc._alpha, _visible:mc._visible};
mc.removeMovieClip();
}
setMC(undefined);
}
function removeReferenceMC() {
mc.swapDepths(16383);
detachMC();
}
function toString() {
return(("[Element " + id) + "]");
}
static function resetID() {
nNextID = undefined;
}
function getMCProperty(_sProperty) {
if (bActive) {
return(mc[_sProperty]);
}
return(oAttachProperties[_sProperty]);
}
static function getNextID() {
if (!nNextID) {
nNextID = 0;
}
return(nNextID++);
}
}
Symbol 1592 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement extends com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement
{
var nSpeedX, nSpeedXLast, nSpeedY, nSpeedYLast, bAlwaysActive, bStaticMovieClip, bAnimStopped, bKeepStateOnEnable, mc, sState, sNextState, detachMC, bNoPause, bGarbaged, oOwner, oAttachProperties, bMoved;
function DynamicElement (_sID) {
super(_sID);
nSpeedX = 0;
nSpeedXLast = 0;
nSpeedY = 0;
nSpeedYLast = 0;
bAlwaysActive = false;
bStaticMovieClip = false;
bAnimStopped = false;
bKeepStateOnEnable = false;
enablePause();
}
function update() {
updateState();
updateMove();
}
function elementOnScreen(_nOffsetX, _nOffsetY) {
var _local4 = {x:0, y:0};
_local4 = {x:mc._x, y:mc._y};
mc._parent.localToGlobal(_local4);
var _local3 = _local4.x;
if (_nOffsetX) {
_local3 = _local3 + _nOffsetX;
}
var _local2 = _local4.y;
if (_nOffsetY) {
_local2 = _local2 + _nOffsetY;
}
var _local7 = com.disney.gem.games.tirade.Controller.getInstance();
if (_local7.getControllerMode() == com.sarbakan.BaseDisneyController.nCONTROLLER_MODE_DXD) {
_local3 = _local3 - (com.disney.gem.games.tirade.Controller.getInstance().mcTimeline._parent._parent._parent._x + com.disney.gem.games.tirade.GameData.nDXD_STAGE_OFFSET_X);
_local2 = _local2 - (com.disney.gem.games.tirade.Controller.getInstance().mcTimeline._parent._parent._parent._y + com.disney.gem.games.tirade.GameData.nDXD_STAGE_OFFSET_Y);
}
var _local6 = _local3 + mc.mcState._width;
var _local5 = _local2 + mc.mcState._height;
return((((_local3 >= 0) && (_local3 <= com.disney.gem.games.tirade.GameData.nSTAGE_WIDTH)) && ((_local2 >= 0) && (_local2 <= com.disney.gem.games.tirade.GameData.nSTAGE_HEIGHT))) || (((_local6 >= 0) && (_local6 <= com.disney.gem.games.tirade.GameData.nSTAGE_WIDTH)) && ((_local5 >= 0) && (_local5 <= com.disney.gem.games.tirade.GameData.nSTAGE_HEIGHT))));
}
function enable() {
if (!isActive()) {
attachMC();
if (bKeepStateOnEnable && (sState != undefined)) {
setState(sState);
} else if (sNextState) {
setState(sNextState);
} else {
setState(DEFAULT_STATE);
}
updateState();
onEnable();
}
}
function disable() {
if (isActive()) {
detachMC();
onDisable();
}
}
function isActive() {
return(mc != undefined);
}
function pause() {
mc.mcState.stop();
}
function unpause() {
if (!bAnimStopped) {
mc.mcState.play();
}
}
function disablePause() {
bNoPause = true;
bAnimStopped = true;
}
function enablePause() {
bNoPause = false;
}
function stopOnLastFrame() {
mc.mcState.stop();
bAnimStopped = true;
}
function remove() {
bGarbaged = true;
disable();
if (!bStaticMovieClip) {
mc.removeMovieClip();
}
oOwner.removeDynamicElement(this);
}
function reset() {
}
function setMC(_mc) {
super.setMC(_mc);
if (sState) {
sNextState = sState;
} else {
sNextState = DEFAULT_STATE;
}
if (isActive()) {
updateState();
}
}
function attachMC() {
super.attachMC();
setState(DEFAULT_STATE);
}
function getElement(_sElementID) {
return(oOwner.oDynamicElements[_sElementID]);
}
function setState(_sState, _bInstant) {
sNextState = _sState;
if (_bInstant) {
updateState();
}
}
function getState() {
return(sState);
}
function stateStarting() {
return(mc.mcState._currentframe == 1);
}
function stateFinished() {
return(mc.mcState._currentframe == mc.mcState._totalframes);
}
function stateCurrentFrame() {
return(mc.mcState._currentframe);
}
function stateIs() {
var _local4 = false;
var _local3 = arguments.length - 1;
while (_local3 >= 0) {
if (arguments[_local3] == sState) {
_local4 = true;
break;
}
_local3--;
}
return(_local4);
}
function stateIsNot() {
var _local4 = false;
var _local3 = arguments.length - 1;
while (_local3 >= 0) {
if (arguments[_local3] == sState) {
_local4 = true;
break;
}
_local3--;
}
return(!_local4);
}
function getCoord() {
var _local2 = {};
if (mc != undefined) {
_local2.x = mc._x;
_local2.y = mc._y;
} else {
_local2.x = oAttachProperties._x;
_local2.y = oAttachProperties._y;
}
return(_local2);
}
function setCoord(_oPos) {
mc._x = _oPos.x;
mc._y = _oPos.y;
}
function teleportTo(_nX, _nY) {
if (isActive()) {
mc._x = _nX;
mc._y = _nY;
updatePosInActivation();
} else {
oAttachProperties._x = _nX;
oAttachProperties._y = _nY;
attachMC();
updatePosInActivation();
detachMC();
}
oOwner.updateActivation(true);
}
function getGlobalPos(_mc) {
var _local1 = new Object();
_local1.x = 0;
_local1.y = 0;
_local1.x = _mc._x;
_local1.y = _mc._y;
_mc._parent.localToGlobal(_local1);
return(_local1);
}
function collideWithMap(_sCollisionMapID) {
var _local3;
if (typeof(arguments[1]) == "movieclip") {
_local3 = getGlobalPos(arguments[1]);
} else if (typeof(arguments[1]) == "object") {
_local3 = arguments[1];
} else {
_local3 = getGlobalPos(mc);
}
return(oOwner.oCollisionMaps[_sCollisionMapID].mc.hitTest(_local3.x, _local3.y, true));
}
function collideWithElement(_sElementID) {
var _local3;
if (arguments[1]) {
_local3 = getGlobalPos(arguments[1]);
} else {
_local3 = getGlobalPos(mc);
}
return(oOwner.oDynamicElements[_sElementID].mc.hitTest(_local3.x, _local3.y, false));
}
function collideWithElementCollider(_sElementID, _sColliderID) {
var _local3 = oOwner.oDynamicElements[_sElementID].mc;
var _local2 = getGlobalPos(_local3[_sColliderID]);
return(mc.hitTest(_local2.x, _local2.y, false));
}
function collideWithElementBox(_sElementID) {
var _local3;
if (arguments[1]) {
_local3 = arguments[1];
} else {
_local3 = mc;
}
return(oOwner.oDynamicElements[_sElementID].mc.hitTest(_local3));
}
function onEnable() {
}
function onDisable() {
}
function updateState() {
if (sNextState != undefined) {
this[("state_" + sState) + "_end"]();
sState = sNextState;
sNextState = undefined;
mc.gotoAndStop(sState);
this[("state_" + sState) + "_init"]();
if (!bNoPause) {
bAnimStopped = false;
}
mc.mcState.oOwner = this;
mc.mcState.stopOnLastFrame = com.disney.gem.games.tirade.sarbakan.utils.Delegate.create(this, stopOnLastFrame);
}
this["state_" + sState]();
}
function updateMove() {
mc._x = nSpeedX + mc._x;
mc._y = nSpeedY + mc._y;
if ((!bAlwaysActive) && ((nSpeedX != 0) || (nSpeedY != 0))) {
bMoved = true;
}
}
function updatePosInActivation() {
if (bMoved) {
bMoved = false;
var _local2 = getGlobalPos(mc);
_local2.x = _local2.x + oOwner.getDisplacementX();
_local2.y = _local2.y + oOwner.getDisplacementY();
oOwner.oActivationManager.updateDynamicElement(this, _local2.x, _local2.y, mc._width, mc._height);
}
}
var DEFAULT_STATE = "idle";
}
Symbol 1593 MovieClip [__Packages.com.disney.gem.games.tirade.GameData] Frame 0
class com.disney.gem.games.tirade.GameData
{
function GameData () {
}
static var nKEYCODE_LEFT = 37;
static var nKEYCODE_RIGHT = 39;
static var nKEYCODE_JUMP = 38;
static var nKEYCODE_ATTACK = 32;
static var nTOTAL_LEVEL = 4;
static var nGAME_LIFE = 5;
static var nENERGY_FULL = 100;
static var nHURT_PLAYER_ENNEMY = 10;
static var nHURT_PLAYER_UNDEAD_BIG_ATTACK = 20;
static var nHURT_PLAYER_ARROW = 5;
static var nHURT_PLAYER_BOX = 5;
static var nHURT_PLAYER_BOOBYTRAP = 5;
static var nHURT_ENNEMY = 34;
static var nHURT_BOSS_UNDEAD = 10;
static var nHURT_BOSS_BARBOSSA = 10;
static var aPARALLAX_RATE_BG = [{x:0.5, y:0.57}, {x:0.55, y:0.49}, {x:0.69, y:0.7}, {x:0.5, y:0.7}];
static var nPARALLAX_RATE_GAME_X = 1;
static var nPARALLAX_RATE_GAME_Y = 1;
static var nPARALLAX_RATE_FG_X = 1;
static var nPARALLAX_RATE_FG_Y = 1;
static var nSCORE_GOLD = 50;
static var nSCORE_ENNEMY = 100;
static var nSCORE_LEVEL = 1000;
static var nVOLUME_MUSIC = 80;
static var nVOLUME_WILL_STEP = 280;
static var nVOLUME_WILL_JUMP = 150;
static var nVOLUME_WILL_LAND = 160;
static var nVOLUME_WILL_HURT = 270;
static var nVOLUME_WILL_HURT_IMPACT = 170;
static var nVOLUME_WILL_FALLBACK = 150;
static var nVOLUME_WILL_FALLBACK_MUSIC = 80;
static var nVOLUME_WILL_WATER = 100;
static var nVOLUME_SWORD = 130;
static var nVOLUME_SWORD_BLOCK = 100;
static var nVOLUME_PLATFORM_SHAKE = 100;
static var nVOLUME_PLATFORM_DESTROY = 100;
static var nVOLUME_PLATFORM_RESPAWN = 100;
static var nVOLUME_GOLD_BONUS = 300;
static var nVOLUME_BLOWPIPE = 100;
static var nVOLUME_BLOWPIPE_ARROW = 100;
static var nVOLUME_ELEVATOR = 70;
static var nVOLUME_BOOBYTRAP_OUT = 100;
static var nVOLUME_BOOBYTRAP_IN = 100;
static var nVOLUME_PLIERS_MOVE = 100;
static var nVOLUME_PLIERS_DROP = 100;
static var nVOLUME_BOX_LAND = 100;
static var nVOLUME_BOX_DESTROY = 80;
static var nVOLUME_BARBOSSA_DRAW_SWORD = 150;
static var nVOLUME_BARBOSSA_TAUNT = 140;
static var nVOLUME_BARBOSSA_SWITCH = 180;
static var nVOLUME_BARBOSSA_KICK = 150;
static var nVOLUME_HENCHMAN_TAUNT = 160;
static var nVOLUME_HENCHMAN_BONES = 250;
static var nVOLUME_UNDEAD_FLAIL_TURN = 250;
static var nVOLUME_UNDEAD_FLAIL_HIT = 100;
static var nVOLUME_UNDEAD_TAUNT = 140;
static var nVOLUME_DOOR = 200;
static var nVOLUME_BUTTON_ROLL = 200;
static var nVOLUME_BUTTON_CLICK = 200;
static var nVOLUME_TRANSITION = 200;
static var nSTAGE_WIDTH = 580;
static var nSTAGE_HEIGHT = 410;
static var nDXD_STAGE_OFFSET_X = 10;
static var nDXD_STAGE_OFFSET_Y = 50;
static var nCAMERA_SPEED_NORMAL = 6;
static var nCAMERA_SPEED_FAST = 10;
}
Symbol 1594 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.element.StaticElement] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.element.StaticElement extends com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement
{
var attachMC, detachMC, mc;
function StaticElement (_sID) {
super(_sID);
}
function enable() {
if (!isActive()) {
attachMC();
}
}
function disable() {
if (isActive()) {
detachMC();
}
}
function isActive() {
return(mc != undefined);
}
}
Symbol 1595 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.layer.CollisionMap] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.layer.CollisionMap
{
static var nDepth;
var id, oLayer, mc, nColor;
function CollisionMap (_sID, _oLayer, _nColor) {
if (!nDepth) {
nDepth = BASE_DEPTH;
}
id = _sID;
oLayer = _oLayer;
mc = oLayer.mc.createEmptyMovieClip(id, nDepth++);
mc._visible = false;
if (!_nColor) {
nColor = 16711935 /* 0xFF00FF */;
} else {
nColor = _nColor;
}
}
function show(_nAlpha) {
mc._visible = true;
if (_nAlpha) {
mc._alpha = _nAlpha;
} else {
mc._alpha = 100;
}
}
function hide() {
mc._visible = false;
mc._alpha = 100;
}
function drawRect(_nX, _nY, _nWidth, _nHeight) {
mc.moveTo(_nX, _nY);
mc.beginFill(nColor);
mc.lineTo(_nX + _nWidth, _nY);
mc.lineTo(_nX + _nWidth, _nY + _nHeight);
mc.lineTo(_nX, _nY + _nHeight);
mc.lineTo(_nX, _nY);
}
function setNewSource(_mcSource) {
remove();
mc = _mcSource;
mc._visible = false;
}
function attachMC(_sLinkage, _nX, _nY, _sName) {
if (!_sName) {
_sName = String(mc.getNextHighestDepth());
}
return(mc.attachMovie(_sLinkage, _sName, mc.getNextHighestDepth(), {_x:_nX, _y:_nY}));
}
function remove() {
mc.removeMovieClip();
}
function getMC() {
return(mc);
}
static var BASE_DEPTH = 64000;
}
Symbol 1596 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.PauseManager] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.PauseManager
{
static var oPausableList, bPaused;
function PauseManager (_mc) {
if (!oPausableList) {
reset();
}
register(_mc._parent);
_mc._visible = false;
_mc.swapDepths(999999);
_mc.removeMovieClip();
bPaused = false;
}
static function register(_mc) {
oPausableList[_mc] = _mc;
_mc.onUnload = function () {
com.disney.gem.games.tirade.sarbakan.visual.PauseManager.remove(this);
};
}
static function remove(_mc) {
delete oPausableList[_mc];
}
static function reset() {
oPausableList = {};
}
static function pause() {
for (var _local1 in oPausableList) {
oPausableList[_local1].stop();
}
bPaused = true;
}
static function unpause() {
for (var _local1 in oPausableList) {
oPausableList[_local1].play();
}
bPaused = false;
}
}
Symbol 1597 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.element.basicElement.Character] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.element.basicElement.Character extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var sFloorColliderID, sWallColliderID, sCeilingColliderID, sFrontColliderName, sBackColliderName, sBottomColliderName, sTopColliderName, nMoveSpeedX, nAirSpeedX, bNoFlip, nDirection, mc, setState, nSpeedX, nSpeedY, stateFinished, stateStarting, getGlobalPos, collideWithMap;
function Character (_sID) {
super(_sID);
sFloorColliderID = "floor";
sWallColliderID = "wall";
sCeilingColliderID = "ceiling";
sFrontColliderName = "front";
sBackColliderName = "back";
sBottomColliderName = "bottom";
sTopColliderName = "top";
nMoveSpeedX = nSPEED_RUN;
nAirSpeedX = nSPEED_AIR_MOVEX;
bNoFlip = false;
}
function setDirection(_nDirection) {
if ((_nDirection >= -1) && (_nDirection <= 1)) {
nDirection = _nDirection;
if (bNoFlip != true) {
mc._xscale = Math.abs(mc._xscale) * nDirection;
}
}
}
function getDirection() {
return(nDirection);
}
function initIdle() {
setState("idle");
}
function state_idle() {
nSpeedX = 0;
nSpeedY = 0;
checkFall();
setPositionOutFloor();
}
function state_run() {
nSpeedX = nMoveSpeedX * nDirection;
nSpeedY = 0;
checkFall();
setPositionOutFloor();
checkWall();
}
function state_jumpSwitch() {
if (stateFinished()) {
setState("jumpFall");
}
}
function state_jumpFall(_bSkipFirstFrameCheck) {
if ((!_bSkipFirstFrameCheck) && (stateStarting())) {
nSpeedY = 1;
}
if (stateFinished()) {
mc.mcState.stop();
}
nSpeedY = nSpeedY + (nSpeedY * nGRAVITY);
if (nSpeedY > nSPEED_FALL) {
nSpeedY = nSPEED_FALL;
}
if (isOnGround()) {
setPositionOutFloor();
setState("jumpLand");
} else if (nSpeedX != 0) {
nSpeedX = nDirection * nAirSpeedX;
}
checkWall();
}
function state_jumpLand() {
nSpeedX = 0;
nSpeedY = 0;
if (stateFinished()) {
initIdle();
setPositionOutFloor();
}
}
function state_jump() {
if (stateStarting()) {
nAirSpeedX = nSPEED_AIR_MOVEX;
nSpeedY = nJUMP_FORCE;
} else {
nSpeedY = nSpeedY - (nSpeedY * nGRAVITY);
if (nSpeedX != 0) {
nSpeedX = nDirection * nAirSpeedX;
}
if (nSpeedY > -1) {
setState("jumpSwitch");
}
}
if (nSpeedY <= -1) {
checkCeiling();
}
checkWall();
}
function state_jumpStart() {
if (stateFinished()) {
setState("jump");
}
}
function onEnable() {
setDirection(nDirection);
}
function checkFall() {
var _local2 = mc._y;
while (!isOnGround()) {
mc._y = mc._y + nADJUST_FLOOR;
if ((mc._y - _local2) > nDISTANCE_FALL) {
setState("jumpFall");
break;
}
nSpeedY = mc._y - _local2;
}
if (mc._y != _local2) {
mc._y = _local2;
return(false);
}
return(true);
}
function checkWall() {
if (isHittingWall()) {
nSpeedX = 0;
}
}
function checkCeiling() {
if (isHittingCeiling()) {
nSpeedY = 0;
setState("jumpFall");
}
}
function isOnGround() {
var _local2 = getGlobalPos(mc[sBottomColliderName]);
return(collideWithMap(sFloorColliderID, {x:Math.round(_local2.x + nSpeedX), y:Math.round(_local2.y + nSpeedY)}));
}
function isHittingWall() {
var _local2;
_local2 = getGlobalPos(mc[sFrontColliderName]);
if (collideWithMap(sWallColliderID, {x:_local2.x + nSpeedX, y:_local2.y + nSpeedY})) {
return(-1);
}
if (sBackColliderName) {
_local2 = getGlobalPos(mc[sBackColliderName]);
if (collideWithMap(sWallColliderID, {x:_local2.x + nSpeedX, y:_local2.y + nSpeedY})) {
return(1);
}
}
}
function isHittingCeiling() {
var _local3 = false;
if (sTopColliderName) {
var _local2;
_local2 = getGlobalPos(mc[sTopColliderName]);
if (collideWithMap(sCeilingColliderID, {x:_local2.x + nSpeedX, y:_local2.y + nSpeedY})) {
_local3 = true;
}
}
return(_local3);
}
function setPositionOutFloor() {
while (isOnGround()) {
nSpeedY--;
}
}
function setPositionInFloor() {
while (!isOnGround()) {
nSpeedY++;
}
}
function setPositionOutWall() {
var _local3;
var _local2 = 0;
while (_local2 < 15) {
_local3 = isHittingWall();
nSpeedX = nSpeedX + (_local3 * (mc._xscale / Math.abs(mc._xscale)));
_local2++;
}
}
var nADJUST_FLOOR = 1;
var nDISTANCE_FALL = 8;
var nJUMP_FORCE = -20;
var nGRAVITY = 0.2;
var nSPEED_RUN = 3;
var nSPEED_FALL = 10;
var nSPEED_AIR_MOVEX = 3;
}
Symbol 1598 MovieClip [__Packages.com.disney.gem.games.tirade.elements.characters.Player] Frame 0
class com.disney.gem.games.tirade.elements.characters.Player extends com.disney.gem.games.tirade.sarbakan.visual.element.basicElement.Character
{
var setLinkage, setMC, setDirection, nCamOffsetHorizontal, sBackColliderName, nMoveSpeedX, nRunFullSpeedCount, nEnergy, bMustReleaseAttackKey, bControlsLock, removeReferenceMC, attachMC, mc, bFirstRespawnPoint, nRespawnX, nRespawnY, setState, bInvincible, nCustomPushBackSpeed, bInAirHurt, bDieFall, sState, nDirection, bKickedDownstairs, stateIs, oCamOffsetHorizontalTween, bSwitchDirection, nDirectionSwitchCount, nSpeedX, nSpeedY, stateCurrentFrame, stateFinished, checkFall, setPositionOutFloor, checkWall, stateStarting, bJumpAttacked, nFallDistance, isOnGround, nDirectionLast, nAirSpeedX, nInvincibleDelayCount;
function Player (_mc) {
super("player");
setLinkage("mcPlayer");
setMC(_mc);
setDirection(1);
nCamOffsetHorizontal = (nCAM_OFFSET_HORIZONTAL_MIN + nCAM_OFFSET_HORIZONTAL_MAX) / 2;
delete sBackColliderName;
nMoveSpeedX = nSPEED_RUN;
nRunFullSpeedCount = 0;
nEnergy = com.disney.gem.games.tirade.GameData.nENERGY_FULL;
bMustReleaseAttackKey = false;
bControlsLock = true;
}
function init() {
removeReferenceMC();
attachMC();
setRespawnLocation(mc._x, mc._y);
bFirstRespawnPoint = true;
}
function update() {
super.update();
updateCamOffset();
updateInvincibility();
mc.swapDepths(mc._parent.getNextHighestDepth());
if (bMustReleaseAttackKey && (!Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_ATTACK))) {
bMustReleaseAttackKey = false;
}
}
function getCoord() {
var _local3 = super.getCoord();
return({x:_local3.x - nCamOffsetHorizontal, y:_local3.y - nCAM_OFFSET_VERTICAL});
}
function setRespawnLocation(_nX, _nY) {
nRespawnX = _nX;
nRespawnY = _nY;
bFirstRespawnPoint = false;
}
function respawn() {
nEnergy = com.disney.gem.games.tirade.GameData.nENERGY_FULL;
mc._x = nRespawnX;
mc._y = nRespawnY;
var _local2 = com.disney.gem.games.tirade.Controller.getInstance().oGame.oCam;
if (bFirstRespawnPoint) {
_local2.resetPosition();
com.disney.gem.games.tirade.Controller.getInstance().oGame.oView.updateCameraPosition();
}
_local2.lockOn(com.disney.gem.games.tirade.sarbakan.utils.Delegate.create(this, getCoord), true);
setState(sSTATE_IDLE, true);
setDirection(1);
startInvincibility();
com.disney.gem.games.tirade.elements.characters.BossBarbossa.oLastInstance.resetEnergy();
com.disney.gem.games.tirade.elements.characters.BossUndead.oLastInstance.resetEnergy();
}
function hurt(_nEnergy, _nCustomPushBackSpeed) {
if ((!isHurt()) && (!bInvincible)) {
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Hurt_impact.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_HURT_IMPACT);
nEnergy = nEnergy - _nEnergy;
nCustomPushBackSpeed = _nCustomPushBackSpeed;
if (nEnergy > 0) {
if (isJumping()) {
bInAirHurt = true;
}
setState(sSTATE_HURT, true);
startInvincibility();
} else {
die();
}
}
}
function die(_bNoFall) {
if (_bNoFall) {
bDieFall = false;
} else {
bDieFall = true;
}
nEnergy = 0;
setState(sSTATE_DIE_START);
}
function dieWater() {
if (sState != sSTATE_DIE_WATER) {
setState(sSTATE_DIE_WATER);
}
}
function autoDefend() {
setDirection(nDirection * -1);
setState(sSTATE_BLOCK);
}
function kickDownstairs() {
com.disney.gem.games.tirade.Controller.getInstance().oGame.setFastCamSpeed();
bKickedDownstairs = true;
setState(sSTATE_DIE_START);
}
function isJumping() {
return(stateIs(sSTATE_JUMP, sSTATE_JUMP_ATTACK, sSTATE_JUMP_FALL, sSTATE_JUMP_SWITCH));
}
function isHurt() {
return(stateIs(sSTATE_HURT, sSTATE_DIE_END, sSTATE_DIE_FALL, sSTATE_DIE_RESURECT, sSTATE_DIE_START));
}
function isAttacking() {
return(stateIs(sSTATE_ATTACK1, sSTATE_ATTACK2, sSTATE_JUMP_ATTACK));
}
function isDieing() {
return(stateIs(sSTATE_DIE_END, sSTATE_DIE_FALL, sSTATE_DIE_START, sSTATE_DIE_WATER));
}
function onOffsetTweenEnd() {
delete oCamOffsetHorizontalTween;
}
function state_idle_init() {
if (bSwitchDirection) {
setDirection(nDirection * -1);
bSwitchDirection = false;
}
}
function state_idle(_bSkipKeyCheck) {
super.state_idle();
if (!_bSkipKeyCheck) {
checkIdleControl();
}
}
function state_run_init() {
state_idle_init();
nRunFullSpeedCount = 0;
nDirectionSwitchCount = 0;
nSpeedX = 0;
nSpeedY = 0;
nMoveSpeedX = 1;
}
function state_run() {
if ((stateCurrentFrame() == nRUN_FRAME_STEP1) || (stateCurrentFrame() == nRUN_FRAME_STEP2)) {
com.sarbakan.sound.SoundManager.doPlaySound(("Will_Turner_Step_" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 5)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_STEP);
}
if (nMoveSpeedX < nSPEED_RUN) {
nMoveSpeedX = nMoveSpeedX * nRUN_ACEL_RATE;
nMoveSpeedX = Math.min(nMoveSpeedX, nSPEED_RUN);
} else {
nRunFullSpeedCount++;
}
super.state_run();
checkRunControl();
}
function state_turn_init() {
nSpeedX = 0;
nSpeedY = 0;
}
function state_turn() {
if (stateFinished()) {
if (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_LEFT) || (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_RIGHT))) {
setState(sSTATE_RUN);
} else {
setState(sSTATE_IDLE);
}
bSwitchDirection = true;
}
checkFall();
setPositionOutFloor();
}
function state_runStop() {
checkIdleControl();
nSpeedX = nSpeedX / nRUN_DECEL_RATE;
if (stateFinished()) {
setState(sSTATE_IDLE);
}
checkFall();
checkWall();
setPositionOutFloor();
}
function state_jump() {
super.state_jump();
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Jump.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_JUMP);
if (nRunFullSpeedCount >= nBIG_JUMP_RUN_FRAME_NEEDED) {
nSpeedY = nJUMP_FORCE_BIG;
}
}
if (stateFinished()) {
mc.mcState.stop();
}
checkAirControl();
}
function state_jumpSwitch() {
super.state_jumpSwitch();
if (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_ATTACK)) {
attack();
}
}
function state_jumpAttack() {
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound(("Sword_Swing" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 4)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_SWORD);
}
if (stateFinished()) {
mc.gotoAndStop(sSTATE_JUMP_FALL);
mc.mcState.gotoAndStop(2);
sState = sSTATE_JUMP_FALL;
}
state_jumpFall(bJumpAttacked);
bJumpAttacked = true;
}
function state_jumpFall_init() {
nFallDistance = 0;
}
function state_jumpFall(_bSkipFirstFrameCheck) {
super.state_jumpFall(_bSkipFirstFrameCheck);
nFallDistance = nFallDistance + nSpeedY;
checkAirControl();
}
function state_jumpLand() {
bJumpAttacked = false;
nRunFullSpeedCount = 0;
if (stateStarting()) {
delete sBackColliderName;
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Land.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_LAND);
}
if (nFallDistance < nJUMP_FALL_DISTANCE_LAND) {
setState(sSTATE_IDLE);
} else {
super.state_jumpLand();
state_idle(true);
}
}
function state_attack1() {
state_idle(true);
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound(("Sword_Swing" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 4)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_SWORD);
}
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function state_attack2() {
state_attack1();
}
function state_block() {
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound(("Sword_Swing_Tching" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 3)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_SWORD_BLOCK);
}
state_attack1();
}
function state_hurt_init() {
sBackColliderName = "back";
}
function state_hurt() {
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound(("Will_Turner_Hurt" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 2)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_HURT);
}
if (bInAirHurt) {
state_jumpFall();
} else {
state_idle(true);
}
if (nCustomPushBackSpeed) {
nSpeedX = nCustomPushBackSpeed;
} else {
nSpeedX = nPUSHBACK_SPEED * (-nDirection);
}
if (stateFinished()) {
if (bInAirHurt) {
setState(sSTATE_JUMP_FALL);
} else {
setState(sSTATE_IDLE);
}
bInAirHurt = false;
}
checkWall();
if (stateFinished()) {
delete sBackColliderName;
}
}
function state_dieStart_init() {
if (bKickedDownstairs) {
nSpeedX = (nKICKED_DOWNSTAIRS_SPEEDX_BASE * (mc._x / nKICKED_DOWNSTAIRS_FLOOR_X_START)) + nKICKED_DOWNSTAIRS_SPEEDX_MIN;
nSpeedY = nKICKED_DOWNSTAIRS_SPEEDY_BASE;
} else {
nSpeedX = 0;
nSpeedY = 0;
}
}
function state_dieStart() {
if (bDieFall || (bKickedDownstairs)) {
sBackColliderName = "back";
if (stateFinished()) {
setState(sSTATE_DIE_FALL);
}
} else if (stateFinished()) {
setState(sSTATE_DIE_END);
}
}
function state_dieFall_init() {
if (!bKickedDownstairs) {
nSpeedX = nSpeedX * -1;
nSpeedY = 9;
} else {
nSpeedY = 15;
}
}
function state_dieFall() {
if (bKickedDownstairs && (mc._x < nKICKED_DOWNSTAIRS_FLOOR_X_END)) {
nSpeedX = nKICKED_DOWNSTAIRS_SPEEDX_MIN;
}
checkWall();
if (isOnGround()) {
setPositionOutFloor();
setState(sSTATE_DIE_END);
bDieFall = false;
}
}
function state_dieEnd() {
nSpeedX = 0;
nSpeedY = 0;
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Fall_Back.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_FALLBACK);
if (bKickedDownstairs) {
com.disney.gem.games.tirade.elements.Box.breakAll();
} else {
com.disney.gem.games.tirade.Controller.getInstance().stopMusic();
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Fall_Back_music.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_FALLBACK_MUSIC, 1, true);
}
}
setPositionOutFloor();
if (stateFinished()) {
com.disney.gem.games.tirade.Controller.getInstance().oGame.setNormalCamSpeed();
if (bKickedDownstairs) {
bKickedDownstairs = false;
setState(sSTATE_DIE_RESURECT);
} else {
com.disney.gem.games.tirade.Controller.getInstance().onDie();
}
mc.mcState.stop();
}
}
function state_dieResurect() {
state_idle(true);
if (stateCurrentFrame() == nDIE_RESURECT_FRAME_UP) {
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Land.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_LAND);
}
if (stateFinished()) {
delete sBackColliderName;
setState(sSTATE_IDLE);
startInvincibility();
}
}
function state_dieWater() {
nSpeedX = 0;
nSpeedY = 0;
if (stateStarting()) {
com.disney.gem.games.tirade.Controller.getInstance().stopMusic();
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Fall_Back_music.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_FALLBACK_MUSIC, 1, true);
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Fall_Water.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_WATER);
}
if (stateFinished()) {
com.disney.gem.games.tirade.Controller.getInstance().onDie();
mc.mcState.stop();
}
}
function updateCamOffset() {
if (nDirection != nDirectionLast) {
var _local2;
if (nDirection == 1) {
_local2 = nCAM_OFFSET_HORIZONTAL_MIN;
} else {
_local2 = nCAM_OFFSET_HORIZONTAL_MAX;
}
if (oCamOffsetHorizontalTween == undefined) {
oCamOffsetHorizontalTween = new mx.transitions.Tween(this, "nCamOffsetHorizontal", mx.transitions.easing.Regular.easeInOut, nCamOffsetHorizontal, _local2, nCAM_OFFSET_HORIZONTAL_DURATION);
oCamOffsetHorizontalTween.onMotionFinished = com.disney.gem.games.tirade.sarbakan.utils.Delegate.create(this, onOffsetTweenEnd);
} else {
oCamOffsetHorizontalTween.continueTo(_local2, 20);
}
}
nDirectionLast = nDirection;
}
function checkIdleControl() {
if (bControlsLock == false) {
if (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_LEFT)) {
if (nDirection == 1) {
setState(sSTATE_TURN);
} else {
setState(sSTATE_RUN);
}
} else if (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_RIGHT)) {
if (nDirection == -1) {
setState(sSTATE_TURN);
} else {
setState(sSTATE_RUN);
}
}
if (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_JUMP)) {
setState(sSTATE_JUMP);
}
if (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_ATTACK)) {
attack();
}
}
}
function checkRunControl() {
if (bControlsLock == false) {
if ((++nDirectionSwitchCount) == nRUN_SWITCH_DIRECTION_DELAY) {
if (((nDirection == 1) && (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_LEFT))) && (!Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_RIGHT))) {
setDirection(-1);
} else if (((nDirection == -1) && (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_RIGHT))) && (!Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_LEFT))) {
setDirection(1);
}
nDirectionSwitchCount = 0;
}
if ((!Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_LEFT)) && (!Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_RIGHT))) {
nRunFullSpeedCount = 0;
setState(sSTATE_RUN_STOP);
}
if (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_JUMP)) {
setState(sSTATE_JUMP);
}
if (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_ATTACK)) {
attack();
}
} else {
nRunFullSpeedCount = 0;
setState(sSTATE_RUN_STOP);
}
}
function checkAirControl() {
if (bControlsLock == false) {
if ((!Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_LEFT)) && (!Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_RIGHT))) {
nAirSpeedX = 0;
}
if ((nDirection == 1) && (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_LEFT))) {
setDirection(-1);
}
if ((nDirection == -1) && (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_RIGHT))) {
setDirection(1);
}
if ((Math.abs(nSpeedX) < nSPEED_AIR_MOVEX) && (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_LEFT) || (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_RIGHT)))) {
if (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_RIGHT)) {
setDirection(1);
} else {
setDirection(-1);
}
nSpeedX = nDirection * nSPEED_AIR_MOVEX;
checkWall();
}
if ((!isAttacking()) && (Key.isDown(com.disney.gem.games.tirade.GameData.nKEYCODE_ATTACK))) {
attack();
}
} else {
nAirSpeedX = 0;
}
}
function attack() {
if (!bMustReleaseAttackKey) {
bMustReleaseAttackKey = true;
if (isJumping()) {
if (!bJumpAttacked) {
setState(sSTATE_JUMP_ATTACK);
}
} else if (Math.random() < 0.5) {
setState(sSTATE_ATTACK1);
} else {
setState(sSTATE_ATTACK2);
}
}
}
function startInvincibility() {
bInvincible = true;
nInvincibleDelayCount = 0;
}
function endInvincibility() {
mc._visible = true;
bInvincible = false;
}
function updateInvincibility() {
if (bInvincible && (!isHurt())) {
if ((++nInvincibleDelayCount) == nINVINCIBLE_DELAY) {
endInvincibility();
} else if ((nInvincibleDelayCount % nINVINCIBLE_FLASH_RATE) == 1) {
if (mc._visible) {
mc._visible = false;
} else {
mc._visible = true;
}
}
} else {
mc._visible = true;
}
}
var nJUMP_FORCE = -20;
var nJUMP_FORCE_BIG = -27;
var nGRAVITY = 0.2;
var nSPEED_RUN = 10;
var nSPEED_FALL = 10;
var nSPEED_AIR_MOVEX = 6;
static var nPUSHBACK_SPEED = 3;
static var nRUN_ACEL_RATE = 1.7;
static var nRUN_DECEL_RATE = 1.3;
static var nBIG_JUMP_RUN_FRAME_NEEDED = 10;
static var nJUMP_FALL_DISTANCE_LAND = 200;
static var nCAM_OFFSET_HORIZONTAL_MIN = 220;
static var nCAM_OFFSET_HORIZONTAL_MAX = 360;
static var nCAM_OFFSET_HORIZONTAL_DURATION = 20;
static var nCAM_OFFSET_VERTICAL = 300;
static var nINVINCIBLE_DELAY = 40;
static var nINVINCIBLE_FLASH_RATE = 2;
var nKICKED_DOWNSTAIRS_SPEEDX_BASE = -25;
var nKICKED_DOWNSTAIRS_SPEEDX_MIN = -10;
var nKICKED_DOWNSTAIRS_SPEEDY_BASE = -9;
var nKICKED_DOWNSTAIRS_FLOOR_X_START = 800;
var nKICKED_DOWNSTAIRS_FLOOR_X_END = 500;
var nRUN_SWITCH_DIRECTION_DELAY = 5;
static var nRUN_FRAME_STEP1 = 9;
static var nRUN_FRAME_STEP2 = 21;
static var nDIE_RESURECT_FRAME_UP = 12;
static var sSTATE_IDLE = "idle";
static var sSTATE_RUN_START = "runStart";
static var sSTATE_RUN = "run";
static var sSTATE_RUN_STOP = "runStop";
static var sSTATE_TURN = "turn";
static var sSTATE_JUMP = "jump";
static var sSTATE_JUMP_ATTACK = "jumpAttack";
static var sSTATE_JUMP_SWITCH = "jumpSwitch";
static var sSTATE_JUMP_FALL = "jumpFall";
static var sSTATE_ATTACK1 = "attack1";
static var sSTATE_ATTACK2 = "attack2";
static var sSTATE_BLOCK = "block";
static var sSTATE_HURT = "hurt";
static var sSTATE_DIE_START = "dieStart";
static var sSTATE_DIE_FALL = "dieFall";
static var sSTATE_DIE_END = "dieEnd";
static var sSTATE_DIE_RESURECT = "dieResurect";
static var sSTATE_DIE_WATER = "dieWater";
}
Symbol 1599 MovieClip [__Packages.com.disney.gem.games.tirade.elements.characters.BaseEnnemy] Frame 0
class com.disney.gem.games.tirade.elements.characters.BaseEnnemy extends com.disney.gem.games.tirade.sarbakan.visual.element.basicElement.Character
{
var setMC, setDirection, mc, oDecisionMaker, id, removeReferenceMC, attachMC, oPlayer, getElement, nAttackDelayCount, stateIsNot, nEnergy, fTurnCallBack, setState, bAttackBlocked, bCanJump, fJumpCallBack, nDirection, nMoveSpeedX, bNoFlip, stateIs, bSwitchDirection, nSpeedX, nSpeedY, stateFinished, stateStarting, stateCurrentFrame, sElevatorID, sBackColliderName, collideWithMap, sFloorColliderID;
function BaseEnnemy (_mc) {
super("ennemy" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setMC(_mc);
setDirection(1);
if (mc._name.substr(0, 8) != "instance") {
associateToElevator(mc._name);
}
oDecisionMaker = new com.disney.gem.games.tirade.sarbakan.ai.DecisionMaker(this, id);
resetEnergy();
}
function init() {
removeReferenceMC();
attachMC();
oPlayer = getElement("player");
nAttackDelayCount = 0;
}
function update() {
super.update();
if (((stateIsNot("hurt") && (!isJumping())) && (!oDecisionMaker.isEmpty())) && (oDecisionMaker.isDecisionCompleted())) {
oDecisionMaker.makeDecision();
}
if (nAttackDelayCount < nATTACK_DELAY) {
nAttackDelayCount++;
}
checkHurt();
}
function resetEnergy() {
nEnergy = com.disney.gem.games.tirade.GameData.nENERGY_FULL;
}
function initTurn(_fCallBack) {
fTurnCallBack = _fCallBack;
setState(sSTATE_TURN);
}
function initAttack() {
setState(sSTATE_ATTACK);
bAttackBlocked = false;
}
function initHurt(_nEnergy) {
if (!isHurt()) {
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Hurt_impact.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_HURT_IMPACT);
nEnergy = nEnergy - _nEnergy;
if (nEnergy > 0) {
setState(sSTATE_HURT);
} else {
initDie();
}
}
}
function initDie() {
setState(sSTATE_DIE);
}
function initJump(_fJumpCallBack) {
if (bCanJump) {
fJumpCallBack = _fJumpCallBack;
setState(sSTATE_JUMP);
}
}
function initBlock() {
setState(sSTATE_BLOCK, true);
if (!isLookingAtPlayer()) {
setDirection(nDirection * -1);
}
}
function initWalkBackward() {
nMoveSpeedX = nMoveSpeedX * 1.5;
setState(sSTATE_RUN);
bNoFlip = true;
setDirection(oPlayer.nDirection);
}
function endWalkBackward() {
bNoFlip = false;
nMoveSpeedX = nMoveSpeedX / 1.5;
setDirection(nDirection * -1);
}
function isOnPlayerFloor() {
var _local2 = Math.abs(mc._y - oPlayer.mc._y);
return((!oPlayer.isJumping()) && (_local2 <= nDISTANCE_FLOOR));
}
function isNearPlayer(_nDistance, _bAllowInAir) {
var _local2 = Math.abs(mc._x - oPlayer.mc._x);
if (_nDistance == undefined) {
_nDistance = nDISTANCE_NEAR;
}
return((_local2 <= _nDistance) && (_bAllowInAir || (isOnPlayerFloor())));
}
function isHurt() {
return(stateIs(sSTATE_HURT, sSTATE_DIE));
}
function isAttacked() {
return(oPlayer.isAttacking() && (isNearPlayer(nDISTANCE_NEAR * 1.5)));
}
function isJumping() {
return(stateIs(sSTATE_JUMP, sSTATE_JUMP_FALL, sSTATE_JUMP_SWITCH, sSTATE_JUMP_LAND));
}
function isLookingAtPlayer() {
return(((nDirection == 1) && (mc._x <= oPlayer.mc._x)) || ((nDirection == -1) && (mc._x >= oPlayer.mc._x)));
}
function isPlayerLookingAtEnnemy() {
return(((oPlayer.nDirection == 1) && (oPlayer.mc._x <= mc._x)) || ((oPlayer.nDirection == -1) && (oPlayer.mc._x >= mc._x)));
}
function canAttack() {
return((stateIs(sSTATE_IDLE, sSTATE_RUN) && (isNearPlayer())) && (nAttackDelayCount == nATTACK_DELAY));
}
function onEnable() {
if (nEnergy <= 0) {
setState(sSTATE_DEAD);
}
}
function state_idle_init() {
if (bSwitchDirection) {
setDirection(nDirection * -1);
bSwitchDirection = false;
if (fTurnCallBack) {
fTurnCallBack();
fTurnCallBack = null;
}
}
}
function state_idle() {
if (bCanJump) {
super.state_idle();
} else {
nSpeedX = 0;
nSpeedY = 0;
}
}
function state_run() {
if (bCanJump) {
super.state_run();
} else {
nSpeedX = nMoveSpeedX * nDirection;
nSpeedY = 0;
checkWall();
}
if (isOnFloorEgde()) {
nSpeedX = 0;
}
}
function state_turn() {
nSpeedX = 0;
nSpeedY = 0;
if (stateFinished()) {
setState(sSTATE_IDLE);
bSwitchDirection = true;
}
}
function state_attack_init() {
nSpeedX = 0;
nSpeedY = 0;
com.sarbakan.sound.SoundManager.doPlaySound(("Sword_Swing_Big" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 3)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_SWORD);
}
function state_attack() {
if (((!bAttackBlocked) && (oPlayer.isAttacking())) && (mc.hitTest(oPlayer.mc.sword))) {
oPlayer.setState(com.disney.gem.games.tirade.elements.characters.Player.sSTATE_BLOCK);
bAttackBlocked = true;
nSpeedX = nPUSHBACK_SPEED * (-nDirection);
} else if (((!bAttackBlocked) && (oPlayer.isAttacking())) && (mc.hitTest(oPlayer.mc.autoDefense))) {
oPlayer.autoDefend();
bAttackBlocked = true;
nSpeedX = nPUSHBACK_SPEED * (-nDirection);
} else if ((!bAttackBlocked) && (mc.sword.hitTest(oPlayer.mc.body))) {
oPlayer.hurt(com.disney.gem.games.tirade.GameData.nHURT_PLAYER_ENNEMY);
}
if (isOnFloorEgde(true) || (isOnFloorEgde(false, true))) {
nSpeedX = 0;
}
checkWall();
if (stateFinished()) {
bAttackBlocked = false;
nAttackDelayCount = 0;
setState(sSTATE_IDLE);
}
}
function state_block() {
nSpeedX = 0;
nSpeedY = 0;
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound(("Sword_Swing_Tching" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 3)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_SWORD_BLOCK);
}
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function state_hurt_init() {
bNoFlip = true;
setDirection(oPlayer.nDirection);
nSpeedX = nPUSHBACK_SPEED * nDirection;
}
function state_hurt(_bNoLookTowardPlayer) {
checkWall();
if (isOnFloorEgde(true) || (isOnFloorEgde(false, true))) {
nSpeedX = 0;
}
if (stateFinished()) {
bNoFlip = false;
nSpeedX = 0;
if ((!_bNoLookTowardPlayer) && (!isLookingAtPlayer())) {
setDirection(nDirection * -1);
}
setState(sSTATE_IDLE);
oDecisionMaker.abortCurrentDecision();
setBehaviorDefensive();
oDecisionMaker.makeDecision();
setBehaviorRegular();
}
}
function state_die_init() {
oDecisionMaker.clear();
}
function state_die() {
nSpeedX = 0;
nSpeedY = 0;
if (stateCurrentFrame() == nDIE_FRAME_SOUND) {
com.sarbakan.sound.SoundManager.doPlaySound("bones.wav", com.disney.gem.games.tirade.GameData.nVOLUME_HENCHMAN_BONES);
}
if (stateFinished()) {
if (sElevatorID) {
com.disney.gem.games.tirade.elements.Elevator.onAssociatedEnnemyDead(sElevatorID);
}
com.disney.gem.games.tirade.Controller.getInstance().increaseScore(com.disney.gem.games.tirade.GameData.nSCORE_ENNEMY);
setState(sSTATE_DEAD);
}
}
function state_dead() {
nSpeedX = 0;
nSpeedY = 0;
oDecisionMaker.clear();
}
function state_jump() {
super.state_jump();
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Jump.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_JUMP);
}
if (stateFinished()) {
mc.mcState.stop();
}
}
function state_jumpLand() {
super.state_jumpLand();
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Land.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_LAND);
}
fJumpCallBack();
}
function state_taunt() {
nSpeedX = 0;
nSpeedY = 0;
if (stateCurrentFrame() == nFRAME_TAUNT_SOUND) {
com.sarbakan.sound.SoundManager.doPlaySound(("Ennemy_Taunt_" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 3)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_HENCHMAN_TAUNT);
}
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function setBehaviorRegular() {
}
function setBehaviorDefensive() {
}
function getHurtValue() {
return(com.disney.gem.games.tirade.GameData.nHURT_ENNEMY);
}
function associateToElevator(_sElevatorID) {
sElevatorID = _sElevatorID;
}
function checkHurt() {
if (((stateIsNot(sSTATE_DIE, sSTATE_DEAD, sSTATE_HURT) && (oPlayer.isAttacking())) && (mc.hitTest(oPlayer.mc.sword))) && (!bAttackBlocked)) {
if (stateIs(sSTATE_IDLE, sSTATE_RUN, sSTATE_ATTACK) && (isLookingAtPlayer())) {
oDecisionMaker.abortCurrentDecision();
oDecisionMaker.makeDecision();
}
if (stateIsNot(sSTATE_BLOCK)) {
initHurt(getHurtValue());
}
}
}
function checkWall() {
if (bNoFlip || (((nDirection == 1) && (nSpeedX < 0)) || ((nDirection == -1) && (nSpeedX > 0)))) {
sBackColliderName = "back";
} else {
sBackColliderName = undefined;
}
super.checkWall();
}
function isOnFloorEgde(_bCheckBack, _bCheckFront) {
var _local2;
if ((!_bCheckFront) && (bNoFlip || (_bCheckBack))) {
_local2 = mc.backEdge;
} else {
_local2 = mc.frontEdge;
}
return(!collideWithMap(sFloorColliderID, _local2));
}
var nSPEED_RUN = 5;
static var nPUSHBACK_SPEED = 4;
var nDISTANCE_FLOOR = 100;
var nDISTANCE_NEAR = 150;
var nATTACK_DELAY = 60;
static var nDIE_FRAME_SOUND = 18;
var nFRAME_TAUNT_SOUND = 1;
static var sSTATE_IDLE = "idle";
static var sSTATE_RUN_START = "runStart";
static var sSTATE_RUN = "run";
static var sSTATE_TURN = "turn";
static var sSTATE_ATTACK = "attack";
static var sSTATE_HURT = "hurt";
static var sSTATE_DIE = "die";
static var sSTATE_DEAD = "dead";
static var sSTATE_JUMP = "jump";
static var sSTATE_JUMP_SWITCH = "jumpSwitch";
static var sSTATE_JUMP_FALL = "jumpFall";
static var sSTATE_JUMP_LAND = "jumpLand";
static var sSTATE_TAUNT = "taunt";
static var sSTATE_BLOCK = "block";
}
Symbol 1600 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.ai.DecisionMaker] Frame 0
class com.disney.gem.games.tirade.sarbakan.ai.DecisionMaker
{
var oOwner, sOwner, aDecisionList, bDebug, oCurrentDecision;
function DecisionMaker (_oOwner, _sOwner) {
oOwner = _oOwner;
sOwner = _sOwner;
clear();
}
function addDecision(_oDecision) {
_oDecision.setOwner(oOwner);
aDecisionList.push(_oDecision);
}
function addDecisionFirst(_oDecision) {
aDecisionList.unshift(_oDecision);
}
function removeDecision(_sType) {
var _local2 = aDecisionList.length - 1;
while (_local2 >= 0) {
if (aDecisionList[_local2].getType() == _sType) {
aDecisionList.splice(_local2, 1);
}
_local2--;
}
}
function makeDecision() {
var _local3;
if (bDebug) {
trace(sOwner + " is making a decision:");
}
if (isEmpty()) {
if (bDebug) {
trace("\tDecision list is empty!");
}
} else {
var _local2 = 0;
while (_local2 < aDecisionList.length) {
_local3 = aDecisionList[_local2];
if (_local3.make()) {
if (bDebug) {
trace("\t" + _local3);
}
break;
}
_local2++;
}
}
oCurrentDecision = _local3;
return(_local3.getType());
}
function isDecisionCompleted() {
var _local2 = true;
if (oCurrentDecision != undefined) {
_local2 = oCurrentDecision.isCompleted();
}
return(_local2);
}
function abortCurrentDecision() {
oCurrentDecision.abort();
}
function getCurrentDecision() {
return(oCurrentDecision);
}
function clear() {
aDecisionList = [];
}
function isEmpty() {
return(aDecisionList.length < 1);
}
function enableDebug() {
bDebug = true;
}
function disableDebug() {
bDebug = false;
}
function traceDecisionList() {
trace(("Decision list for " + sOwner) + ":");
var _local2 = 0;
while (_local2 < aDecisionList.length) {
trace("\t" + aDecisionList[_local2]);
_local2++;
}
}
}
Symbol 1601 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.ai.Decision] Frame 0
class com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var oOwner, bDecisionMade;
function Decision () {
}
function setOwner(_oOwner) {
oOwner = _oOwner;
}
function make() {
bDecisionMade = false;
checkConditions();
return(bDecisionMade);
}
function getType() {
return(TYPE);
}
function toString() {
return(("[Decision " + TYPE) + "]");
}
function isCompleted() {
return(true);
}
function abort() {
}
function checkConditions() {
}
var TYPE = "Decision";
}
Symbol 1602 MovieClip [__Packages.com.sarbakan.sound.SoundManager] Frame 0
class com.sarbakan.sound.SoundManager
{
static var aSounds, mcAttach, nSoundNum, aSoundCategories, nMasterVolume, oEnterFrameListener;
function SoundManager () {
}
static function doPlaySound(_sLinkage, _nVolume, _nLoop, _bUnique) {
return(doPlaySoundInCat(sDEFAULT_CATEGORY, _sLinkage, _nVolume, _nLoop, _bUnique));
}
static function doPlaySoundInCat(_sCategoryName, _sLinkage, _nVolume, _nLoop, _bUnique) {
doCheckInit();
var _local1;
if (NewSoundAllowed) {
if (_nVolume == undefined) {
_nVolume = 100;
}
if (_nLoop == undefined) {
_nLoop = 1;
}
if (_bUnique == undefined) {
_bUnique = false;
}
var _local2;
if (_bUnique) {
var _local4 = isSoundPlaying(_sLinkage);
if (_local4.bPlaying) {
_local2 = false;
_local1 = _local4.oSound;
} else {
_local2 = true;
}
} else {
_local2 = true;
}
if (_local2) {
doManageCategory(_sCategoryName);
var _local5 = getMCForSound();
var _local3 = new Sound(_local5);
_local3.attachSound(_sLinkage);
if (_local3.duration != undefined) {
_local1 = new com.sarbakan.sound.SoundItem(_local3, _sLinkage, _nVolume, _nLoop, _sCategoryName, _local5);
} else {
trace("**** BAD SOUND LINKAGE : " + _sLinkage);
}
_local1.doAddListener(com.sarbakan.sound.SoundManager);
aSounds.push(_local1);
}
} else {
trace("ERROR - ***** - MAX SOUND NUM REACHED : " + nMAX_SOUNDS_PLAYING);
}
return(_local1);
}
static function isSoundPlaying(_sLinkageName) {
var _local2 = new Object();
_local2.bPlaying = false;
_local2.oSound = undefined;
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
if (aSounds[_local1].LinkageName == _sLinkageName) {
_local2.oSound = aSounds[_local1];
_local2.bPlaying = true;
}
_local1--;
}
return(_local2);
}
function getPlayingQty(_sLinkageName) {
var _local2 = 0;
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
if (aSounds[_local1].LinkageName == _sLinkageName) {
_local2++;
}
_local1--;
}
return(_local2);
}
static function doManageExternalSound(_oSound) {
doCheckInit();
doManageCategory(_oSound.__get__Category());
_oSound.doAddListener(com.sarbakan.sound.SoundManager);
aSounds.push(_oSound);
}
static function getMCForSound() {
var _local1 = getNextDepth();
var _local2 = mcAttach.createEmptyMovieClip("Snd" + _local1, _local1);
return(_local2);
}
static function getNextDepth() {
nSoundNum++;
return(nSoundNum);
}
static function doInit(_mcAttach) {
if (!bInited) {
mcAttach = _mcAttach;
bInited = true;
nSoundNum = 0;
aSounds = new Array();
aSoundCategories = new Array();
nMasterVolume = 100;
mx.transitions.OnEnterFrameBeacon.init();
oEnterFrameListener = new Object();
oEnterFrameListener.onEnterFrame = com.sarbakan.utils.Delegate.create(com.sarbakan.sound.SoundManager, doEnterFrame);
MovieClip.addListener(oEnterFrameListener);
}
}
static function doEnterFrame() {
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
aSounds[_local1].doEnterFrame();
_local1--;
}
}
static function setCategoryVolume(_sCategoryName, _nVol) {
doManageCategory(_sCategoryName);
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
aSoundCategories[_local1].nVolume = _nVol;
}
_local1--;
}
doUpdateAllSoundsVolume();
}
static function getCategoryVolume(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local2;
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
_local2 = aSoundCategories[_local1].nVolume;
}
_local1--;
}
return(_local2);
}
static function isCategoryMuted(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local2;
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
_local2 = aSoundCategories[_local1].bMuted;
}
_local1--;
}
return(_local2);
}
static function doSoundEvent(_nEvent, _oSound) {
if (!(_nEvent === nEVENT_SOUND_COMPLETE)) {
} else {
var _local2 = false;
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
if (!_local2) {
if (aSounds[_local1] == _oSound) {
_local2 = true;
delete aSounds[_local1];
aSounds.splice(Number(_local1), 1);
}
}
_local1--;
}
}
}
static function doMuteCategory(_sCategoryName) {
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
aSoundCategories[_local1].bMuted = true;
}
_local1--;
}
doUpdateAllSoundsVolume();
}
static function doUnMuteCategory(_sCategoryName) {
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
aSoundCategories[_local1].bMuted = false;
}
_local1--;
}
doUpdateAllSoundsVolume();
}
static function setMasterVolume(_nVol) {
nMasterVolume = _nVol;
doUpdateAllSoundsVolume();
}
static function get NewSoundAllowed() {
return(aSounds.length < nMAX_SOUNDS_PLAYING);
}
static function get MasterVolume() {
return(nMasterVolume);
}
static function doRemoveListenerFromAllSounds(_oListener) {
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
aSounds[_local1].doRemoveListener(_oListener);
_local1--;
}
}
static function doDestroy() {
doRemoveListenerFromAllSounds();
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
aSounds[_local1].doDestroy();
_local1--;
}
mcAttach.removeMovieClip();
delete mcAttach;
nSoundNum = 0;
bInited = false;
nMasterVolume = 100;
delete aSounds;
delete aSoundCategories;
delete oEnterFrameListener;
}
static function get Inited() {
return(bInited);
}
static function doUpdateAllSoundsVolume() {
var _local1 = aSounds.length - 1;
while (_local1 >= 0) {
aSounds[_local1].doUpdateSound();
_local1--;
}
}
static function doCheckInit() {
if (!bInited) {
trace("**** NORMAL SM ERROR, NEED TO INIT SOUND MANAGER FIRST");
}
}
static function doManageCategory(_sCategoryName) {
doCheckInit();
var _local2 = false;
var _local1 = aSoundCategories.length - 1;
while (_local1 >= 0) {
if (aSoundCategories[_local1].sName == _sCategoryName) {
_local2 = true;
}
_local1--;
}
if (!_local2) {
var _local4 = new Object();
_local4.sName = _sCategoryName;
_local4.nVolume = 100;
_local4.bMuted = false;
aSoundCategories.push(_local4);
}
}
static var nEVENT_SOUND_COMPLETE = 1;
static var sDEFAULT_CATEGORY = "SFX";
static var nMAX_SOUNDS_PLAYING = 32;
static var bInited = false;
}
Symbol 1603 MovieClip [__Packages.com.sarbakan.sound.SoundItem] Frame 0
class com.sarbakan.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 = nFADE_RATE;
sCategory = _sCategory;
bFadeAtEnd = false;
bMuted = false;
bPaused = false;
bNeedFreshStart = false;
sndObj.onSoundComplete = com.sarbakan.utils.Delegate.create(this, doSoundComplete);
doStart(_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 doStart(_nLoop) {
if (_nLoop == undefined) {
_nLoop = 1;
}
if (sLinkage.indexOf(".mp3") != -1) {
sndObj.start(0.015, _nLoop);
} else {
sndObj.start(0, _nLoop);
}
}
function doStop() {
sndObj.stop();
doManageEndEvent();
}
function doFadeTo(_nVolume, _bStopAndDelete) {
if (_bStopAndDelete == undefined) {
_bStopAndDelete = true;
}
bStopAfterFade = _bStopAndDelete;
nTargetVolume = _nVolume;
}
function setFadeRate(_nRate) {
if (_nRate == undefined) {
_nRate = nFADE_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 doDestroy() {
sndObj.stop();
delete sndObj;
mcRef.removeMovieClip();
}
function doCheckFadeAtEnd() {
if (bFadeAtEnd) {
if (nRemainingLoop == 1) {
if ((sndObj.duration - nCurrentTime) <= nFADE_AT_END_TIME) {
doFadeTo(0);
}
}
}
}
function doManageEndEvent() {
var _local2 = 0;
while (_local2 < aEventListeners.length) {
aEventListeners[_local2].doSoundEvent(com.sarbakan.sound.SoundManager.nEVENT_SOUND_COMPLETE, this);
_local2++;
}
aEventListeners = new Array();
mcRef.removeMovieClip();
delete mcRef;
delete aEventListeners;
delete sndObj.onSoundComplete;
delete sndObj;
}
function doManageFade() {
if (nCurrentVolume != nTargetVolume) {
nCurrentVolume = com.sarbakan.utils.MoreMath.getReachNum(nCurrentVolume, nTargetVolume, nFadeRate);
sndObj.setVolume(returnComputedVolume(nCurrentVolume));
}
if ((nCurrentVolume <= 0) && (bStopAfterFade)) {
sndObj.stop();
doManageEndEvent();
}
}
function returnComputedVolume(_nVolume) {
var _local2;
if ((!bMuted) && (!com.sarbakan.sound.SoundManager.isCategoryMuted(sCategory))) {
var _local3 = com.sarbakan.sound.SoundManager.__get__MasterVolume() / 100;
var _local4 = com.sarbakan.sound.SoundManager.getCategoryVolume(sCategory) / 100;
_local2 = _nVolume;
_local2 = _local2 * _local4;
_local2 = _local2 * _local3;
} else {
_local2 = 0;
}
return(_local2);
}
static var nFADE_RATE = 8;
static var nFADE_AT_END_TIME = 800;
}
Symbol 1604 MovieClip [__Packages.com.sarbakan.utils.MoreMath] Frame 0
class com.sarbakan.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 getManhattanDistance(_x1, _y1, _x2, _y2) {
return(Math.abs(_x1 - _x2) + Math.abs(_y1 - _y2));
}
static function getHypotenuse(__nDX, __nDY) {
return(Math.sqrt(Math.pow(__nDX, 2) + Math.pow(__nDY, 2)));
}
static function getAngle(__nX1, __nY1, __nX2, __nY2) {
var _local2;
var _local1;
var _local4;
var _local3;
_local2 = __nX2 - __nX1;
_local1 = __nY2 - __nY1;
_local4 = Math.atan2(_local1, _local2);
_local3 = getDegreeFromRadius(_local4);
return(_local3);
}
static function getCleanedAngle(_nAngle) {
while (_nAngle < 360) {
_nAngle = _nAngle + 360;
}
_nAngle = _nAngle % 360;
return(_nAngle);
}
static function getDegreeFromRadius(__nRadius) {
var _local1 = (__nRadius / MATH_PI) * 180;
return(_local1);
}
static function getRadianFromDegree(__nDegree) {
var _local1 = __nDegree * (MATH_PI / 180);
return(_local1);
}
static function getBoundsCenter(_oBox) {
var _local3 = (_oBox.xMin + _oBox.xMax) / 2;
var _local2 = (_oBox.yMin + _oBox.yMax) / 2;
return({x:_local3, y:_local2});
}
static var MATH_PI = Math.PI;
}
Symbol 1605 MovieClip [__Packages.com.disney.gem.games.tirade.elements.Elevator] Frame 0
class com.disney.gem.games.tirade.elements.Elevator extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
static var oFinalElevator, oElevatorActivatedByEnnemy;
var setLinkage, setMC, nHeight, mc, nStartMaskHeight, bAutoStart, bPositionAtTop, removeReferenceMC, attachMC, nPlatformOrigY, setState, nDirection, nColliderOrigY, mcCollider, bLockedAtTop, oOwner, oAttachProperties, id;
function Elevator (_mc, _sLinkage) {
super("elevator" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage(_sLinkage);
setMC(_mc);
nHeight = mc.nElevatorHeight;
nStartMaskHeight = 0;
if (mc._name.substr(0, 8) != "instance") {
bAutoStart = false;
bPositionAtTop = true;
registerElevator(this, mc._name);
} else {
bAutoStart = true;
}
if (mc.bFinalElevator) {
oFinalElevator = this;
}
}
function init() {
removeReferenceMC();
attachMC();
nPlatformOrigY = mc.mcPlatform._y;
attachCollider();
}
function start() {
setState(sSTATE_ACTIVE);
bAutoStart = true;
nDirection = -1;
}
function stop() {
setState(sSTATE_IDLE);
}
static function lockFinalElevator() {
oFinalElevator.bLockedAtTop = true;
}
function onEnable() {
if (nColliderOrigY != undefined) {
mcCollider._y = nColliderOrigY;
}
if (nStartMaskHeight == 0) {
nStartMaskHeight = mc.mcMask._height;
}
mc.mcMask._y = mc.mcMask._y + ((nStartMaskHeight - nHeight) - nTOP_MARGIN);
mc.mcMask._height = nHeight + nTOP_MARGIN;
if (bPositionAtTop == true) {
mc.mcPlatform._y = mc.mcPlatform._y - nHeight;
mc.mcMask._height = mc.mcMask._height - nHeight;
mcCollider._y = mcCollider._y - nHeight;
}
}
static function onAssociatedEnnemyDead(_sID) {
oElevatorActivatedByEnnemy[_sID].start();
delete oElevatorActivatedByEnnemy[_sID];
}
function state_idle() {
if (bAutoStart) {
start();
}
}
function state_active() {
var _local2 = nELEVATOR_SPEED * nDirection;
mc.mcPlatform._y = mc.mcPlatform._y + _local2;
mc.mcMask._height = mc.mcMask._height + _local2;
mcCollider._y = mcCollider._y + _local2;
if (mc.mcPlatform._y > nPlatformOrigY) {
mc.mcPlatform._y = nPlatformOrigY;
mc.mcMask._height = nHeight + nTOP_MARGIN;
mcCollider._y = nColliderOrigY;
nDirection = -1;
}
if (mc.mcPlatform._y < (nPlatformOrigY - nHeight)) {
mc.mcPlatform._y = nPlatformOrigY - nHeight;
mc.mcMask._height = nTOP_MARGIN;
mcCollider._y = nColliderOrigY - nHeight;
nDirection = 1;
if (bLockedAtTop) {
bAutoStart = false;
setState(sSTATE_IDLE);
}
}
}
function attachCollider() {
var _local2 = oOwner.getCollisionMap("floor");
mcCollider = _local2.attachMC("mcElevatorCollider", oAttachProperties._x, oAttachProperties._y + nPlatformOrigY, id);
nColliderOrigY = mcCollider._y;
}
static function registerElevator(_oElevator, _sID) {
if (oElevatorActivatedByEnnemy == undefined) {
oElevatorActivatedByEnnemy = {};
}
oElevatorActivatedByEnnemy[_sID] = _oElevator;
}
static function reset() {
delete oElevatorActivatedByEnnemy;
}
static var nELEVATOR_SPEED = 4;
static var nTOP_MARGIN = 120;
static var sSTATE_IDLE = "idle";
static var sSTATE_ACTIVE = "active";
}
Symbol 1606 MovieClip [__Packages.com.disney.gem.games.tirade.elements.characters.BossBarbossa] Frame 0
class com.disney.gem.games.tirade.elements.characters.BossBarbossa extends com.disney.gem.games.tirade.elements.characters.BaseEnnemy
{
static var oLastInstance;
var setLinkage, bWaiting, oDecisionMaker, bReachedSwitch, setDirection, nDirection, stateIs, isNearPlayer, nATTACK_DELAY, nAttackDelayCount, bNoFlip, oPlayer, bWillKickPlayer, stateFinished, getElement, mc, stateStarting, nSpeedX, nSpeedY, bAttackBlocked, stateCurrentFrame, stateIsNot, initHurt;
function BossBarbossa (_mc) {
super(_mc);
setLinkage("mcBossBarbossa");
oLastInstance = this;
setBehaviorWaiting();
}
function init() {
super.init();
setState(sSTATE_IDLE_SWITCH);
}
function setBehaviorRegular() {
bWaiting = false;
oDecisionMaker.clear();
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionSwitchToWaitingBehavior());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionLookTowardPlayer());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionDefenseWalkBackward(0.4));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionDefenseBlock(1));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionWalkTowardPlayer(0.7, 150));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionAttack(0.65));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionBigAttack(0.9));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionTaunt(0.3));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionIdle());
}
function setBehaviorWaiting() {
bWaiting = true;
bReachedSwitch = false;
oDecisionMaker.clear();
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionSwitchToRegularBehavior());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionWalkToSwitch());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionIdle(true));
}
function setBehaviorDefensive() {
bWaiting = false;
oDecisionMaker.clear();
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionSwitchToWaitingBehavior());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionKickPlayer());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionDefenseWalkBackward(1));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionIdle());
}
function setState(_sState, _bInstant) {
if (_sState == com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_IDLE) {
if (bWaiting) {
_sState = sSTATE_IDLE_SWITCH;
} else {
_sState = sSTATE_IDLE_SWORD;
}
}
super.setState(_sState, _bInstant);
}
function initTurn(_fCallBack) {
setDirection(nDirection * -1);
_fCallBack();
}
function canAttack() {
return((stateIs(sSTATE_IDLE_SWORD, com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_RUN) && (isNearPlayer())) && (nAttackDelayCount == nATTACK_DELAY));
}
function initBigAttack(_bShortAnticipation) {
if (_bShortAnticipation) {
setState(sSTATE_BIG_ATTACK_ANTICIPATION_SHORT);
} else {
setState(sSTATE_BIG_ATTACK_ANTICIPATION);
}
}
function initWalkBackward() {
setState(sSTATE_STEP_BACK);
bNoFlip = true;
setDirection(oPlayer.nDirection);
}
function endWalkBackward() {
bNoFlip = false;
setDirection(nDirection * -1);
}
function resetEnergy() {
super.resetEnergy();
com.disney.gem.games.tirade.elements.Box.breakAll(true);
bWillKickPlayer = false;
}
function state_grabSwitch_init() {
super.state_idle_init();
}
function state_grabSwitch() {
super.state_idle();
if (stateFinished()) {
setState(sSTATE_IDLE_SWITCH);
}
}
function state_idleSwitch_init() {
super.state_idle_init();
}
function state_idleSwitch() {
super.state_idle();
if (getElement("pliers").stateIs(com.disney.gem.games.tirade.elements.Pliers.sSTATE_DROP_ANTICIPATION)) {
setState(sSTATE_IDLE_SWITCH_DROP);
}
}
function state_idleSwitchDrop() {
super.state_idle();
mc._parent.mcSwitchBG._visible = false;
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Barbarossa_Switch.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BARBOSSA_SWITCH);
}
if (stateFinished()) {
setState(sSTATE_IDLE_SWITCH);
mc._parent.mcSwitchBG._visible = true;
}
}
function state_drawSword() {
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Sword_Barbossa_out.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BARBOSSA_DRAW_SWORD);
}
if (stateFinished()) {
setState(sSTATE_IDLE_SWORD);
}
}
function state_idleSword_init() {
super.state_idle_init();
}
function state_idleSword() {
super.state_idle();
if ((bWillKickPlayer && (mc.hitTest(oPlayer.mc))) && (mc._x >= oPlayer.mc._x)) {
setDirection(-1);
setState(sSTATE_HURT_KICK);
}
}
function state_stepBack() {
super.state_run();
}
function state_bigAttackAnticipation() {
nSpeedX = 0;
nSpeedY = 0;
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound(("Ennemy_Taunt_" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 2)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_HENCHMAN_TAUNT);
}
if (stateFinished()) {
setState(sSTATE_BIG_ATTACK);
}
}
function state_bigAttackAnticipationShort() {
state_bigAttackAnticipation();
}
function state_bigAttack() {
nSpeedX = 0;
nSpeedY = 0;
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound(("Sword_Swing_Big" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 3)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_SWORD);
}
if ((!bAttackBlocked) && (mc.sword.hitTest(oPlayer.mc.body))) {
oPlayer.hurt(com.disney.gem.games.tirade.GameData.nHURT_PLAYER_UNDEAD_BIG_ATTACK, nBIG_ATTACK_PLAYER_PUSH_BACK * nDirection);
}
if (stateFinished()) {
setState(sSTATE_IDLE_SWORD);
}
}
function state_hurtKick() {
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Barbarossa_Kick.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BARBOSSA_KICK);
}
if (stateCurrentFrame() == nFRAME_BARBOSSA_KICK) {
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Hurt_impact.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_HURT_IMPACT);
oPlayer.kickDownstairs();
}
if (stateFinished()) {
setState(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_TAUNT);
}
}
function state_taunt() {
nSpeedX = 0;
nSpeedY = 0;
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Barbarossa_Taunt.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BARBOSSA_TAUNT);
}
if (stateFinished()) {
bWillKickPlayer = false;
setState(sSTATE_IDLE_SWORD);
}
}
function state_hurt() {
super.state_hurt(true);
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Barbossa_Hurt.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BARBOSSA_TAUNT);
}
}
function state_die() {
nSpeedX = 0;
nSpeedY = 0;
if (stateFinished()) {
com.disney.gem.games.tirade.Controller.getInstance().onLevelEnd();
}
super.state_die();
}
function checkHurt() {
if ((((stateIsNot(sSTATE_HURT_KICK, com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_DIE, com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_DEAD, sSTATE_IDLE_SWITCH, sSTATE_IDLE_SWITCH_DROP, sSTATE_DRAW_SWORD) && (oPlayer.isAttacking())) && (mc.hitTest(oPlayer.mc.sword))) && (!bAttackBlocked)) && (!bWillKickPlayer)) {
if (stateIs(sSTATE_IDLE_SWORD) && (!bWillKickPlayer)) {
oDecisionMaker.abortCurrentDecision();
oDecisionMaker.makeDecision();
}
if (stateIsNot(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_BLOCK)) {
initHurt(getHurtValue());
}
}
}
function getHurtValue() {
return(com.disney.gem.games.tirade.GameData.nHURT_BOSS_BARBOSSA);
}
function isAttacked() {
return(oPlayer.isAttacking() && (isNearPlayer(undefined, true)));
}
var nSPEED_RUN = 7;
var nDISTANCE_NEAR = 175;
var nBIG_ATTACK_PLAYER_PUSH_BACK = 12;
var nSWITCH_BEHAVIOR_COORD_Y = 400;
var nSWITCH_POSITION_X = 672;
static var nFRAME_BARBOSSA_KICK = 8;
static var sSTATE_IDLE_SWITCH = "idleSwitch";
static var sSTATE_IDLE_SWITCH_DROP = "idleSwitchDrop";
static var sSTATE_DRAW_SWORD = "drawSword";
static var sSTATE_GRAB_SWITCH = "grabSwitch";
static var sSTATE_IDLE_SWORD = "idleSword";
static var sSTATE_STEP_BACK = "stepBack";
static var sSTATE_ATTACK2 = "attack2";
static var sSTATE_BIG_ATTACK = "bigAttack";
static var sSTATE_BIG_ATTACK_ANTICIPATION = "bigAttackAnticipation";
static var sSTATE_BIG_ATTACK_ANTICIPATION_SHORT = "bigAttackAnticipationShort";
static var sSTATE_HURT_KICK = "hurtKick";
}
Symbol 1607 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionSwitchToWaitingBehavior] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionSwitchToWaitingBehavior extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var oOwner, bDecisionMade;
function DecisionSwitchToWaitingBehavior () {
super();
}
function isCompleted() {
return(true);
}
function checkConditions() {
if ((oOwner.oPlayer.mc._y > oOwner.nSWITCH_BEHAVIOR_COORD_Y) && (!oOwner.oPlayer.isJumping())) {
oOwner.setBehaviorWaiting();
bDecisionMade = true;
}
}
var TYPE = "SwitchToWaitingBehavior";
}
Symbol 1608 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionLookTowardPlayer] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionLookTowardPlayer extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var bCompleted, oOwner, bDecisionMade;
function DecisionLookTowardPlayer () {
super();
}
function isCompleted() {
return(bCompleted);
}
function onTurnDone() {
bCompleted = true;
}
function checkConditions() {
if (oOwner.isNearPlayer(undefined, true)) {
if (((oOwner.mc._x <= oOwner.oPlayer.mc._x) && (oOwner.nDirection != 1)) || ((oOwner.mc._x > oOwner.oPlayer.mc._x) && (oOwner.nDirection != -1))) {
bDecisionMade = true;
bCompleted = false;
oOwner.initTurn(com.disney.gem.games.tirade.sarbakan.utils.Delegate.create(this, onTurnDone));
}
}
}
var TYPE = "LookTowardPlayer";
}
Symbol 1609 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionDefenseWalkBackward] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionDefenseWalkBackward extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var nDefenseChance, nWalkCount, oOwner, bDecisionMade;
function DecisionDefenseWalkBackward (_nDefenseChance) {
super();
nDefenseChance = _nDefenseChance;
}
function isCompleted() {
if ((((++nWalkCount) >= nWALK_DURATION) && (Math.random() < nCHANCE_DONE)) || (oOwner.isOnFloorEgde())) {
abort();
return(true);
}
}
function abort() {
oOwner.endWalkBackward();
}
function checkConditions() {
if ((((oOwner.oPlayer.isAttacking() && (oOwner.isPlayerLookingAtEnnemy())) && (!oOwner.isOnFloorEgde(true))) && (!oOwner.isOnFloorEgde())) && (Math.random() <= nDefenseChance)) {
oOwner.initWalkBackward();
nWalkCount = 0;
bDecisionMade = true;
}
}
var TYPE = "DefenseWalkBackward";
static var nWALK_DURATION = 10;
static var nCHANCE_DONE = 0.3;
}
Symbol 1610 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionDefenseBlock] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionDefenseBlock extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var nDefenseChance, oOwner, bDecisionMade;
function DecisionDefenseBlock (_nDefenseChance) {
super();
nDefenseChance = _nDefenseChance;
}
function isCompleted() {
return(oOwner.stateIsNot(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_BLOCK));
}
function checkConditions() {
if (((!oOwner.isHurt()) && (oOwner.isAttacked())) && (Math.random() <= nDefenseChance)) {
oOwner.initBlock();
bDecisionMade = true;
}
}
var TYPE = "DefenseBlock";
}
Symbol 1611 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionWalkTowardPlayer] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionWalkTowardPlayer extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var nWalkChance, nDistancePlayer, oOwner, bDecisionMade;
function DecisionWalkTowardPlayer (_nWalkChance, _nDistancePlayer) {
super();
nWalkChance = _nWalkChance;
nDistancePlayer = _nDistancePlayer;
}
function isCompleted() {
if (!oOwner.isLookingAtPlayer()) {
oOwner.setDirection(oOwner.nDirection * -1);
}
return(oOwner.isNearPlayer(nDistancePlayer) || (oOwner.isOnFloorEgde()));
}
function checkConditions() {
if (((Math.random() <= nWalkChance) && (!oOwner.isNearPlayer(nDistancePlayer))) && (oOwner.isOnPlayerFloor())) {
oOwner.setState("run");
oOwner.setDirection(oOwner.nDirection * -1);
bDecisionMade = true;
}
}
var TYPE = "WalkTowardPlayer";
}
Symbol 1612 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionAttack] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionAttack extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var nAttackChance, oOwner, bDecisionMade;
function DecisionAttack (_nAttackChance) {
super();
nAttackChance = _nAttackChance;
}
function isCompleted() {
return(oOwner.stateIsNot(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_ATTACK));
}
function checkConditions() {
if (oOwner.canAttack() && (Math.random() <= nAttackChance)) {
oOwner.initAttack();
bDecisionMade = true;
}
}
var TYPE = "Attack";
}
Symbol 1613 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionBigAttack] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionBigAttack extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var nAttackChance, bShortAnticipation, oOwner, bDecisionMade;
function DecisionBigAttack (_nAttackChance, _bShortAnticipation) {
super();
nAttackChance = _nAttackChance;
bShortAnticipation = _bShortAnticipation;
}
function isCompleted() {
return(oOwner.stateIsNot(com.disney.gem.games.tirade.elements.characters.BossUndead.sSTATE_BIG_ATTACK, com.disney.gem.games.tirade.elements.characters.BossUndead.sSTATE_BIG_ATTACK_ANTICIPATION, com.disney.gem.games.tirade.elements.characters.BossUndead.sSTATE_BIG_ATTACK_ANTICIPATION_SHORT));
}
function checkConditions() {
if ((oOwner.canAttack() || (bShortAnticipation)) && (Math.random() <= nAttackChance)) {
oOwner.initBigAttack(bShortAnticipation);
bDecisionMade = true;
}
}
var TYPE = "BigAttack";
}
Symbol 1614 MovieClip [__Packages.com.disney.gem.games.tirade.elements.characters.BossUndead] Frame 0
class com.disney.gem.games.tirade.elements.characters.BossUndead extends com.disney.gem.games.tirade.elements.characters.BaseEnnemy
{
static var oLastInstance;
var setLinkage, oPlayer, mc, setDirection, setState, isHurt, nEnergy, isJumping, bInAirHurt, initDie, nSpeedX, checkWall, oDecisionMaker, stateStarting, nSpeedY, stateFinished, stateCurrentFrame, bAttackBlocked, nDirection, state_jumpFall, getElement, setPositionOutFloor, getState, stateIsNot;
function BossUndead (_mc) {
super(_mc);
setLinkage("mcBossUndead");
oLastInstance = this;
setBehaviorRegular();
}
function initBigAttack(_bShortAnticipation) {
if (mc._x < oPlayer.mc._x) {
setDirection(1);
} else {
setDirection(-1);
}
if (_bShortAnticipation) {
setState(sSTATE_BIG_ATTACK_ANTICIPATION_SHORT);
} else {
setState(sSTATE_BIG_ATTACK_ANTICIPATION);
}
}
function initHurt(_nEnergy) {
if (!isHurt()) {
com.sarbakan.sound.SoundManager.doPlaySound("Will_Turner_Hurt_impact.wav", com.disney.gem.games.tirade.GameData.nVOLUME_WILL_HURT_IMPACT);
nEnergy = nEnergy - _nEnergy;
if (nEnergy > 0) {
if (isJumping()) {
bInAirHurt = true;
}
setState(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_HURT);
} else {
initDie();
}
}
}
function state_idle_init() {
super.state_idle_init();
nSpeedX = 0;
}
function state_idle() {
if (Math.random() < 0.01) {
com.sarbakan.sound.SoundManager.doPlaySound(("Undead_Taunt0" + com.disney.gem.games.tirade.sarbakan.utils.MoreMath.random(1, 2)) + ".wav", com.disney.gem.games.tirade.GameData.nVOLUME_UNDEAD_TAUNT, 1, true);
}
checkWall();
}
function state_run() {
super.state_run();
if (oPlayer.isAttacking()) {
oDecisionMaker.abortCurrentDecision();
oDecisionMaker.makeDecision();
}
}
function state_attack() {
super.state_attack();
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Undead_Attack.wav", com.disney.gem.games.tirade.GameData.nVOLUME_UNDEAD_TAUNT);
}
}
function state_bigAttackAnticipation() {
nSpeedX = 0;
nSpeedY = 0;
if (stateStarting() && (Math.random() < 0.33)) {
com.sarbakan.sound.SoundManager.doPlaySound("Undead_AttackBig.wav", com.disney.gem.games.tirade.GameData.nVOLUME_UNDEAD_TAUNT);
}
if (stateFinished()) {
setState(sSTATE_BIG_ATTACK);
}
}
function state_bigAttackAnticipationShort() {
state_bigAttackAnticipation();
if (((stateCurrentFrame() > 10) && (mc.sword.hitTest(oPlayer.mc.body))) && (!oPlayer.isHurt())) {
oPlayer.hurt(com.disney.gem.games.tirade.GameData.nHURT_PLAYER_ENNEMY);
com.sarbakan.sound.SoundManager.doPlaySound("Flail_Hit.wav", com.disney.gem.games.tirade.GameData.nVOLUME_UNDEAD_FLAIL_HIT, 1, true);
}
}
function state_bigAttack() {
nSpeedX = 0;
nSpeedY = 0;
if (stateCurrentFrame() == 2) {
com.sarbakan.sound.SoundManager.doPlaySound("Flail_Turning.wav", com.disney.gem.games.tirade.GameData.nVOLUME_UNDEAD_FLAIL_TURN);
}
if (((!bAttackBlocked) && (mc.sword.hitTest(oPlayer.mc.body))) && (!oPlayer.isHurt())) {
oPlayer.hurt(com.disney.gem.games.tirade.GameData.nHURT_PLAYER_UNDEAD_BIG_ATTACK, nBIG_ATTACK_PLAYER_PUSH_BACK * nDirection);
com.sarbakan.sound.SoundManager.doPlaySound("Flail_Hit.wav", com.disney.gem.games.tirade.GameData.nVOLUME_UNDEAD_FLAIL_HIT, 1, true);
}
if (stateFinished()) {
bAttackBlocked = false;
setState(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_IDLE);
}
}
function state_hurt_init() {
if (!bInAirHurt) {
super.state_hurt_init();
}
}
function state_hurt() {
if (bInAirHurt) {
state_jumpFall();
} else {
super.state_hurt();
}
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Undead_Hurt.wav", com.disney.gem.games.tirade.GameData.nVOLUME_UNDEAD_TAUNT);
}
if (bInAirHurt && (stateFinished())) {
setState(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_JUMP_FALL);
}
}
function state_die() {
if (stateFinished()) {
setState(sSTATE_DEAD);
getElement("finalDoor").open();
}
super.state_die();
nSpeedY = 10;
setPositionOutFloor();
}
function state_jumpLand() {
super.state_jumpLand();
if (bInAirHurt && (stateFinished())) {
setState(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_IDLE);
oDecisionMaker.abortCurrentDecision();
setBehaviorDefensive();
oDecisionMaker.makeDecision();
setBehaviorRegular();
bInAirHurt = false;
}
}
function setBehaviorRegular() {
oDecisionMaker.clear();
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionLookTowardPlayer());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionDefenseBlock(0.8));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionBigAttack(0.5));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionAttack(0.5));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionDefenseWalkBackward(1));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionWalkTowardPlayer(0.8, 80));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionWait(0.01));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionIdle());
}
function setBehaviorDefensive() {
oDecisionMaker.clear();
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionBigAttack(1, true));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionIdle());
}
function checkHurt() {
if ((oPlayer.isAttacking() && (mc.hitTest(oPlayer.mc.sword))) && (!bAttackBlocked)) {
if (getState() == sSTATE_BIG_ATTACK_ANTICIPATION_SHORT) {
setState(sSTATE_BIG_ATTACK);
} else if (stateIsNot(sSTATE_BIG_ATTACK, com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_JUMP_LAND, sSTATE_DIE, sSTATE_DEAD) && (!bInAirHurt)) {
initHurt(getHurtValue());
}
}
}
function getHurtValue() {
return(com.disney.gem.games.tirade.GameData.nHURT_BOSS_UNDEAD);
}
function elementOnScreen() {
return(super.elementOnScreen(-45, -20));
}
var nDISTANCE_NEAR = 500;
var nBIG_ATTACK_PLAYER_PUSH_BACK = 12;
static var sSTATE_BIG_ATTACK = "bigAttack";
static var sSTATE_BIG_ATTACK_ANTICIPATION = "bigAttackAnticipation";
static var sSTATE_BIG_ATTACK_ANTICIPATION_SHORT = "bigAttackAnticipationShort";
static var sSTATE_DIE = "die";
static var sSTATE_DEAD = "dead";
}
Symbol 1615 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionWait] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionWait extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var nChanceWait, nWaitDelay, oOwner, nWaitDelayCount, bDecisionMade;
function DecisionWait (_nChance, _nMinimumDelay) {
super();
nChanceWait = _nChance;
if (_nMinimumDelay != undefined) {
nWaitDelay = _nMinimumDelay;
} else {
nWaitDelay = nDELAY_MINIMUM_WAIT;
}
}
function isCompleted() {
if ((oOwner.isNearPlayer() && (oOwner.isLookingAtPlayer())) && (Math.random() < nCHANCE_SIGHT)) {
return(true);
}
if (((++nWaitDelayCount) >= nWaitDelay) && (Math.random() < nCHANCE_RESUME)) {
return(true);
}
}
function checkConditions() {
if (Math.random() < nChanceWait) {
nWaitDelayCount = 0;
oOwner.setState("idle");
bDecisionMade = true;
}
}
var TYPE = "Wait";
static var nCHANCE_RESUME = 0.1;
static var nCHANCE_SIGHT = 0.1;
static var nDELAY_MINIMUM_WAIT = 30;
}
Symbol 1616 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionIdle] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionIdle extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var bDontSwitchState, oOwner, bDecisionMade;
function DecisionIdle (_bDontSwitchState) {
super();
bDontSwitchState = _bDontSwitchState;
}
function isCompleted() {
return(true);
}
function checkConditions() {
if (!bDontSwitchState) {
oOwner.setState("idle");
}
bDecisionMade = true;
}
var TYPE = "Idle";
}
Symbol 1617 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionTaunt] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionTaunt extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var nTauntChance, oOwner, bDecisionMade;
function DecisionTaunt (_nTauntChance) {
super();
nTauntChance = _nTauntChance;
}
function isCompleted() {
return(oOwner.stateIsNot(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_TAUNT));
}
function checkConditions() {
if (((!oOwner.isNearPlayer()) && (!oOwner.getElement("player").isJumping())) && (Math.random() <= nTauntChance)) {
oOwner.setState(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_TAUNT);
bDecisionMade = true;
}
}
var TYPE = "Taunt";
}
Symbol 1618 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionSwitchToRegularBehavior] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionSwitchToRegularBehavior extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var oOwner, bDecisionMade;
function DecisionSwitchToRegularBehavior () {
super();
}
function isCompleted() {
return(oOwner.stateIsNot(com.disney.gem.games.tirade.elements.characters.BossBarbossa.sSTATE_DRAW_SWORD));
}
function checkConditions() {
if (oOwner.oPlayer.mc._y < oOwner.nSWITCH_BEHAVIOR_COORD_Y) {
oOwner.setState(com.disney.gem.games.tirade.elements.characters.BossBarbossa.sSTATE_DRAW_SWORD);
oOwner.setBehaviorRegular();
bDecisionMade = true;
}
}
var TYPE = "SwitchToRegularBehavior";
}
Symbol 1619 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionWalkToSwitch] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionWalkToSwitch extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var oOwner, bDecisionMade;
function DecisionWalkToSwitch () {
super();
}
function isCompleted() {
if (((oOwner.nDirection == 1) && (oOwner.mc._x >= oOwner.nSWITCH_POSITION_X)) || ((oOwner.nDirection == -1) && (oOwner.mc._x <= oOwner.nSWITCH_POSITION_X))) {
oOwner.mc._x = oOwner.nSWITCH_POSITION_X;
oOwner.setState(com.disney.gem.games.tirade.elements.characters.BossBarbossa.sSTATE_GRAB_SWITCH);
oOwner.setDirection(-1);
oOwner.bReachedSwitch = true;
}
return(true);
}
function checkConditions() {
if (!oOwner.bReachedSwitch) {
if (oOwner.mc._x > oOwner.nSWITCH_POSITION_X) {
oOwner.setDirection(-1);
} else {
oOwner.setDirection(1);
}
oOwner.setState(com.disney.gem.games.tirade.elements.characters.BaseEnnemy.sSTATE_RUN);
bDecisionMade = true;
}
}
var TYPE = "WalkToSwitch";
}
Symbol 1620 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionKickPlayer] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionKickPlayer extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var oOwner, bDecisionMade;
function DecisionKickPlayer () {
super();
}
function isCompleted() {
return(oOwner.bWillKickPlayer == false);
}
function checkConditions() {
if (((oOwner.nEnergy == 70) || (oOwner.nEnergy == 40)) || (oOwner.nEnergy == 10)) {
oOwner.setState(com.disney.gem.games.tirade.elements.characters.BossBarbossa.sSTATE_IDLE_SWORD);
oOwner.bWillKickPlayer = true;
bDecisionMade = true;
}
}
var TYPE = "Idle";
}
Symbol 1621 MovieClip [__Packages.com.disney.gem.games.tirade.elements.Box] Frame 0
class com.disney.gem.games.tirade.elements.Box extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
static var oBoxInstances;
var setLinkage, bAlwaysActive, oAttachProperties, attachMC, setState, bNoSound, sState, nSpeedY, getElement, mc, stateFinished, stateStarting, oOwner, id, collideWithMap;
function Box (_nX, _nY) {
super("box" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage("mcBox");
bAlwaysActive = true;
oAttachProperties._x = _nX;
oAttachProperties._y = _nY;
registerBox(this);
}
function init() {
attachMC();
setState(sSTATE_FALL);
}
function disable() {
}
function remove() {
unregisterBox(this);
super.remove();
}
static function breakAll(_bNoSound) {
for (var _local1 in oBoxInstances) {
oBoxInstances[_local1].initBreak(_bNoSound);
}
}
function initBreak(_bNoSound) {
bNoSound = _bNoSound;
setState(sSTATE_BREAK);
}
static function updateGravityAll() {
for (var _local1 in oBoxInstances) {
oBoxInstances[_local1].updateGravity();
}
}
function updateGravity() {
if (((sState == sSTATE_IDLE) && (elementOnScreen())) && (!isOnGround())) {
setState(sSTATE_FALL);
detachCollider();
}
}
function state_idle() {
if (isAttacked()) {
initBreak();
}
}
function state_fall() {
if (elementOnScreen()) {
nSpeedY = 10;
var _local2 = getElement("player");
if (mc.hitTest(_local2.mc.body)) {
if (!isAttacked()) {
_local2.hurt(com.disney.gem.games.tirade.GameData.nHURT_PLAYER_BOX);
}
initBreak();
} else {
if (isOnGround()) {
nSpeedY = 0;
setState(sSTATE_LAND);
}
if (stateFinished()) {
mc.mcState.stop();
}
}
} else {
nSpeedY = 0;
}
}
function state_land() {
nSpeedY = 0;
setPositionOutFloor();
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Box_Land.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BOX_LAND);
}
if (stateFinished()) {
attachCollider();
updateGravityAll();
setState(sSTATE_IDLE);
}
}
function state_break_init() {
detachCollider();
if (!bNoSound) {
com.sarbakan.sound.SoundManager.doPlaySound("Box_Destroy.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BOX_DESTROY, 1, true);
}
}
function state_break() {
nSpeedY = 0;
if (stateFinished()) {
updateGravityAll();
remove();
}
}
function attachCollider() {
var _local2 = oOwner.getCollisionMap("floor");
var _local3 = oOwner.getCollisionMap("wall");
_local2.attachMC("mcBoxCollider", mc._x, mc._y, id);
_local3.attachMC("mcBoxCollider", mc._x, mc._y, id);
}
function detachCollider() {
var _local2 = oOwner.getCollisionMap("floor").getMC();
var _local3 = oOwner.getCollisionMap("wall").getMC();
_local2[id].removeMovieClip();
_local3[id].removeMovieClip();
}
function registerBox(_oBox) {
if (oBoxInstances == undefined) {
oBoxInstances = {};
}
oBoxInstances[id] = this;
}
function unregisterBox(_oBox) {
delete oBoxInstances[id];
}
function isAttacked() {
var _local2 = getElement("player");
return(_local2.isAttacking() && (mc.hitTest(_local2.mc.sword)));
}
function isOnGround() {
return(collideWithMap("floor", mc.left) || (collideWithMap("floor", mc.right)));
}
function setPositionOutFloor() {
while (isOnGround()) {
mc._y--;
}
mc._y++;
}
function elementOnScreen() {
return(super.elementOnScreen(0, -20));
}
static var sSTATE_IDLE = "idle";
static var sSTATE_FALL = "fall";
static var sSTATE_LAND = "land";
static var sSTATE_BREAK = "break";
}
Symbol 1622 MovieClip [__Packages.com.disney.gem.games.tirade.elements.Pliers] Frame 0
class com.disney.gem.games.tirade.elements.Pliers extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, setMC, DEFAULT_STATE, nMinX, nMaxX, mc, removeReferenceMC, attachMC, oPlayer, getElement, nSpeedX, nOnPlaceCount, collideWithMap, setState, stateFinished, stateStarting;
function Pliers (_mc) {
super("pliers");
setLinkage("mcPliers");
setMC(_mc);
DEFAULT_STATE = sSTATE_BOX;
nMinX = _mc._x;
nMaxX = nMinX + mc.nMovementZoneWidth;
}
function init() {
removeReferenceMC();
attachMC();
oPlayer = getElement("player");
}
function update() {
super.update();
mc._x = Math.min(Math.max(mc._x, nMinX), nMaxX);
}
function state_box() {
if (Math.abs(mc._y - oPlayer.mc._y) < 150) {
nSpeedX = (nSPEED * 2) * -1;
} else {
var _local3 = Math.abs(mc._x - oPlayer.mc._x);
if (_local3 > nDISTANCE_NEAR) {
if (mc._x <= oPlayer.mc._x) {
nSpeedX = nSPEED;
} else {
nSpeedX = nSPEED * -1;
}
nOnPlaceCount = 0;
} else {
var _local2 = getElement("player");
if ((!collideWithMap("floor", mc.dropLimit)) && (com.disney.gem.games.tirade.sarbakan.utils.MoreMath.getDistance(mc._x, mc._y, _local2.mc._x, _local2.mc._y) < nMAX_DISTANCE_TO_DROP)) {
nSpeedX = 0;
if ((++nOnPlaceCount) == nFRAME_ON_PLACE_MAX) {
setState(sSTATE_DROP_ANTICIPATION);
}
}
}
}
}
function state_dropAnticipation() {
if (stateFinished()) {
setState(sSTATE_DROP);
}
}
function state_drop() {
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Pincher_Open.wav", com.disney.gem.games.tirade.GameData.nVOLUME_PLIERS_DROP);
createBox();
}
if (stateFinished()) {
setState(sSTATE_EMPTY);
}
}
function state_empty() {
nSpeedX = nSPEED * -1;
if (mc._x <= nMinX) {
setState(sSTATE_BOX);
}
}
function createBox() {
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.Box(mc._x, mc._y + nBOX_SPAWN_OFFSET_Y));
}
static var nDISTANCE_NEAR = 15;
static var nSPEED = 4;
static var nFRAME_ON_PLACE_MAX = 8;
static var nBOX_SPAWN_OFFSET_Y = 85;
static var nMAX_DISTANCE_TO_DROP = 500;
static var sSTATE_BOX = "box";
static var sSTATE_EMPTY = "empty";
static var sSTATE_DROP_ANTICIPATION = "dropAnticipation";
static var sSTATE_DROP = "drop";
}
Symbol 1623 MovieClip [__Packages.com.disney.gem.games.tirade.HUD] Frame 0
class com.disney.gem.games.tirade.HUD
{
var oController, mc;
function HUD (_oController, _mcHUD) {
oController = _oController;
mc = _mcHUD;
mc.btMenu.onRelease = com.sarbakan.utils.Delegate.create(this, onBtMenu);
mc.btMenu.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound);
mc.txtScore.text = oController.getScore();
mc.mcEnergy.gotoAndStop(100);
}
function update() {
updateEnergy();
updateLife();
updateScore();
}
function onBtMenu() {
oController.showInGameMenu();
oController.playClickSound();
}
function updateEnergy() {
if ((mc.mcEnergy._currentframe > 1) && (mc.mcEnergy._currentframe > oController.oGame.oPlayer.nEnergy)) {
mc.mcEnergy.prevFrame();
} else if (mc.mcEnergy._currentframe < oController.oGame.oPlayer.nEnergy) {
mc.mcEnergy.gotoAndStop(oController.oGame.oPlayer.nEnergy);
}
}
function updateLife() {
mc.txtLife.text = oController.nLife;
}
function updateScore() {
var _local2 = Number(mc.txtScore.text);
if (_local2 < oController.getScore()) {
_local2 = _local2 + nSCORE_INCREMENT_STEP;
_local2 = Math.min(_local2, oController.getScore());
mc.txtScore.text = _local2;
}
}
static var nSCORE_INCREMENT_STEP = 10;
}
Symbol 1624 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.visual.activation.GridActivation] Frame 0
class com.disney.gem.games.tirade.sarbakan.visual.activation.GridActivation extends com.disney.gem.games.tirade.sarbakan.visual.activation.ActivationManager
{
var nZoneWidth, nZoneHeight, aDynamicElementsZone, aAlwaysActive, aStaticElementsZone, oCurrentZone, oElementZonesIndex, nCurrentX, nCurrentY, aVisibleZones;
function GridActivation () {
super();
}
function init(_nZoneWidth, _nZoneHeight) {
super.init();
nZoneWidth = _nZoneWidth;
nZoneHeight = _nZoneHeight;
aDynamicElementsZone = [];
aAlwaysActive = [];
aStaticElementsZone = [];
oCurrentZone = {x:-999999, y:-999999};
oElementZonesIndex = {};
}
function getActiveElements() {
var _local6 = {};
var _local2 = getSurroundingZones(oCurrentZone);
_local2.push(oCurrentZone);
var _local5 = _local2.length - 1;
while (_local5 >= 0) {
if (aDynamicElementsZone[_local2[_local5].x][_local2[_local5].y].length > 0) {
var _local3 = aDynamicElementsZone[_local2[_local5].x][_local2[_local5].y].length - 1;
while (_local3 >= 0) {
var _local4 = aDynamicElementsZone[_local2[_local5].x][_local2[_local5].y][_local3];
_local6[_local4.id] = _local4;
_local3--;
}
}
_local5--;
}
_local5 = aAlwaysActive.length - 1;
while (_local5 >= 0) {
_local6[aAlwaysActive[_local5].id] = aAlwaysActive[_local5];
_local5--;
}
return(_local6);
}
function addDynamicElement(_oElement, _nX, _nY, _nWidth, _nHeight) {
addToActivationZones(aDynamicElementsZone, _oElement, _nX, _nY, _nWidth, _nHeight);
}
function removeDynamicElement(_oElement) {
for (var _local5 in oElementZonesIndex[_oElement.id]) {
var _local2 = oElementZonesIndex[_oElement.id][_local5];
var _local3 = aDynamicElementsZone[_local2.x][_local2.y].length - 1;
while (_local3 >= 0) {
if (aDynamicElementsZone[_local2.x][_local2.y][_local3] == _oElement) {
aDynamicElementsZone[_local2.x][_local2.y].splice(_local3, 1);
break;
}
_local3--;
}
}
delete oElementZonesIndex[_oElement.id];
}
function addStaticElement(_oElement, _nX, _nY, _nWidth, _nHeight) {
addToActivationZones(aStaticElementsZone, _oElement, _nX, _nY, _nWidth, _nHeight);
}
function removeStaticElement(_oElement) {
}
function addAlwaysActiveElement(_oElement) {
aAlwaysActive.push(_oElement);
}
function removeAlwaysActiveElement(_oElement) {
var _local2 = aAlwaysActive.length - 1;
while (_local2 >= 0) {
if (aAlwaysActive[_local2] == _oElement) {
aAlwaysActive.splice(Number(_local2), 1);
break;
}
_local2--;
}
}
function updateActivation(_nX, _nY, _bForceUpdate) {
nCurrentX = _nX;
nCurrentY = _nY;
var _local11 = getCurrentZone();
var _local8 = getSurroundingZones(_local11);
_local8.push(_local11);
if (((_bForceUpdate || (_local11.x != oCurrentZone.x)) || (_local11.y != oCurrentZone.y)) || (zoneChanged(_local8))) {
if ((_local11.x != oCurrentZone.x) || (_local11.y != oCurrentZone.y)) {
var _local10 = getActiveElements();
for (var _local12 in _local10) {
_local10[_local12].updatePosInActivation();
}
}
var _local9 = getSurroundingZones(oCurrentZone);
var _local4 = {};
var _local12 = _local9.length - 1;
while (_local12 >= 0) {
_nX = _local9[_local12].x;
_nY = _local9[_local12].y;
if (aDynamicElementsZone[_nX][_nY] != undefined) {
var _local5 = aDynamicElementsZone[_nX][_nY].length - 1;
while (_local5 >= 0) {
_local4[aDynamicElementsZone[_nX][_nY][_local5].id] = {element:aDynamicElementsZone[_nX][_nY][_local5], enabled:false};
_local5--;
}
}
if (aStaticElementsZone[_nX][_nY] != undefined) {
var _local5 = aStaticElementsZone[_nX][_nY].length - 1;
while (_local5 >= 0) {
_local4[aStaticElementsZone[_nX][_nY][_local5].id] = {element:aStaticElementsZone[_nX][_nY][_local5], enabled:false};
_local5--;
}
}
_local12--;
}
_local12 = _local8.length - 1;
while (_local12 >= 0) {
_nX = _local8[_local12].x;
_nY = _local8[_local12].y;
if (aDynamicElementsZone[_nX][_nY] != undefined) {
var _local5 = aDynamicElementsZone[_nX][_nY].length - 1;
while (_local5 >= 0) {
_local4[aDynamicElementsZone[_nX][_nY][_local5].id] = {element:aDynamicElementsZone[_nX][_nY][_local5], enabled:true};
_local5--;
}
}
if (aStaticElementsZone[_nX][_nY] != undefined) {
var _local5 = aStaticElementsZone[_nX][_nY].length - 1;
while (_local5 >= 0) {
_local4[aStaticElementsZone[_nX][_nY][_local5].id] = {element:aStaticElementsZone[_nX][_nY][_local5], enabled:true};
_local5--;
}
}
_local12--;
}
for (_local12 in _local4) {
if (_local4[_local12].enabled == true) {
_local4[_local12].element.enable();
} else {
_local4[_local12].element.disable();
}
}
}
oCurrentZone = _local11;
aVisibleZones = _local8;
}
function elementOnScreen(_oElement) {
var _local6 = _oElement.oAttachProperties._x;
var _local4 = _oElement.oAttachProperties._y;
var _local5 = _oElement.oAttachProperties._x + _oElement.oAttachProperties._width;
var _local3 = _oElement.oAttachProperties._y + _oElement.oAttachProperties._height;
return(((((_local6 >= nCurrentX) && (_local6 <= (nCurrentX + nZoneWidth))) || ((_local4 >= nCurrentY) && (_local4 <= (nCurrentY + nZoneHeight)))) || ((_local5 >= nCurrentX) && (_local5 <= (nCurrentX + nZoneWidth)))) || ((_local3 >= nCurrentY) && (_local3 <= (nCurrentY + nZoneHeight))));
}
function addToActivationZones(_aZoneTable, _oElementToRegister, _nPosX, _nPosY, _nWidth, _nHeight) {
var _local8;
var _local7;
_local8 = _nWidth / nZoneWidth;
if (_local8 < 1) {
_local8 = 1;
}
_local8 = Math.round(_local8);
_local7 = _nHeight / nZoneHeight;
if (_local7 < 1) {
_local7 = 1;
}
_local7 = Math.round(_local7);
addToZone(_aZoneTable, _oElementToRegister, _nPosX, _nPosY);
var _local2 = 1;
while (_local2 < _local8) {
addToZone(_aZoneTable, _oElementToRegister, _nPosX + (nZoneWidth * _local2), _nPosY);
_local2++;
}
_local2 = 1;
while (_local2 < _local7) {
addToZone(_aZoneTable, _oElementToRegister, _nPosX, _nPosY + (nZoneHeight * _local2));
_local2++;
}
}
function addToZone(_aZoneTable, _oElementToRegister, _nPosX, _nPosY) {
var _local2 = getZone(_nPosX, _nPosY);
if (!_aZoneTable[_local2.x]) {
_aZoneTable[_local2.x] = [];
}
if (!_aZoneTable[_local2.x][_local2.y]) {
_aZoneTable[_local2.x][_local2.y] = [];
}
_aZoneTable[_local2.x][_local2.y].push(_oElementToRegister);
if (!oElementZonesIndex[_oElementToRegister.id]) {
oElementZonesIndex[_oElementToRegister.id] = [];
}
oElementZonesIndex[_oElementToRegister.id].push({x:_local2.x, y:_local2.y});
}
function getZone(_nPosX, _nPosY) {
var _local3 = Math.floor(_nPosX / nZoneWidth) * nZoneWidth;
var _local2 = Math.floor(_nPosY / nZoneHeight) * nZoneHeight;
return({x:_local3, y:_local2});
}
function getSurroundingZones(_oZone) {
var _local3 = [];
_local3.push({x:_oZone.x - nZoneWidth, y:_oZone.y - nZoneHeight});
_local3.push({x:_oZone.x, y:_oZone.y - nZoneHeight});
_local3.push({x:_oZone.x + nZoneWidth, y:_oZone.y - nZoneHeight});
_local3.push({x:_oZone.x - nZoneWidth, y:_oZone.y});
_local3.push({x:_oZone.x + nZoneWidth, y:_oZone.y});
_local3.push({x:_oZone.x - nZoneWidth, y:_oZone.y + nZoneHeight});
_local3.push({x:_oZone.x, y:_oZone.y + nZoneHeight});
_local3.push({x:_oZone.x + nZoneWidth, y:_oZone.y + nZoneHeight});
return(_local3);
}
function getVisibleZones(_oZone) {
var _local3 = [];
var _local5 = Math.abs(Math.floor(nCurrentX / nZoneWidth) - (nCurrentX / nZoneWidth));
var _local4 = Math.abs(Math.floor(nCurrentY / nZoneHeight) - (nCurrentY / nZoneHeight));
if (_local5 < 0.5) {
_local3.push({x:_oZone.x - nZoneWidth, y:_oZone.y});
if (_local4 < 0.5) {
_local3.push({x:_oZone.x - nZoneWidth, y:_oZone.y - nZoneHeight});
}
if (_local4 > 0.5) {
_local3.push({x:_oZone.x - nZoneWidth, y:_oZone.y + nZoneHeight});
}
} else if (_local5 > 0.5) {
_local3.push({x:_oZone.x + nZoneWidth, y:_oZone.y});
if (_local4 < 0.5) {
_local3.push({x:_oZone.x + nZoneWidth, y:_oZone.y - nZoneHeight});
}
if (_local4 > 0.5) {
_local3.push({x:_oZone.x + nZoneWidth, y:_oZone.y + nZoneHeight});
}
}
if (_local4 < 0.5) {
_local3.push({x:_oZone.x, y:_oZone.y - nZoneHeight});
}
if (_local4 > 0.5) {
_local3.push({x:_oZone.x, y:_oZone.y + nZoneHeight});
}
return(_local3);
}
function getCurrentZone() {
return(getZone(nCurrentX, nCurrentY));
}
function zoneChanged(_oVisibleZones) {
var _local2 = aVisibleZones.length - 1;
while (_local2 >= 0) {
if ((aVisibleZones[_local2].x != _oVisibleZones[_local2].x) || (aVisibleZones[_local2].y != _oVisibleZones[_local2].y)) {
return(true);
}
_local2--;
}
return(false);
}
function mustStayEnabled(_nX, _nY, _oVisibleZones) {
var _local4 = false;
var _local2 = aVisibleZones.length - 1;
while (_local2 >= 0) {
if ((_oVisibleZones[_local2].x == _nX) && (_oVisibleZones[_local2].y == _nY)) {
_local4 = true;
break;
}
_local2--;
}
return(_local4);
}
}
Symbol 1625 MovieClip [__Packages.com.disney.gem.games.tirade.screens.TitleScreen] Frame 0
class com.disney.gem.games.tirade.screens.TitleScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function TitleScreen (_mcRef) {
super(_mcRef);
}
function onBtHelp() {
com.disney.gem.games.tirade.Controller(oController).showInstructions();
oController.playClickSound(true);
}
function onBtPlay() {
com.disney.gem.games.tirade.Controller(oController).startNewGame();
oController.playClickSound(true);
}
function state_idle_init() {
super.state_idle_init();
mcRef.mcState.btHelp.onRelease = com.sarbakan.utils.Delegate.create(this, onBtHelp);
mcRef.mcState.btHelp.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound, true);
mcRef.mcState.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
mcRef.mcState.btPlay.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound, true);
}
}
Symbol 1626 MovieClip [__Packages.com.disney.gem.games.tirade.screens.HelpScreen] Frame 0
class com.disney.gem.games.tirade.screens.HelpScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function HelpScreen (_mcRef) {
super(_mcRef);
}
function onBtPlay() {
if (oController.getGamePhase() == com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING) {
oController.startNewGame();
} else {
oController.hideInstructions();
}
oController.playClickSound(true);
}
function state_idle_init() {
super.state_idle_init();
mcRef.mcState.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
mcRef.mcState.btPlay.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound, true);
}
}
Symbol 1627 MovieClip [__Packages.com.disney.gem.games.tirade.popups.MenuPopup] Frame 0
class com.disney.gem.games.tirade.popups.MenuPopup extends com.sarbakan.utils.ScreenController
{
var oController, hide, bDontReallowInstructions, mcRef;
function MenuPopup (_mcRef) {
super(_mcRef);
}
function onBtSounds() {
oController.toggleSound();
renderSoundStatus();
oController.playClickSound();
}
function onBtHelp() {
oController.allowInstructions();
com.disney.gem.games.tirade.Controller(oController).showInstructions();
hide();
oController.playClickSound();
}
function onBtQuit() {
hide();
var _local2 = com.disney.gem.games.tirade.Controller(oController);
_local2.showPopup(new com.disney.gem.games.tirade.popups.ConfirmPopup(_local2.mcTimeline.mcPopups.mcConfirm), true);
bDontReallowInstructions = true;
oController.playClickSound();
}
function onBtResume() {
com.disney.gem.games.tirade.Controller(oController).hideInGameMenu();
hide();
oController.playClickSound();
}
function state_in_init() {
super.state_in_init();
setButtons();
oController.disallowInstructions();
}
function state_idle_init() {
super.state_idle_init();
setButtons();
}
function state_idle() {
renderSoundStatus();
}
function state_out_init() {
super.state_out_init();
setButtons();
if (!bDontReallowInstructions) {
oController.allowInstructions();
}
}
function setButtons() {
mcRef.mcState.mcContent.btHelp.onRelease = com.sarbakan.utils.Delegate.create(this, onBtHelp);
mcRef.mcState.mcContent.btHelp.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound);
mcRef.mcState.mcContent.btQuit.onRelease = com.sarbakan.utils.Delegate.create(this, onBtQuit);
mcRef.mcState.mcContent.btQuit.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound);
mcRef.mcState.mcContent.btResume.onRelease = com.sarbakan.utils.Delegate.create(this, onBtResume);
mcRef.mcState.mcContent.btResume.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound);
renderSoundStatus();
}
function renderSoundStatus() {
var _local2;
if (oController.bSoundMuted) {
_local2 = "off";
} else {
_local2 = "on";
}
mcRef.mcState.mcContent.mcSoundStatus.gotoAndStop(_local2);
mcRef.mcState.mcContent.mcSoundStatus.btSound.onRelease = com.sarbakan.utils.Delegate.create(this, onBtSounds);
mcRef.mcState.mcContent.mcSoundStatus.btSound.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound);
}
}
Symbol 1628 MovieClip [__Packages.com.disney.gem.games.tirade.popups.ConfirmPopup] Frame 0
class com.disney.gem.games.tirade.popups.ConfirmPopup extends com.sarbakan.utils.ScreenController
{
var oMenuOrigin, oController, hide, mcRef;
function ConfirmPopup (_mcRef, _oMenuOrigin) {
super(_mcRef);
oMenuOrigin = _oMenuOrigin;
}
function onBtNo() {
com.disney.gem.games.tirade.Controller(oController).hideInGameMenu();
hide();
oController.playClickSound();
}
function onBtYes() {
com.disney.gem.games.tirade.Controller(oController).quitGame();
hide();
oController.playClickSound();
}
function state_in_init() {
super.state_in_init();
setButtons();
oController.disallowInstructions();
}
function state_idle_init() {
super.state_idle_init();
setButtons();
}
function state_out_init() {
super.state_out_init();
setButtons();
oController.allowInstructions();
}
function setButtons() {
mcRef.mcState.mcContent.btYes.onRelease = com.sarbakan.utils.Delegate.create(this, onBtYes);
mcRef.mcState.mcContent.btYes.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound);
mcRef.mcState.mcContent.btNo.onRelease = com.sarbakan.utils.Delegate.create(this, onBtNo);
mcRef.mcState.mcContent.btNo.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound);
}
}
Symbol 1629 MovieClip [__Packages.com.disney.gem.games.tirade.screens.EndScreen] Frame 0
class com.disney.gem.games.tirade.screens.EndScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function EndScreen (_mcRef) {
super(_mcRef);
}
function onBtPlay() {
com.disney.gem.games.tirade.Controller(oController).startNewGame();
oController.playClickSound(true);
}
function state_idle_init() {
super.state_idle_init();
mcRef.mcState.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
mcRef.mcState.btPlay.onRollOver = com.sarbakan.utils.Delegate.create(oController, oController.playRollSound, true);
mcRef.mcState.mcScore.txtScore.text = com.disney.gem.games.tirade.Controller(oController).getScore();
}
}
Symbol 1630 MovieClip [__Packages.com.disney.gem.games.tirade.elements.Decoration] Frame 0
class com.disney.gem.games.tirade.elements.Decoration extends com.disney.gem.games.tirade.sarbakan.visual.element.StaticElement
{
var setLinkage, setMC, removeReferenceMC, attachMC;
function Decoration (_mc, _sLinkage) {
super("decoration" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage(_sLinkage);
setMC(_mc);
}
function init() {
removeReferenceMC();
attachMC();
}
}
Symbol 1631 MovieClip [__Packages.com.disney.gem.games.tirade.elements.characters.Ennemy2] Frame 0
class com.disney.gem.games.tirade.elements.characters.Ennemy2 extends com.disney.gem.games.tirade.elements.characters.BaseEnnemy
{
var setLinkage, oDecisionMaker;
function Ennemy2 (_mc) {
super(_mc);
setLinkage("mcEnnemy2");
setBehaviorRegular();
}
function setBehaviorRegular() {
oDecisionMaker.clear();
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionLookTowardPlayer());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionDefenseBlock(0.22 * com.disney.gem.games.tirade.Controller.getInstance().getLevel()));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionAttack(1));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionWait(0.1));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionTaunt(0.03));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionWalkBackAndForth());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionIdle());
}
function setBehaviorDefensive() {
oDecisionMaker.clear();
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionDefenseBlock(1));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionIdle());
}
var nSPEED_RUN = 5;
var nFRAME_TAUNT_SOUND = 10;
}
Symbol 1632 MovieClip [__Packages.com.disney.gem.games.tirade.decisions.DecisionWalkBackAndForth] Frame 0
class com.disney.gem.games.tirade.decisions.DecisionWalkBackAndForth extends com.disney.gem.games.tirade.sarbakan.ai.Decision
{
var nDistanceNear, n, oOwner, nSwitchDelayCount, bDecisionMade;
function DecisionWalkBackAndForth (_nDistanceNear) {
super();
if (_nDistanceNear != undefined) {
nDistanceNear = _nDistanceNear;
} else {
nDistanceNear = nDISTANCE_NEAR_ATTACK;
}
n = 0;
}
function isCompleted() {
if ((oOwner.isHittingWall() != undefined) || ((oOwner.isOnPlayerFloor() && (oOwner.isNearPlayer(nDistanceNear))) && (Math.random() < nCHANCE_SIGHT))) {
return(true);
}
if ((((++nSwitchDelayCount) >= nDELAY_MINIMUM_SWITCH) && (Math.random() < nCHANCE_DONE)) || (oOwner.isOnFloorEgde())) {
return(true);
}
}
function checkConditions() {
if ((oOwner.elementOnScreen() && (oOwner.nSpeedY == 0)) && (oOwner.isHittingWall() == undefined)) {
nSwitchDelayCount = 0;
oOwner.setState("run");
if ((!oOwner.isLookingAtPlayer()) || (!oOwner.isNearPlayer())) {
oOwner.setDirection(oOwner.nDirection * -1);
}
bDecisionMade = true;
}
}
var TYPE = "WalkBackAndForth";
static var nDELAY_MINIMUM_SWITCH = 50;
static var nDISTANCE_NEAR_ATTACK = 250;
static var nCHANCE_DONE = 0.1;
static var nCHANCE_SIGHT = 0.1;
}
Symbol 1633 MovieClip [__Packages.com.disney.gem.games.tirade.elements.BreakablePlatform] Frame 0
class com.disney.gem.games.tirade.elements.BreakablePlatform extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, setMC, bFake, removeReferenceMC, attachMC, getElement, collideWithElementCollider, setState, oShakeSound, stateFinished, stateStarting, oOwner, oAttachProperties, id;
function BreakablePlatform (_mc, _sLinkage) {
super("breakablePlatform" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage(_sLinkage);
setMC(_mc);
bFake = _mc.bFake;
}
function init() {
removeReferenceMC();
attachMC();
attachCollider();
}
function state_idle() {
if ((!getElement("player").isJumping()) && (collideWithElementCollider("player", "bottom"))) {
setState(sSTATE_SHAKE);
}
}
function state_shake_init() {
oShakeSound = com.sarbakan.sound.SoundManager.doPlaySound("Plateform_Shake.wav", com.disney.gem.games.tirade.GameData.nVOLUME_PLATFORM_SHAKE, 9999);
}
function state_shake() {
if (stateFinished()) {
if (bFake && (!collideWithElementCollider("player", "bottom"))) {
setState(sSTATE_IDLE);
} else if (!bFake) {
setState(sSTATE_DESTROY);
}
}
}
function state_shake_end() {
oShakeSound.doFadeTo(0, true);
}
function state_destroy() {
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Platform_Go_Down.wav", com.disney.gem.games.tirade.GameData.nVOLUME_PLATFORM_DESTROY);
}
if (stateStarting()) {
detachCollider();
}
if (stateFinished()) {
setState(sSTATE_DESTROYED);
}
}
function state_destroyed() {
if (stateFinished()) {
setState(sSTATE_RESPAWN);
attachCollider();
}
}
function state_respawn() {
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Platform_Go_Up.wav", com.disney.gem.games.tirade.GameData.nVOLUME_PLATFORM_RESPAWN);
}
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function attachCollider() {
var _local2 = oOwner.getCollisionMap("floor");
_local2.attachMC("mcBreakablePlatormCollider", oAttachProperties._x, oAttachProperties._y, id);
}
function detachCollider() {
var _local2 = oOwner.getCollisionMap("floor").getMC();
_local2[id].removeMovieClip();
}
static var sSTATE_IDLE = "idle";
static var sSTATE_SHAKE = "shake";
static var sSTATE_DESTROY = "destroy";
static var sSTATE_DESTROYED = "destroyed";
static var sSTATE_RESPAWN = "respawn";
}
Symbol 1634 MovieClip [__Packages.com.disney.gem.games.tirade.elements.BlowPipe] Frame 0
class com.disney.gem.games.tirade.elements.BlowPipe extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, setMC, nShootDelay, nShootDelayCount, removeReferenceMC, attachMC, setState, stateCurrentFrame, stateFinished, mc;
function BlowPipe (_mc) {
super("blowPipe" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage("mcBlowPipe");
setMC(_mc);
nShootDelay = nDEFAULT_SHOOT_DELAY;
if (_mc.nStartDelay) {
nShootDelayCount = _mc.nStartDelay * -1;
} else {
nShootDelayCount = 0;
}
}
function init() {
removeReferenceMC();
attachMC();
}
function state_idle() {
if ((++nShootDelayCount) == nShootDelay) {
setState(sSTATE_SHOOT);
nShootDelayCount = 0;
}
}
function state_shoot() {
if (stateCurrentFrame() == nFRAME_CREATE_ARROW) {
com.sarbakan.sound.SoundManager.doPlaySound("Sarbacane_Throw.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BLOWPIPE);
createArrow();
}
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function createArrow() {
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.BlowPipeArrow(mc._x, mc._y, mc._rotation));
}
static var nFRAME_CREATE_ARROW = 13;
static var nDEFAULT_SHOOT_DELAY = 100;
static var sSTATE_IDLE = "idle";
static var sSTATE_SHOOT = "shoot";
}
Symbol 1635 MovieClip [__Packages.com.disney.gem.games.tirade.elements.BlowPipeArrow] Frame 0
class com.disney.gem.games.tirade.elements.BlowPipeArrow extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, bAlwaysActive, oAttachProperties, nDirectionX, nDirectionY, nDistanceTravelled, attachMC, setState, mc, getElement, remove, stateStarting, stateFinished;
function BlowPipeArrow (_nX, _nY, _nRotation) {
super("blowPipeArrow" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage("mcBlowPipeArrow");
bAlwaysActive = true;
oAttachProperties._x = _nX;
oAttachProperties._y = _nY;
oAttachProperties._rotation = _nRotation;
nDirectionX = 0;
nDirectionY = 0;
switch (_nRotation) {
case 0 :
nDirectionX = 1;
break;
case -90 :
nDirectionY = -1;
break;
case 180 :
nDirectionX = -1;
break;
case 90 :
nDirectionY = 1;
}
nDistanceTravelled = 0;
}
function init() {
attachMC();
setState(sSTATE_FLY);
}
function disable() {
}
function state_fly() {
mc._x = mc._x + (nDirectionX * nSPEED);
mc._y = mc._y + (nDirectionY * nSPEED);
nDistanceTravelled = nDistanceTravelled + nSPEED;
var _local2 = getElement("player");
if (_local2.isAttacking() && (mc.hitTest(_local2.mc.sword))) {
_local2.setState(com.disney.gem.games.tirade.elements.characters.Player.sSTATE_BLOCK);
setState(sSTATE_DESTROY);
} else if (_local2.isAttacking() && (mc.hitTest(_local2.mc.autoDefense))) {
_local2.autoDefend();
setState(sSTATE_DESTROY);
} else if (mc.hitTest(_local2.mc.body)) {
_local2.hurt(com.disney.gem.games.tirade.GameData.nHURT_PLAYER_ARROW);
remove();
} else if (nDistanceTravelled > nMAX_DISTANCE) {
remove();
}
}
function state_destroy() {
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Sarbacane_Hit.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BLOWPIPE_ARROW, 1, true);
}
if (stateFinished()) {
remove();
}
}
static var nSPEED = 8;
static var nMAX_DISTANCE = 500;
static var sSTATE_FLY = "fly";
static var sSTATE_DESTROY = "destroy";
}
Symbol 1636 MovieClip [__Packages.com.disney.gem.games.tirade.elements.BoobyTrap] Frame 0
class com.disney.gem.games.tirade.elements.BoobyTrap extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
static var oFinalTrap;
var setLinkage, setMC, DEFAULT_STATE, nAppearDelay, nAppearDelayCount, mc, removeReferenceMC, attachMC, setState, stateStarting, stateFinished, bLockedActive, getElement;
function BoobyTrap (_mc, _sLinkage) {
super("boobyTrap" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage(_sLinkage);
setMC(_mc);
DEFAULT_STATE = sSTATE_HIDDEN;
nAppearDelay = nDEFAULT_APPEAR_DELAY;
if (_mc.nStartDelay) {
nAppearDelayCount = _mc.nStartDelay * -1;
} else {
nAppearDelayCount = 0;
}
if (mc.bFinalTrap) {
oFinalTrap = this;
}
if (mc.bReverse) {
mc._xscale = -100;
mc._x = mc._x + mc._width;
}
}
function init() {
removeReferenceMC();
attachMC();
}
static function lockFinalTrap() {
if (oFinalTrap.stateIsNot(sSTATE_APPEAR, sSTATE_ACTIVE)) {
oFinalTrap.setState(sSTATE_APPEAR);
}
oFinalTrap.bLockedActive = true;
}
function state_hidden() {
if ((++nAppearDelayCount) == nAppearDelay) {
setState(sSTATE_APPEAR);
nAppearDelayCount = 0;
}
}
function state_appear() {
checkIfHurtPlayer();
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Trap_Out.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BOOBYTRAP_OUT);
}
if (stateFinished()) {
setState(sSTATE_ACTIVE);
}
}
function state_active() {
checkIfHurtPlayer();
if (!bLockedActive) {
if (stateFinished()) {
setState(sSTATE_DISAPPEAR);
}
}
}
function state_disappear() {
checkIfHurtPlayer();
if (stateStarting()) {
com.sarbakan.sound.SoundManager.doPlaySound("Trap_In.wav", com.disney.gem.games.tirade.GameData.nVOLUME_BOOBYTRAP_OUT);
}
if (stateFinished()) {
setState(sSTATE_HIDDEN);
}
}
function checkIfHurtPlayer() {
var _local2 = getElement("player");
if (((mc._rotation != 0) || (!_local2.isJumping())) && (mc.hitTest(_local2.mc.body))) {
_local2.hurt(com.disney.gem.games.tirade.GameData.nHURT_PLAYER_BOOBYTRAP);
}
}
static var nDEFAULT_APPEAR_DELAY = 100;
static var nPLAYER_ELEVATION_OFFSET = 75;
static var sSTATE_HIDDEN = "hidden";
static var sSTATE_APPEAR = "appear";
static var sSTATE_ACTIVE = "active";
static var sSTATE_DISAPPEAR = "disappear";
}
Symbol 1637 MovieClip [__Packages.com.disney.gem.games.tirade.elements.WaterZone] Frame 0
class com.disney.gem.games.tirade.elements.WaterZone extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, setMC, removeReferenceMC, attachMC, mc, collideWithElementCollider, getElement;
function WaterZone (_mc) {
super("waterZone" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage("mcWaterZone");
setMC(_mc);
}
function init() {
removeReferenceMC();
attachMC();
mc._visible = false;
}
function state_idle() {
if (collideWithElementCollider("player", "bottom")) {
getElement("player").dieWater();
}
}
static var sSTATE_IDLE = "idle";
}
Symbol 1638 MovieClip [__Packages.com.disney.gem.games.tirade.elements.ScriptExecuter] Frame 0
class com.disney.gem.games.tirade.elements.ScriptExecuter extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, setMC, oScriptToExecute, removeReferenceMC, attachMC, mc, getElement, remove;
function ScriptExecuter (_mc) {
super("scriptExecuter" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage("mcScriptExecuter");
setMC(_mc);
oScriptToExecute = _mc.oScriptToExecute;
}
function init() {
removeReferenceMC();
attachMC();
mc._visible = false;
}
function state_idle() {
if (mc.hitTest(getElement("player").mc)) {
oScriptToExecute.execute();
remove();
}
}
static var sSTATE_IDLE = "idle";
}
Symbol 1639 MovieClip [__Packages.com.disney.gem.games.tirade.sarbakan.structure.Script] Frame 0
class com.disney.gem.games.tirade.sarbakan.structure.Script
{
function Script () {
}
static function execute(_oData) {
}
static function reset() {
}
}
Symbol 1640 MovieClip [__Packages.com.disney.gem.games.tirade.scripts.StartLevel1Boss] Frame 0
class com.disney.gem.games.tirade.scripts.StartLevel1Boss extends com.disney.gem.games.tirade.sarbakan.structure.Script
{
function StartLevel1Boss () {
super();
}
static function execute(_oData) {
com.disney.gem.games.tirade.elements.BoobyTrap.lockFinalTrap();
var _local1 = com.disney.gem.games.tirade.Controller.getInstance().oGame.oLayerGame.getCollisionMap("wall");
_local1.drawRect(1230, 80, 55, 250);
_local1.mc.mcBossWalls.swapDepths(10000);
_local1.mc.mcBossWalls.removeMovieClip();
}
}
Symbol 1641 MovieClip [__Packages.com.disney.gem.games.tirade.elements.FinalDoor] Frame 0
class com.disney.gem.games.tirade.elements.FinalDoor extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, setMC, bInvisibleDoor, removeReferenceMC, attachMC, mc, setState, stateStarting, stateFinished, bPlayerEntered, collideWithElement;
function FinalDoor (_mc, _bInvisibleDoor) {
super("finalDoor");
setLinkage("mcFinalDoor");
setMC(_mc);
bInvisibleDoor = _bInvisibleDoor;
}
function init() {
removeReferenceMC();
attachMC();
if (bInvisibleDoor) {
mc._visible = false;
}
}
function open() {
setState(sSTATE_OPEN);
}
function state_idle() {
if (bInvisibleDoor) {
setState(sSTATE_IDLE_OPENED);
}
}
function state_open() {
if (stateStarting() && (!bInvisibleDoor)) {
com.sarbakan.sound.SoundManager.doPlaySound("Door.wav", com.disney.gem.games.tirade.GameData.nVOLUME_DOOR);
}
if (stateFinished()) {
setState(sSTATE_IDLE_OPENED);
}
}
function state_idleOpened() {
if (!bPlayerEntered) {
if (collideWithElement("player", mc.door)) {
bPlayerEntered = true;
com.disney.gem.games.tirade.Controller.getInstance().onLevelEnd();
}
}
}
static var sSTATE_IDLE = "idle";
static var sSTATE_OPEN = "open";
static var sSTATE_IDLE_OPENED = "idleOpened";
}
Symbol 1642 MovieClip [__Packages.com.disney.gem.games.tirade.elements.RespawnPoint] Frame 0
class com.disney.gem.games.tirade.elements.RespawnPoint extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, setMC, removeReferenceMC, attachMC, mc, getElement, remove;
function RespawnPoint (_mc) {
super("respawnPoint" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage("mcRespawnPoint");
setMC(_mc);
}
function init() {
removeReferenceMC();
attachMC();
mc._visible = false;
}
function state_idle() {
if (getElement("player").mc.hitTest(mc)) {
getElement("player").setRespawnLocation(mc._x, mc._y);
remove();
}
}
static var sSTATE_IDLE = "idle";
}
Symbol 1643 MovieClip [__Packages.com.disney.gem.games.tirade.elements.BonusGold] Frame 0
class com.disney.gem.games.tirade.elements.BonusGold extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, setMC, removeReferenceMC, attachMC, collideWithElement, setState, stateFinished, remove;
function BonusGold (_mc) {
super("bonusGold" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage("mcBonusGold");
setMC(_mc);
}
function init() {
removeReferenceMC();
attachMC();
}
function state_idle() {
if (collideWithElement("player")) {
com.sarbakan.sound.SoundManager.doPlaySound("Golden_Piece_Bonus.wav", com.disney.gem.games.tirade.GameData.nVOLUME_GOLD_BONUS);
setState(sSTATE_PICK);
}
}
function state_pick() {
if (stateFinished()) {
com.disney.gem.games.tirade.Controller.getInstance().increaseScore(com.disney.gem.games.tirade.GameData.nSCORE_GOLD);
remove();
}
}
static var sSTATE_IDLE = "idle";
static var sSTATE_PICK = "pick";
}
Symbol 1644 MovieClip [__Packages.com.disney.gem.games.tirade.elements.characters.Ennemy1] Frame 0
class com.disney.gem.games.tirade.elements.characters.Ennemy1 extends com.disney.gem.games.tirade.elements.characters.BaseEnnemy
{
var setLinkage, oDecisionMaker;
function Ennemy1 (_mc) {
super(_mc);
setLinkage("mcEnnemy1");
setBehaviorRegular();
}
function setBehaviorRegular() {
oDecisionMaker.clear();
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionLookTowardPlayer());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionDefenseBlock(0.22 * com.disney.gem.games.tirade.Controller.getInstance().getLevel()));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionAttack(1));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionWait(0.1));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionTaunt(0.03));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionWalkBackAndForth());
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionIdle());
}
function setBehaviorDefensive() {
oDecisionMaker.clear();
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionDefenseBlock(1));
oDecisionMaker.addDecision(new com.disney.gem.games.tirade.decisions.DecisionIdle());
}
var nSPEED_RUN = 3;
var nFRAME_TAUNT_SOUND = 10;
}
Symbol 1645 MovieClip [__Packages.com.disney.gem.games.tirade.elements.DeathZone] Frame 0
class com.disney.gem.games.tirade.elements.DeathZone extends com.disney.gem.games.tirade.sarbakan.visual.element.DynamicElement
{
var setLinkage, setMC, removeReferenceMC, attachMC, mc, getElement, collideWithElementCollider, oOwner;
function DeathZone (_mc) {
super("deathZone" + com.disney.gem.games.tirade.sarbakan.visual.element.BaseElement.getNextID());
setLinkage("mcDeathZone");
setMC(_mc);
}
function init() {
removeReferenceMC();
attachMC();
drawCollider();
mc._visible = false;
}
function state_idle() {
var _local2 = getElement("player");
if (collideWithElementCollider("player", "bottom") && (!_local2.isDieing())) {
getElement("player").die(true);
}
}
function drawCollider() {
var _local2 = oOwner.getCollisionMap("floor");
_local2.drawRect(mc._x, mc._y + nFLOOR_OFFSET_Y, mc._width, mc._height);
}
static var nFLOOR_OFFSET_Y = 10;
static var sSTATE_IDLE = "idle";
}
Symbol 1646 MovieClip [__Packages.com.disney.gem.games.tirade.scripts.StartLevel3Boss] Frame 0
class com.disney.gem.games.tirade.scripts.StartLevel3Boss extends com.disney.gem.games.tirade.sarbakan.structure.Script
{
function StartLevel3Boss () {
super();
}
static function execute(_oData) {
com.disney.gem.games.tirade.elements.Elevator.lockFinalElevator();
var _local2 = com.disney.gem.games.tirade.Controller.getInstance().oGame.oLayerGame.getCollisionMap("floor");
_local2.drawRect(4141, 491, 163, 15);
var _local1 = com.disney.gem.games.tirade.Controller.getInstance().oGame.oLayerGame.getCollisionMap("wall");
_local1.drawRect(4230, 495, 25, 160);
_local1.getMC().mcEndWall.swapDepths(90210);
_local1.getMC().mcEndWall.removeMovieClip();
_local1.mc.mcBossWalls.swapDepths(10000);
_local1.mc.mcBossWalls.removeMovieClip();
}
}
Symbol 93 MovieClip Frame 1
stop();
Symbol 96 MovieClip Frame 1
_visible = false;
Symbol 429 MovieClip [_pause] Frame 1
new com.disney.gem.games.tirade.sarbakan.visual.PauseManager(this);
Symbol 1435 MovieClip Frame 28
com.disney.gem.games.tirade.Controller.getInstance().onTransitionInSound();
Symbol 1436 MovieClip Frame 2
com.disney.gem.games.tirade.Controller.getInstance().onTransitionOutSound();
Symbol 1448 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addStaticElement(new com.disney.gem.games.tirade.elements.Decoration(this, "mcFireTorch"));
Symbol 1457 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.Elevator(this, "mcElevator"));
Symbol 1458 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.characters.Ennemy2(this));
Symbol 1459 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.BreakablePlatform(this, "mcBreakablePlatorm"));
Symbol 1460 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.BreakablePlatform(this, "mcBreakablePlatormFake"));
Symbol 1461 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.BlowPipe(this));
Symbol 1462 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.BoobyTrap(this, "mcBoobyTrapSpears"));
Symbol 1464 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.WaterZone(this));
Symbol 1465 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.ScriptExecuter(this));
Symbol 1466 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.FinalDoor(this));
Symbol 1467 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.characters.BossUndead(this));
Symbol 1469 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.RespawnPoint(this));
Symbol 1470 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.BonusGold(this));
Instance of Symbol 1457 MovieClip "a" in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 240;
}
Instance of Symbol 1457 MovieClip "b" in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 383;
}
Instance of Symbol 1459 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
bFake = true;
}
Instance of Symbol 1460 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
bFake = true;
}
Instance of Symbol 1461 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 15;
}
Instance of Symbol 1461 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 25;
}
Instance of Symbol 1461 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 35;
}
Instance of Symbol 1457 MovieClip "d" in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 287;
}
Instance of Symbol 1457 MovieClip "c" in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 430;
}
Instance of Symbol 1462 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 40;
}
Instance of Symbol 1461 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 20;
}
Instance of Symbol 1461 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 30;
}
Instance of Symbol 1461 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 40;
}
Instance of Symbol 1461 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 60;
}
Instance of Symbol 1461 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 70;
}
Instance of Symbol 1461 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 80;
}
Instance of Symbol 1462 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 0;
}
Instance of Symbol 1462 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 0;
bFinalTrap = true;
}
Instance of Symbol 1465 MovieClip in Symbol 1472 MovieClip Frame 1
onClipEvent (load) {
oScriptToExecute = com.disney.gem.games.tirade.scripts.StartLevel1Boss;
}
Symbol 1474 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.oCam.addViewZone(this);
Symbol 1490 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.Elevator(this, "mcElevator2"));
Symbol 1491 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.characters.Ennemy1(this));
Symbol 1492 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.Pliers(this));
Symbol 1493 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.FinalDoor(this, true));
Symbol 1495 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.DeathZone(this));
Symbol 1496 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.BoobyTrap(this, "mcBoobyTrapSwords"));
Instance of Symbol 1483 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 30;
}
Instance of Symbol 1462 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 2;
}
Instance of Symbol 1462 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 32;
}
Instance of Symbol 1490 MovieClip "a" in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 230;
}
Instance of Symbol 1490 MovieClip "b" in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 275;
}
Instance of Symbol 1490 MovieClip "c" in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 225;
}
Instance of Symbol 1490 MovieClip "d" in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 140;
}
Instance of Symbol 1492 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nMovementZoneWidth = 545;
}
Instance of Symbol 1461 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 10;
}
Instance of Symbol 1461 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 20;
}
Instance of Symbol 1461 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 30;
}
Instance of Symbol 1462 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 30;
}
Instance of Symbol 1462 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 60;
}
Instance of Symbol 1496 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 35;
}
Instance of Symbol 1496 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 70;
}
Instance of Symbol 1496 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 105;
}
Instance of Symbol 1496 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 30;
}
Instance of Symbol 1496 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 60;
bReverse = true;
}
Instance of Symbol 1496 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 90;
bReverse = true;
}
Instance of Symbol 1496 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 30;
}
Instance of Symbol 1496 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 90;
bReverse = true;
}
Instance of Symbol 1496 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 60;
bReverse = true;
}
Instance of Symbol 1462 MovieClip in Symbol 1497 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 62;
}
Instance of Symbol 1508 MovieClip in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 30;
}
Instance of Symbol 1457 MovieClip in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 420;
}
Instance of Symbol 1457 MovieClip in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 360;
}
Instance of Symbol 1457 MovieClip in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 330;
}
Instance of Symbol 1457 MovieClip "a" in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 295;
}
Instance of Symbol 1457 MovieClip in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 575;
}
Instance of Symbol 1457 MovieClip "b" in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 260;
}
Instance of Symbol 1457 MovieClip "c" in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nElevatorHeight = 246;
bFinalElevator = true;
}
Instance of Symbol 1465 MovieClip in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
oScriptToExecute = com.disney.gem.games.tirade.scripts.StartLevel3Boss;
}
Instance of Symbol 1496 MovieClip in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 30;
}
Instance of Symbol 1496 MovieClip in Symbol 1515 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 60;
}
Symbol 1530 MovieClip Frame 1
com.disney.gem.games.tirade.Controller.getInstance().oGame.addDynamicElement(new com.disney.gem.games.tirade.elements.characters.BossBarbossa(this));
Instance of Symbol 1522 MovieClip in Symbol 1531 MovieClip Frame 1
onClipEvent (load) {
nStartDelay = 30;
}
Instance of Symbol 1492 MovieClip in Symbol 1531 MovieClip Frame 1
onClipEvent (load) {
nMovementZoneWidth = 520;
}