Frame 1
var _oPreloaderScreen = (new com.disney.gem.games.robotDance.screens.PreloaderScreen(mcScreens.mcPreloader));
com.sarbakan.BaseDisneyController.bDEBUG = false;
new com.disney.gem.games.robotDance.Controller(this, _oPreloaderScreen);
Symbol 1066 MovieClip [__Packages.com.sarbakan.BaseDisneyController] Frame 0
class com.sarbakan.BaseDisneyController
{
static var oInstance;
var mcTimeline, oPreloaderScreen, oMainBroadcaster, oFrameRate, 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) {
oFrameRate = new com.sarbakan.utils.FrameRateDisplayer(_mcTimeline, nFRAME_RATE, nGAME_STAGE_WIDTH);
oMainBroadcaster.addListener(oFrameRate);
} 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() {
if (com.disney.gem.base.BaseObject == undefined) {
var _local2 = nCONTROLLER_MODE_STANDALONE;
} else {
var _local2 = nCONTROLLER_MODE_DXD;
}
return(_local2);
}
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);
}
}
function showScreen(_oScreenController, _bInOut, _sTransitionID, _fMidTransitionCallBack) {
if (oCurrentScreen) {
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, showScreen, _oScreenController, _bInOut, null, _fMidTransitionCallBack), _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);
_fMidTransitionCallBack();
}
oMainBroadcaster.addListener(oCurrentScreen);
}
}
function hideCurrentScreen(_fHideCallBack, _sTransition, _fEndCallBack) {
fScreenHideCallBack = _fHideCallBack;
if (_sTransition != undefined) {
oTransitionManager.playTransition(_sTransition, com.sarbakan.utils.Delegate.create(oCurrentScreen, oCurrentScreen.hide, com.sarbakan.utils.Delegate.create(this, onScreenHidden)), _fEndCallBack);
} else {
oCurrentScreen.hide(com.sarbakan.utils.Delegate.create(this, onScreenHidden));
}
}
function showPopup(_oPopupController, _bInOut) {
var _local4 = false;
var _local5 = aPopups.length - 1;
for ( ; _local5 >= 0 ; _local5--) {
var _local6 = aPopups[_local5];
if (_oPopupController.getRef() == _local6.getRef()) {
_local4 = true;
_local6.destroy();
oMainBroadcaster.removeListener(_local6);
aPopups[_local5] = _oPopupController;
break;
}
}
if (!_local4) {
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 _local2 = [mcTimeline.mcPopups, mcTimeline.mcScreens];
var _local3 = _local2.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
for (var j in _local2[_local3]) {
_local2[_local3][j].stop();
}
}
}
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 1067 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) {
checkStateChange();
}
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 _local2 = false;
var _local3 = arguments.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
if (arguments[_local3] == sState) {
_local2 = true;
break;
}
}
return(!_local2);
}
function destroy() {
delete mcRef;
}
function get Mc() {
return(mcRef);
}
function onUpdate() {
checkStateChange();
this["state_" + sState]();
}
function checkStateChange() {
if ((sNextState != undefined) && (sNextState != sState)) {
this[("state_" + sState) + "_end"]();
sState = sNextState;
sNextState = undefined;
mcRef.gotoAndStop(sState);
this[("state_" + sState) + "_init"]();
}
}
function onUpdatePaused() {
if (bPausable == false) {
onUpdate();
}
}
function onPause() {
if (bPausable) {
mcRef.mcState.stop();
}
}
function onUnPause() {
if (bPausable) {
mcRef.mcState.play();
}
}
}
Symbol 1068 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 i in mcTransitionContainer) {
mcTransitionContainer[i].stop();
}
}
function playTransition(_sTransitionID, _fMiddleCallBack, _fEndCallBack) {
mcTransition = mcTransitionContainer["mc" + com.sarbakan.utils.MoreString.upperFirstChar(_sTransitionID)];
fMiddleCallBack = _fMiddleCallBack;
fEndCallBack = _fEndCallBack;
if (mcTransition == undefined) {
} 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 1069 MovieClip [__Packages.com.sarbakan.utils.MoreString] Frame 0
class com.sarbakan.utils.MoreString
{
function MoreString () {
}
static function pad(_sToPad, _sCharPad, _nMinLength, _sSideToPad) {
var _local6 = String(_sToPad);
while (_local6.length < _nMinLength) {
if (_sSideToPad == "RIGHT") {
_local6 = _local6 + _sCharPad;
} else {
_local6 = _sCharPad + _local6;
}
}
return(_local6);
}
static function trim(_sToTrim, _sCharTrim, _sSideToTrim) {
var _local5 = String(_sToTrim);
if (_sSideToTrim == "RIGHT") {
while (_local5.substr(_local5.length - 2, 1) == _sCharTrim) {
_local5 = _local5.slice(-1);
}
} else {
while (_local5.substr(0, 1) == _sCharTrim) {
_local5 = _local5.slice(1);
}
}
return(_local5);
}
static function replace(_sString, _sFind, _sReplace) {
return(_sString.split(_sFind).join(_sReplace));
}
static function formatTime(_nTime) {
var _local3 = _nTime;
var _local4 = Math.floor(_local3 / 60);
var _local5 = Math.round(_local3 - (_local4 * 60));
return((pad(String(_local4), "0", 2) + ":") + pad(String(_local5), "0", 2));
}
static function formatNumber(__sNumber, __nMinimumChar) {
var _local4 = String(__sNumber);
var _local5 = "";
var _local6 = _local4.length;
_local6 = _local6 / 3;
if (_local6 <= 1) {
var _local7 = _local4;
if (_local7.length < __nMinimumChar) {
_local7 = "0" + _local7;
}
} else {
var _local8 = _local6;
for ( ; _local8 > 1 ; _local8--) {
_local5 = (" " + _local4.substr(-3)) + _local5;
_local4 = _local4.substr(0, -3);
}
var _local7 = _local4 + _local5;
if (_local7.length < __nMinimumChar) {
_local7 = "0" + _local7;
}
}
return(_local7);
}
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) {
if (_bDecimalOpt == undefined) {
var _local9 = true;
} else {
var _local9 = _bDecimalOpt;
}
var _local5 = String(_nMoney).split(".");
if (_local5[1] != undefined) {
var _local6 = _local5[1].substr(0, 2);
switch (_local6.length) {
case 0 :
_local6 = _local6 + "00";
break;
case 1 :
_local6 = _local6 + "0";
break;
case 2 :
break;
default :
_local6 = "00";
}
} else {
var _local6 = "00";
}
var _local8 = _local5[0];
var _local7 = "";
while (_local8.length > 3) {
_local7 = (_sDelimiteur + _local8.substr(_local8.length - 3)) + _local7;
_local8 = _local8.substr(0, _local8.length - 3);
}
_local7 = _local8 + _local7;
if (_local9) {
return(((_local7 + ".") + _local6) + "$");
}
return(_local7 + " $");
}
static function getOrdinalSuffix(_nNumber) {
var _local4 = String(_nNumber);
if ((_local4.substr(-2, 2) == 11) || ((_local4.substr(-2, 2) == 12) || (_local4.substr(-2, 2) == 13))) {
var _local3 = "th";
} else if (_local4.substr(-1, 1) == 1) {
var _local3 = "st";
} else if (_local4.substr(-1, 1) == 2) {
var _local3 = "nd";
} else if (_local4.substr(-1, 1) == 3) {
var _local3 = "rd";
} else {
var _local3 = "th";
}
return(_local3);
}
}
Symbol 1070 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 1071 MovieClip [__Packages.com.disney.gem.games.GameContainer] Frame 0
class com.disney.gem.games.GameContainer
{
function GameContainer () {
}
}
Symbol 1072 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 _local4 = new TextFormat();
_local4.font = DEBUG_FONT;
_local4.size = DEBUG_FONT_SIZE;
_local4.color = DEBUG_FONT_COLOR;
_local4.align = "right";
mcDebug.field.setNewTextFormat(_local4);
mcDebug.field.selectable = false;
mcDebug.createTextField("fieldShadow", 1, 1, 1, 400, 50);
var _local5 = new TextFormat();
_local5.font = DEBUG_FONT;
_local5.size = DEBUG_FONT_SIZE;
_local5.color = DEBUG_FONT_SHADOW_COLOR;
_local5.align = "right";
mcDebug.fieldShadow.setNewTextFormat(_local5);
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 _local2 = "";
var _local3 = String(nAverageFps).split(".");
if (_local3[1] == undefined) {
_local2 = nAverageFps + ".00";
} else if (_local3[1].length == 1) {
_local2 = (_local3[0] + ".0") + _local3[1];
} else {
_local2 = (_local3[0] + ".") + _local3[1].substr(0, 2);
}
return(_local2);
}
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 1073 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 _local4 = bInOut;
if (_bInOutOverride != undefined) {
_local4 = _bInOutOverride;
}
if (_local4) {
setState(sSTATE_OUT);
} else {
setState(sSTATE_HIDDEN, true);
fHideCallBack();
}
}
function getRef() {
return(mcRef);
}
function isInOutTransitionning() {
return((sState == sSTATE_IN) || (sState == sSTATE_OUT));
}
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 1074 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 _local4 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
var _local4 = arguments.callee.arg;
_local4 = _local4.concat(arguments);
return(_local3.apply(_local2, _local4));
};
_local4.target = obj;
_local4.func = func;
_local4.arg = arguments.slice(2);
return(_local4);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 1075 MovieClip [__Packages.com.disney.gem.games.robotDance.Controller] Frame 0
class com.disney.gem.games.robotDance.Controller extends com.sarbakan.BaseDisneyController
{
var showScreen, mcTimeline, allowInstructions, onGameStart, setLevel, bPaused, unpause, setGamePhase, nLevel, oGame, oMainBroadcaster, hideCurrentScreen, nGamePhase, pause, oMusicPack, setScore, onGameEnd, disallowInstructions;
function Controller (_mcTimeline, _oPreloaderScreen) {
super(_mcTimeline, _oPreloaderScreen);
com.sarbakan.sound.SoundManager.doInit(_mcTimeline.createEmptyMovieClip(sMC_SOUND_NAME, nMC_SOUND_DEPTH));
com.sarbakan.sound.SoundManager.setCategoryVolume(sSOUND_CAT_MUSIC, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_MUSIC);
com.sarbakan.sound.SoundManager.setCategoryVolume(sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
}
static function getInstance() {
return(com.disney.gem.games.robotDance.Controller(com.sarbakan.BaseDisneyController.oInstance));
}
function init() {
super.init();
showTitleScreen();
}
function showTitleScreen(_bShowTransition) {
if (_bShowTransition) {
showScreen(new com.disney.gem.games.robotDance.screens.TitleScreen(mcTimeline.mcScreens.mcTitle), false, sTRANSITION_DEFAULT);
playTransitionSound();
} else {
showScreen(new com.disney.gem.games.robotDance.screens.TitleScreen(mcTimeline.mcScreens.mcTitle));
}
allowInstructions();
startPackMusic();
}
function startNewGame() {
onGameStart();
setLevel(0);
startGame();
}
function startGame() {
if (bPaused) {
unpause();
}
setGamePhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME);
setLevel(nLevel + 1);
oGame = new com.disney.gem.games.robotDance.GameEngine(this, mcTimeline.mcGame);
oMainBroadcaster.addListener(oGame);
hideCurrentScreen(com.sarbakan.utils.Delegate.create(this, onLevelTransitionDone), sTRANSITION_DEFAULT);
playTransitionSound();
stopPackMusic();
}
function showInstructionsScreen() {
if (nGamePhase == com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME) {
oGame.haltGame();
pause();
showScreen(new com.disney.gem.games.robotDance.screens.HelpScreen(mcTimeline.mcScreens.mcHelp), false, sTRANSITION_DEFAULT);
playTransitionSound();
} else {
pause();
showScreen(new com.disney.gem.games.robotDance.screens.HelpScreen(mcTimeline.mcScreens.mcHelp), false, sTRANSITION_DEFAULT);
playTransitionSound();
}
}
function hideInstructionsScreen() {
if (nGamePhase == com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME) {
unpause();
hideCurrentScreen(null, sTRANSITION_DEFAULT);
playTransitionSound();
oGame.resumeGame();
} else {
startNewGame();
}
}
function playTransitionSound() {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSOUND_TRANSITION, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
}
function playClickSound() {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSOUND_CLICK, com.disney.gem.games.robotDance.GameData.nSOUND_CLICK_VOL);
}
function applyRollSound(_oButton) {
_oButton.onRollOver = com.sarbakan.utils.Delegate.create(this, playRollSound);
}
function startPackMusic() {
if (oMusicPack == undefined) {
oMusicPack = com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_MUSIC, com.disney.gem.games.robotDance.GameData.sMUSIC_PACK, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_MUSIC, 99999999);
oMusicPack.doAddListener(this);
}
oMusicPack.doFadeTo(100);
}
function stopPackMusic() {
oMusicPack.doFadeTo(0);
}
function resumeGame() {
if (nGamePhase == com.sarbakan.BaseDisneyController.nGAME_PHASE_INGAME) {
oGame.resumeGame();
}
}
function doSoundEvent(_nEvent, _oSound) {
if (_nEvent == com.sarbakan.sound.SoundManager.nEVENT_SOUND_COMPLETE) {
if (_oSound == oMusicPack) {
delete oMusicPack;
}
}
}
function onLevelTransitionDone() {
oGame.init();
}
function onGameLose() {
setScore(oGame.FinalScore);
onGameEnd();
disallowInstructions();
showScreen(new com.disney.gem.games.robotDance.screens.EndScreen(mcTimeline.mcScreens.mcLose), false, sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, cleanGame));
playTransitionSound();
startPackMusic();
}
function onGameWon() {
setScore(oGame.FinalScore);
onGameEnd();
disallowInstructions();
showScreen(new com.disney.gem.games.robotDance.screens.WinScreen(mcTimeline.mcScreens.mcWin), false, sTRANSITION_DEFAULT, com.sarbakan.utils.Delegate.create(this, cleanGame));
playTransitionSound();
}
function playRollSound() {
var _local2 = com.sarbakan.sound.SoundManager.isSoundPlaying(com.disney.gem.games.robotDance.GameData.sSOUND_ROLL);
if (_local2.bPlaying) {
com.sarbakan.sound.SoundItem(_local2.oSound).doStop();
}
com.sarbakan.sound.SoundManager.doPlaySoundInCat(sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSOUND_ROLL, com.disney.gem.games.robotDance.GameData.nSOUND_ROLL_VOL);
}
function cleanGame() {
oMainBroadcaster.removeListener(oGame);
oGame.destroy();
setGamePhase(com.sarbakan.BaseDisneyController.nGAME_PHASE_PACKAGING);
}
static var sTRANSITION_DEFAULT = "default";
static var sSOUND_CAT_SOUND = "SFX";
static var sSOUND_CAT_MUSIC = "Music";
static var sMC_SOUND_NAME = "mcSoundManager";
static var nMC_SOUND_DEPTH = 80000;
static var nMIN_FPS_PERF_TRIGGER = 15;
}
Symbol 1076 MovieClip [__Packages.com.disney.gem.games.robotDance.GameEngine] Frame 0
class com.disney.gem.games.robotDance.GameEngine
{
var oController, mcGame, oKeysGenerator, oStich, oRobot, oCursor, oComboBox, nMultiplierIndex, nMultiplier, bGameFinished, mcBackground, nCameraShakeTimer, bScratchSoundDone, bStartGameMusic, bStartBonusMusic, bArmsDestroyed, bBonusRound, bPerfect, nStreak, nScore, nShownScore, nBonusChances, nDelayInput, oMusicGame, oMusicBonus, oMusicLevelTrans, oScratchSound;
function GameEngine (_oController, _mcGame) {
oController = _oController;
mcGame = _mcGame;
mcGame.mcHud.btMenu.onRelease = com.sarbakan.utils.Delegate.create(this, onBtMenu);
mcGame.mcHud.txtScore.text = oController.getScore();
mcGame.mcHud.mcLevel.txtLevel.text = oController.getLevel();
oKeysGenerator = new com.disney.gem.games.robotDance.game.KeysGen(mcGame.mcHud.mcKeyGen, this);
oStich = new com.disney.gem.games.robotDance.game.Stitch(mcGame.mcStich, this);
oRobot = new com.disney.gem.games.robotDance.game.Robot(mcGame.mcRobot, this);
oController.oMainBroadcaster.addListener(oStich);
oCursor = new com.disney.gem.games.robotDance.game.Cursor(mcGame.mcHud.mcKeyGen.mcCursor);
oController.oMainBroadcaster.addListener(oCursor);
oComboBox = new com.disney.gem.games.robotDance.game.ComboBox(mcGame.mcCombo);
oController.oMainBroadcaster.addListener(oComboBox);
nMultiplierIndex = 0;
nMultiplier = com.disney.gem.games.robotDance.GameData.aSCORE_MULTIPLIER[nMultiplierIndex];
bGameFinished = false;
mcBackground = mcGame.mcBackground;
nCameraShakeTimer = 0;
bScratchSoundDone = false;
bStartGameMusic = false;
bStartBonusMusic = false;
bArmsDestroyed = false;
bBonusRound = false;
bPerfect = true;
nStreak = 0;
nScore = 0;
nShownScore = 0;
oController.oMainBroadcaster.addListener(oKeysGenerator);
setBackground(sBACKGROUND_NORMAL_LABEL);
if (com.disney.gem.games.robotDance.Controller.bPerfAltered) {
mcBackground.mcState.stop();
}
}
function init() {
updateHealth();
startLevel();
}
function get ControllerRef() {
return(oController);
}
function badMove(_bKeyPressed) {
nStreak = 0;
resetMultiplier();
bPerfect = false;
if (bBonusRound) {
nBonusChances--;
if (nBonusChances <= 0) {
oStich.endBonus();
bBonusRound = false;
oKeysGenerator.flushCurrentKeys();
stopBonusMusic();
}
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.aSTITCH_LOSE_BONUS[Math.floor(Math.random() * (com.disney.gem.games.robotDance.GameData.aSTITCH_LOSE_BONUS.length - 1))], com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
} else {
setCameraShake();
var _local3 = oRobot.shoot();
oStich.shot(_local3);
}
updateHealth();
setMultiplier();
if (_bKeyPressed || (_bKeyPressed == undefined)) {
oCursor.setPress();
}
nDelayInput = com.disney.gem.games.robotDance.GameData.nDELAY_GOOD_PRESS;
}
function goodMove() {
nStreak++;
setMultiplier();
if (bBonusRound) {
if (nMultiplier > 0) {
nScore = nScore + (com.disney.gem.games.robotDance.GameData.nSCORE_KEY_PRESS_BONUS * nMultiplier);
} else {
nScore = nScore + com.disney.gem.games.robotDance.GameData.nSCORE_KEY_PRESS_BONUS;
}
} else if (nMultiplier > 0) {
nScore = nScore + (com.disney.gem.games.robotDance.GameData.nSCORE_KEY_PRESS * nMultiplier);
} else {
nScore = nScore + com.disney.gem.games.robotDance.GameData.nSCORE_KEY_PRESS;
}
if ((nStreak != 0) && ((nStreak % com.disney.gem.games.robotDance.GameData.nSTICH_KEYS_SHOTS) == 0)) {
var _local2 = oRobot.shot();
oStich.shoot(_local2);
}
checkBonusRound();
oCursor.setPress();
nDelayInput = com.disney.gem.games.robotDance.GameData.nDELAY_GOOD_PRESS;
}
function isGameStarted() {
return(true);
}
function get isInBonus() {
return(bBonusRound);
}
function stitchDestroyed() {
oController.onLevelEnd();
oKeysGenerator.flushCurrentKeys();
}
function robotDestroyed() {
bArmsDestroyed = true;
oController.onLevelEnd();
oKeysGenerator.flushCurrentKeys();
oController.disallowInstructions();
if (oController.getLevel() <= com.disney.gem.games.robotDance.GameData.nMAX_LEVEL) {
oController.setLevel(oController.getLevel() + 1);
}
}
function armsGone() {
pauseBonusMusic();
pauseGameMusic();
stopBonusMusic();
stopGameMusic();
if (oController.getLevel() <= com.disney.gem.games.robotDance.GameData.nMAX_LEVEL) {
startLevelTransMusic();
} else {
oController.startPackMusic();
}
oStich.won();
}
function playerLost() {
if (!bGameFinished) {
stopGameMusic();
oController.onGameLose();
bGameFinished = true;
oController.disallowInstructions();
}
}
function playerWon() {
oController.disallowInstructions();
bGameFinished = true;
stopGameMusic();
oController.disallowInstructions();
if (oController.getLevel() <= com.disney.gem.games.robotDance.GameData.nMAX_LEVEL) {
if (!bPerfect) {
oController.showPopup(new com.disney.gem.games.robotDance.popups.LevelPopup(oController.mcTimeline.mcPopups.mcLevel, this), true);
} else {
oController.showPopup(new com.disney.gem.games.robotDance.popups.PerfectPopup(oController.mcTimeline.mcPopups.mcPerfect, this), true);
nScore = nScore + Number(com.disney.gem.games.robotDance.GameData.aSCORE_PERFECT[oController.getLevel() - 2]);
}
} else if (!bPerfect) {
oController.onGameWon();
} else {
oController.showPopup(new com.disney.gem.games.robotDance.popups.PerfectPopup(oController.mcTimeline.mcPopups.mcPerfect, this), true);
nScore = nScore + Number(com.disney.gem.games.robotDance.GameData.aSCORE_PERFECT[oController.getLevel() - 2]);
}
}
function startLevel() {
bArmsDestroyed = false;
bGameFinished = false;
bBonusRound = false;
bPerfect = true;
nStreak = 0;
oKeysGenerator.init();
oStich.init();
oRobot.init();
oController.onLevelStart();
oController.allowInstructions();
setMultiplier();
updateHealth();
resetMultiplier();
if (oController.getLevel() > 1) {
stopLevelTransMusic();
}
startGameMusic();
mcGame.mcHud.mcLevel.txtLevel.text = oController.getLevel();
oController.allowInstructions();
}
function get FinalScore() {
return(nScore);
}
function perfectClosing() {
if (oController.getLevel() <= com.disney.gem.games.robotDance.GameData.nMAX_LEVEL) {
oController.showPopup(new com.disney.gem.games.robotDance.popups.LevelPopup(oController.mcTimeline.mcPopups.mcLevel, this), true);
} else {
oController.onGameWon();
}
}
function getMultiplier() {
return(nMultiplierIndex);
}
function switchDone() {
if ((!bGameFinished) && (!oStich.bGameWon)) {
startSratchingSound();
if (!isInBonus) {
bStartGameMusic = true;
} else {
bStartBonusMusic = true;
}
}
}
function changingBackground() {
if (isInBonus && (!oStich.bGameWon)) {
setBackground(sBACKGROUND_BONUS_LABEL);
} else {
setBackground(sBACKGROUND_NORMAL_LABEL);
}
}
function canHalt() {
return(!bGameFinished);
}
function haltGame() {
oKeysGenerator.pauseCurrentKeys();
if (isInBonus) {
pauseBonusMusic();
} else {
pauseGameMusic();
}
oController.startPackMusic();
}
function resumeGame() {
oKeysGenerator.resumeCurrentKeys();
oController.stopPackMusic();
if (!isInBonus) {
resumeGameMusic();
} else {
resumeBonusMusic();
}
}
function updateHealth() {
var _local2 = Math.round((MovieClip(mcGame.mcHud.mcArm0Energy.mcEnergy)._totalframes - ((oRobot.Health[0] * MovieClip(mcGame.mcHud.mcArm0Energy.mcEnergy)._totalframes) / com.disney.gem.games.robotDance.GameData.aCANNON_ENERGY[oController.getLevel() - 1])) + 1);
var _local3 = Math.round((MovieClip(mcGame.mcHud.mcArm0Energy.mcEnergy)._totalframes - ((oRobot.Health[1] * MovieClip(mcGame.mcHud.mcArm1Energy.mcEnergy)._totalframes) / com.disney.gem.games.robotDance.GameData.aCANNON_ENERGY[oController.getLevel() - 1])) + 1);
var _local4 = Math.round((MovieClip(mcGame.mcHud.mcStichEnergy)._totalframes - ((oStich.Health * MovieClip(mcGame.mcHud.mcStichEnergy)._totalframes) / com.disney.gem.games.robotDance.GameData.nSTICH_ENERGY)) + 1);
MovieClip(mcGame.mcHud.mcArm0Energy.mcEnergy).gotoAndStop(_local2);
MovieClip(mcGame.mcHud.mcArm1Energy.mcEnergy).gotoAndStop(_local3);
MovieClip(mcGame.mcHud.mcStichEnergy).gotoAndStop(_local4);
}
function destroy() {
oController.oMainBroadcaster.removeListener(oKeysGenerator);
oController.oMainBroadcaster.removeListener(oCursor);
oController.oMainBroadcaster.removeListener(oComboBox);
oController.oMainBroadcaster.removeListener(oStich);
oRobot.destroy();
oStich.destroy();
oKeysGenerator.destroy();
delete oController;
delete oRobot;
delete oStich;
delete oKeysGenerator;
delete oMusicGame;
delete oMusicBonus;
delete oMusicLevelTrans;
delete oScratchSound;
}
function onUpdate() {
checkKeys();
checkCameraShake();
checkScratchSound();
updateScore();
}
function onBtMenu() {
if (canHalt()) {
oController.pause();
oController.showPopup(new com.disney.gem.games.robotDance.popups.MenuPopup(oController.mcTimeline.mcPopups.mcMenu), true);
haltGame();
}
}
function onPause() {
mcBackground.mcState.stop();
}
function onUnPause() {
mcBackground.mcState.play();
}
function doSoundEvent(_nEvent, _oSound) {
if (_nEvent == com.sarbakan.sound.SoundManager.nEVENT_SOUND_COMPLETE) {
if (_oSound == oMusicBonus) {
delete oMusicBonus;
} else if (_oSound == oMusicGame) {
delete oMusicGame;
} else if (_oSound == oMusicLevelTrans) {
delete oMusicLevelTrans;
} else if (_oSound == oScratchSound) {
bScratchSoundDone = true;
delete oScratchSound;
}
}
}
function startGameMusic() {
if (oMusicGame == undefined) {
oMusicGame = com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_MUSIC, com.disney.gem.games.robotDance.GameData.aMUSIC_GAME[oController.getLevel() - 1], com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_MUSIC, 9999999);
oMusicGame.doAddListener(this);
}
oMusicGame.doFadeTo(100);
}
function stopGameMusic() {
oMusicGame.doFadeTo(0, true);
}
function pauseGameMusic() {
oMusicGame.doPause();
}
function resumeGameMusic() {
oMusicGame.doResume();
}
function startBonusMusic() {
if (oMusicBonus == undefined) {
oMusicBonus = com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_MUSIC, com.disney.gem.games.robotDance.GameData.aMUSIC_BONUS[oController.getLevel() - 1], com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_MUSIC, 9999999);
oMusicBonus.doAddListener(this);
}
oMusicBonus.doFadeTo(100);
}
function startSratchingSound() {
if (oScratchSound == undefined) {
oScratchSound = com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSOUND_TRANSITION, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND, 1);
oScratchSound.doAddListener(this);
}
oScratchSound.doFadeTo(100);
}
function stopBonusMusic() {
oMusicBonus.doFadeTo(0, true);
}
function pauseBonusMusic() {
oMusicBonus.doPause();
}
function resumeBonusMusic() {
oMusicBonus.doResume();
}
function startLevelTransMusic() {
if (oMusicLevelTrans == undefined) {
oMusicLevelTrans = com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_MUSIC, com.disney.gem.games.robotDance.GameData.aMUSIC_BONUS[com.disney.gem.games.robotDance.GameData.aMUSIC_BONUS.length - 1], com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_MUSIC, 9999999);
oMusicLevelTrans.doAddListener(this);
}
oMusicLevelTrans.doFadeTo(100);
}
function stopLevelTransMusic() {
oMusicLevelTrans.doFadeTo(0, true);
}
function checkKeys() {
if ((!bGameFinished) && ((!bArmsDestroyed) && (oStich.isReady && (oKeysGenerator.isReady())))) {
var _local2 = false;
var _local3 = false;
var _local4 = false;
var _local5 = false;
if (Key.isDown(Key.DOWN)) {
_local2 = true;
}
if (Key.isDown(Key.LEFT)) {
_local4 = true;
}
if (Key.isDown(Key.RIGHT)) {
_local5 = true;
}
if (Key.isDown(Key.UP)) {
_local3 = true;
}
if (oKeysGenerator.ActualKeys != undefined) {
switch (oKeysGenerator.ActualKeys.KeyType) {
case com.disney.gem.games.robotDance.GameData.sKEY_UP :
if (_local3 && ((!_local2) && ((!_local4) && (!_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
} else if ((!_local3) && (_local2 || (_local4 || (_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, false);
badMove();
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_DOWN :
if ((!_local3) && (_local2 && ((!_local4) && (!_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
} else if ((!_local2) && (_local3 || (_local4 || (_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, false);
badMove();
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_LEFT :
if ((!_local3) && ((!_local2) && (_local4 && (!_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
} else if ((!_local4) && (_local3 || (_local2 || (_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, false);
badMove();
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_RIGHT :
if ((!_local3) && ((!_local2) && ((!_local4) && (_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
} else if ((!_local5) && (_local3 || (_local2 || (_local4)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, false);
badMove();
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_SPACE :
if (_local3 || (_local2 || (_local4 || (_local5)))) {
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_UP_DOWN :
case com.disney.gem.games.robotDance.GameData.sKEY_DOWN_UP :
if (_local3 && (_local2 && ((!_local4) && (!_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_LEFT_RIGHT :
case com.disney.gem.games.robotDance.GameData.sKEY_RIGHT_LEFT :
if ((!_local3) && ((!_local2) && (_local4 && (_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_UP_LEFT :
case com.disney.gem.games.robotDance.GameData.sKEY_LEFT_UP :
if (_local3 && ((!_local2) && (_local4 && (!_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_UP_RIGHT :
case com.disney.gem.games.robotDance.GameData.sKEY_RIGHT_UP :
if (_local3 && ((!_local2) && ((!_local4) && (_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_DOWN_LEFT :
case com.disney.gem.games.robotDance.GameData.sKEY_LEFT_DOWN :
if ((!_local3) && (_local2 && (_local4 && (!_local5)))) {
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
}
break;
case com.disney.gem.games.robotDance.GameData.sKEY_DOWN_RIGHT :
case com.disney.gem.games.robotDance.GameData.sKEY_RIGHT_DOWN :
if (!((!_local3) && (_local2 && ((!_local4) && (_local5))))) {
break;
}
oKeysGenerator.KeyPressed(oKeysGenerator.ActualKeys, true);
goodMove();
}
}
}
}
function setMultiplier() {
if ((nStreak >= com.disney.gem.games.robotDance.GameData.aSCORE_MULTIPLIER_TRIGGER[nMultiplierIndex]) && (nMultiplierIndex < com.disney.gem.games.robotDance.GameData.aSCORE_MULTIPLIER_TRIGGER.length)) {
nMultiplierIndex++;
nMultiplier = com.disney.gem.games.robotDance.GameData.aSCORE_MULTIPLIER[nMultiplierIndex];
oKeysGenerator.updateMultiplier(nMultiplierIndex);
oComboBox.setCombo(String(nMultiplier));
}
}
function resetMultiplier() {
nMultiplierIndex = 0;
nMultiplier = com.disney.gem.games.robotDance.GameData.aSCORE_MULTIPLIER[nMultiplierIndex];
oKeysGenerator.updateMultiplier(nMultiplierIndex);
}
function updateScore() {
if (nShownScore < nScore) {
if ((nScore - nShownScore) >= com.disney.gem.games.robotDance.GameData.nSCORE_UPS_BIG) {
nShownScore = nShownScore + com.disney.gem.games.robotDance.GameData.nSCORE_UPS_BIG;
} else {
nShownScore = nShownScore + com.disney.gem.games.robotDance.GameData.nSCORE_UPS_SMALL;
}
if (nShownScore > nScore) {
nShownScore = nScore;
}
mcGame.mcHud.txtScore.text = com.sarbakan.utils.Tools.getFormatedNumber(nShownScore);
}
}
function checkBonusRound() {
if (nStreak >= com.disney.gem.games.robotDance.GameData.nBONUS_KEYS_TRIGGER) {
if (!bBonusRound) {
oStich.switchGameMode();
bBonusRound = true;
nBonusChances = com.disney.gem.games.robotDance.GameData.nBONUS_MISS_CHANCES;
oKeysGenerator.flushCurrentKeys();
stopGameMusic();
oController.disallowInstructions();
}
}
}
function setCameraShake() {
nCameraShakeTimer = com.disney.gem.games.robotDance.GameData.nCAMERA_SHAKE_TIME;
}
function checkCameraShake() {
if (nCameraShakeTimer > 0) {
nCameraShakeTimer--;
if (nCameraShakeTimer <= 0) {
mcGame._x = 0;
mcGame._y = 0;
nCameraShakeTimer = 0;
} else {
var _local2 = Math.round((com.disney.gem.games.robotDance.GameData.nCAMERA_SHAKE_AMPLITUDE * nCameraShakeTimer) / com.disney.gem.games.robotDance.GameData.nCAMERA_SHAKE_TIME);
if (_local2 > com.disney.gem.games.robotDance.GameData.nCAMERA_SHAKE_AMPLITUDE) {
_local2 = com.disney.gem.games.robotDance.GameData.nCAMERA_SHAKE_AMPLITUDE;
}
var _local3 = Math.floor(Math.random() * ((_local2 + _local2) + 1)) - _local2;
mcGame._x = _local3;
mcGame._y = _local3;
}
}
}
function setBackground(_sLabel) {
mcBackground.gotoAndStop(_sLabel);
if (com.disney.gem.games.robotDance.Controller.bPerfAltered) {
mcBackground.mcState.stop();
}
}
function checkScratchSound() {
if (bScratchSoundDone && (!com.disney.gem.games.robotDance.Controller.getInstance().bPaused)) {
if (bStartGameMusic) {
startGameMusic();
oKeysGenerator.init();
oController.allowInstructions();
bStartGameMusic = false;
} else if (bStartBonusMusic) {
startBonusMusic();
oKeysGenerator.init();
oController.allowInstructions();
bStartBonusMusic = false;
}
bScratchSoundDone = false;
}
}
var sBACKGROUND_NORMAL_LABEL = "Normal";
var sBACKGROUND_BONUS_LABEL = "Bonus";
}
Symbol 1077 MovieClip [__Packages.com.disney.gem.games.robotDance.game.KeysGen] Frame 0
class com.disney.gem.games.robotDance.game.KeysGen
{
var mcRef, oGameEngine, mcAttachedKeys, nDepth, nDelayAttachement, aIncomingKeys, aShownKeys, nOriginalWidth, bActionChecked, bGenerateKeys, bFirstInit, bReady, nKeysSpeed, oActualKey, oPressedKey, oLastKeyInZone, nGamePaused, nLastFrameTime;
function KeysGen (_mcRef, _oGameEngine) {
mcRef = _mcRef;
oGameEngine = _oGameEngine;
mcAttachedKeys = mcRef.createEmptyMovieClip("mcAttach", nDepth);
nDepth = 0;
nDelayAttachement = 0;
mcAttachedKeys._x = mcAttachedKeys._x + nX_ATTACH;
mcAttachedKeys._y = mcAttachedKeys._y + nY_ATTACH;
nDepth++;
MovieClip(mcRef.mcCursor).swapDepths(nCURSOR_DEPTH);
MovieClip(mcRef.mcZone)._visible = false;
aIncomingKeys = new Array();
aShownKeys = new Array();
nOriginalWidth = com.disney.gem.games.robotDance.GameData.nSTAGE_WIDTH;
bActionChecked = false;
bGenerateKeys = false;
bFirstInit = true;
bReady = false;
}
function init() {
bGenerateKeys = true;
setBPM();
if (oGameEngine.isInBonus) {
createBonusBeat();
} else {
createNormalBeat();
}
}
function setBPM() {
var _local2 = com.disney.gem.games.robotDance.GameData.aKEY_SPEED_BPM[com.disney.gem.games.robotDance.Controller.getInstance().getLevel() - 1];
var _local3 = com.disney.gem.games.robotDance.GameData.nMINUTE / _local2;
nKeysSpeed = ((nOriginalWidth / com.disney.gem.games.robotDance.GameData.nKEYS_ON_SCREEN) * com.disney.gem.games.robotDance.GameData.nTARGET_FPS) / _local3;
}
function get ActualKeys() {
return(oActualKey);
}
function KeyPressed(_oKeys, _bGoodMove) {
oPressedKey = _oKeys;
if (_bGoodMove) {
oPressedKey.pressed();
} else {
oPressedKey.missed();
}
}
function updateMultiplier(_nMultiplierIndex) {
var _local3 = 0;
for ( ; _local3 < aShownKeys.length ; _local3++) {
if (!com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3]).bPassedCursor) {
com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3]).updateMultiplier(_nMultiplierIndex);
}
}
}
function removeKey(_oKey) {
oGameEngine.ControllerRef.oMainBroadcaster.removeListener(_oKey);
_oKey.Mc.removeMovieClip();
_oKey.destroy();
var _local3 = 0;
for ( ; _local3 < aShownKeys.length ; _local3++) {
if (_oKey == aShownKeys[_local3]) {
aShownKeys.splice(_local3, 1);
break;
}
}
}
function flushCurrentKeys() {
bGenerateKeys = false;
bReady = false;
oActualKey = null;
oLastKeyInZone = null;
oPressedKey = null;
bFirstInit = true;
var _local2 = 0;
for ( ; _local2 < aIncomingKeys.length ; _local2++) {
var _local3 = com.disney.gem.games.robotDance.game.Keys(aIncomingKeys[_local2]);
oGameEngine.ControllerRef.oMainBroadcaster.removeListener(_local3);
_local3.Mc.removeMovieClip();
_local3.destroy();
}
aIncomingKeys = new Array();
var _local4 = 0;
for ( ; _local4 < aShownKeys.length ; _local4++) {
var _local5 = com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local4]);
oGameEngine.ControllerRef.oMainBroadcaster.removeListener(_local5);
_local5.Mc.removeMovieClip();
_local5.destroy();
}
aShownKeys = new Array();
}
function pauseCurrentKeys() {
bReady = false;
nGamePaused = getTimer();
}
function resumeCurrentKeys() {
var _local2 = getTimer() - nGamePaused;
var _local3 = 0;
for ( ; _local3 < aShownKeys.length ; _local3++) {
com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3]).addDelay(_local2);
}
var _local4 = 0;
for ( ; _local4 < aIncomingKeys.length ; _local4++) {
com.disney.gem.games.robotDance.game.Keys(aIncomingKeys[_local4]).addDelay(_local2);
}
nDelayAttachement = 0;
bReady = true;
}
function isEmpty() {
var _local2 = true;
var _local3 = 0;
for ( ; _local3 < aShownKeys.length ; _local3++) {
if (com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3]).Mc._x > mcRef.mcCursor._x) {
_local2 = false;
break;
}
}
return(_local2);
}
function isReady() {
return(bReady && (oActualKey != null));
}
function destroy() {
delete mcRef;
delete oGameEngine;
}
function onUpdate() {
if (oGameEngine.isGameStarted) {
moveAttachedKeys();
if (bGenerateKeys) {
checkIncomingKeys();
checkCurrentKey();
}
}
}
function onUnPause() {
nLastFrameTime = getTimer();
}
function createNormalBeat() {
nLastFrameTime = getTimer();
if (bFirstInit) {
var _local2 = 0;
for ( ; _local2 < com.disney.gem.games.robotDance.GameData.nPAUSE_BEGINING ; _local2++) {
var _local3 = com.disney.gem.games.robotDance.GameData.sKEY_SPACE;
var _local4 = nLastFrameTime + (_local2 * (com.disney.gem.games.robotDance.GameData.nMINUTE / com.disney.gem.games.robotDance.GameData.aKEY_SPEED_BPM[oGameEngine.ControllerRef.getLevel() - 1]));
var _local5 = new com.disney.gem.games.robotDance.game.Keys(undefined, _local4, _local3, this);
aIncomingKeys.push(_local5);
}
bFirstInit = false;
nLastFrameTime = nLastFrameTime + (aIncomingKeys.length * (com.disney.gem.games.robotDance.GameData.nMINUTE / com.disney.gem.games.robotDance.GameData.aKEY_SPEED_BPM[oGameEngine.ControllerRef.getLevel() - 1]));
}
var _local6 = com.disney.gem.games.robotDance.GameData.aNORMAL_BEATS[com.disney.gem.games.robotDance.Controller.getInstance().getLevel() - 1];
var _local7 = _local6[Math.floor(Math.random() * _local6.length)];
var _local8 = 0;
for ( ; _local8 < _local7.length ; _local8++) {
var _local9 = _local7.charAt(_local8);
var _local10 = nLastFrameTime + ((_local8 + 1) * (com.disney.gem.games.robotDance.GameData.nMINUTE / com.disney.gem.games.robotDance.GameData.aKEY_SPEED_BPM[oGameEngine.ControllerRef.getLevel() - 1]));
var _local11 = new com.disney.gem.games.robotDance.game.Keys(undefined, _local10, _local9, this);
aIncomingKeys.push(_local11);
}
bReady = true;
}
function createBonusBeat() {
nLastFrameTime = getTimer();
var _local2 = com.disney.gem.games.robotDance.GameData.aBONUS_BEATS_FIRSTKEY[com.disney.gem.games.robotDance.Controller.getInstance().getLevel() - 1];
var _local3 = com.disney.gem.games.robotDance.GameData.aBONUS_BEATS_SECNDKEY[com.disney.gem.games.robotDance.Controller.getInstance().getLevel() - 1];
var _local4 = Math.floor(Math.random() * _local2.length);
var _local5 = _local2[_local4];
var _local6 = _local3[_local4];
var _local7 = 0;
for ( ; _local7 < _local5.length ; _local7++) {
var _local8 = _local5.charAt(_local7);
if (_local8 != com.disney.gem.games.robotDance.GameData.sKEY_SPACE) {
_local8 = _local8 + _local6.charAt(_local7);
}
var _local9 = nLastFrameTime + ((_local7 + 1) * (com.disney.gem.games.robotDance.GameData.nMINUTE / com.disney.gem.games.robotDance.GameData.aKEY_SPEED_BPM[oGameEngine.ControllerRef.getLevel() - 1]));
var _local10 = new com.disney.gem.games.robotDance.game.Keys(undefined, _local9, _local8, this);
aIncomingKeys.push(_local10);
}
bReady = true;
}
function checkIncomingKeys() {
if (getTimer() >= com.disney.gem.games.robotDance.game.Keys(aIncomingKeys[0]).TimerStart) {
var _local2 = com.disney.gem.games.robotDance.game.Keys(aIncomingKeys.shift());
var _local3 = _local2.KeyType;
switch (_local3) {
case com.disney.gem.games.robotDance.GameData.sKEY_UP :
var _local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_UP, com.disney.gem.games.robotDance.GameData.sLINKAGE_UP + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_DOWN :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_DOWN, com.disney.gem.games.robotDance.GameData.sLINKAGE_DOWN + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_LEFT :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_LEFT, com.disney.gem.games.robotDance.GameData.sLINKAGE_LEFT + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_RIGHT :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_RIGHT, com.disney.gem.games.robotDance.GameData.sLINKAGE_RIGHT + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_SPACE :
case com.disney.gem.games.robotDance.GameData.sKEY_TAB :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_SPACE, com.disney.gem.games.robotDance.GameData.sLINKAGE_SPACE + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_UP_DOWN :
case com.disney.gem.games.robotDance.GameData.sKEY_DOWN_UP :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_UP_DOWN, com.disney.gem.games.robotDance.GameData.sLINKAGE_UP_DOWN + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_UP_LEFT :
case com.disney.gem.games.robotDance.GameData.sKEY_LEFT_UP :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_UP_LEFT, com.disney.gem.games.robotDance.GameData.sLINKAGE_UP_LEFT + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_UP_RIGHT :
case com.disney.gem.games.robotDance.GameData.sKEY_RIGHT_UP :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_UP_RIGHT, com.disney.gem.games.robotDance.GameData.sLINKAGE_UP_RIGHT + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_DOWN_LEFT :
case com.disney.gem.games.robotDance.GameData.sKEY_LEFT_DOWN :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_DOWN_LEFT, com.disney.gem.games.robotDance.GameData.sLINKAGE_DOWN_LEFT + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_DOWN_RIGHT :
case com.disney.gem.games.robotDance.GameData.sKEY_RIGHT_DOWN :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_DOWN_RIGHT, com.disney.gem.games.robotDance.GameData.sLINKAGE_DOWN_RIGHT + nDepth, nDepth);
break;
case com.disney.gem.games.robotDance.GameData.sKEY_LEFT_RIGHT :
case com.disney.gem.games.robotDance.GameData.sKEY_RIGHT_LEFT :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_LEFT_RIGHT, com.disney.gem.games.robotDance.GameData.sLINKAGE_LEFT_RIGHT + nDepth, nDepth);
break;
default :
_local4 = mcAttachedKeys.attachMovie(com.disney.gem.games.robotDance.GameData.sLINKAGE_SPACE, com.disney.gem.games.robotDance.GameData.sLINKAGE_SPACE + nDepth, nDepth);
}
_local4._x = nOriginalWidth;
oGameEngine.ControllerRef.oMainBroadcaster.addListener(_local2);
_local2.setMc(_local4);
aShownKeys.push(_local2);
nDepth++;
nDelayAttachement = nDelayAttachement + (getTimer() - _local2.TimerStart);
}
if (aIncomingKeys.length == 0) {
if (oGameEngine.isInBonus) {
createBonusBeat();
} else {
createNormalBeat();
}
}
}
function moveAttachedKeys() {
var _local2 = ((getTimer() - nDelayAttachement) - nLastFrameTime) / (1000 / com.disney.gem.games.robotDance.GameData.nTARGET_FPS);
var _local3 = Math.round(nKeysSpeed * _local2);
var _local4 = 0;
for ( ; _local4 < aShownKeys.length ; _local4++) {
if (!com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local4]).bPressed) {
com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local4]).Mc._x = com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local4]).Mc._x - _local3;
}
}
if (com.disney.gem.games.robotDance.game.Keys(aShownKeys[0]).Mc._x < 0) {
removeKey(aShownKeys[0]);
}
nLastFrameTime = getTimer();
nDelayAttachement = 0;
}
function checkCurrentKey() {
var _local2 = false;
var _local3 = 0;
for ( ; _local3 < aShownKeys.length ; _local3++) {
if (com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3]).KeyType != com.disney.gem.games.robotDance.GameData.sKEY_SPACE) {
if ((com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3]).Mc._x > (mcRef.mcCursor._x - com.disney.gem.games.robotDance.GameData.nCURSOR_ZONE)) && (com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3]).Mc._x < (mcRef.mcCursor._x + com.disney.gem.games.robotDance.GameData.nCURSOR_ZONE))) {
if (oPressedKey != com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3])) {
oActualKey = com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3]);
bActionChecked = false;
} else {
oActualKey = undefined;
}
oLastKeyInZone = com.disney.gem.games.robotDance.game.Keys(aShownKeys[_local3]);
oLastKeyInZone.bPassedCursor = true;
_local2 = true;
break;
}
}
}
if (!_local2) {
if (oPressedKey != undefined) {
bActionChecked = true;
}
if ((oPressedKey == undefined) && ((oLastKeyInZone != undefined) && (!bActionChecked))) {
if (oLastKeyInZone.KeyType == com.disney.gem.games.robotDance.GameData.sKEY_SPACE) {
} else {
oGameEngine.badMove(false);
oActualKey.missed();
}
oLastKeyInZone = undefined;
bActionChecked = true;
}
oPressedKey = undefined;
oActualKey = undefined;
}
}
static var sLINKAGE_UP = "mcUp";
static var sLINKAGE_DOWN = "mcDown";
static var sLINKAGE_LEFT = "mcLeft";
static var sLINKAGE_RIGHT = "mcRight";
static var sLINKAGE_SPACE = "mcSpace";
static var nCURSOR_DEPTH = 9999999;
static var nX_ATTACH = 0;
static var nY_ATTACH = 7;
}
Symbol 1078 MovieClip [__Packages.com.disney.gem.games.robotDance.game.Keys] Frame 0
class com.disney.gem.games.robotDance.game.Keys extends com.sarbakan.utils.StateManaged
{
var mcRef, nTimerStart, sKeyType, oKeysGen, bPressed, bPassedCursor, setState, stateFinished, Mc;
function Keys (_mcRef, _nTimerStart, _sKeyType, _oKeysGenerator) {
super();
mcRef = _mcRef;
nTimerStart = _nTimerStart;
sKeyType = _sKeyType;
oKeysGen = _oKeysGenerator;
bPressed = false;
bPassedCursor = false;
}
function setMc(_mcRef) {
super.setMC(_mcRef);
if (com.disney.gem.games.robotDance.Controller.getInstance().oGame.getMultiplier() > 0) {
setState(aSTATES_MULTIPLIER[com.disney.gem.games.robotDance.Controller.getInstance().oGame.getMultiplier() - 1], true, true);
} else {
setState(sSTATE_IDLE, true, true);
}
}
function get KeyType() {
return(sKeyType);
}
function get TimerStart() {
return(nTimerStart);
}
function disappear() {
setState(sSTATE_IDLE);
oKeysGen.removeKey(this);
}
function destroy() {
delete oKeysGen;
super.destroy();
}
function updateMultiplier(_nMultiplier) {
if (_nMultiplier > 1) {
setState(aSTATES_MULTIPLIER[_nMultiplier - 1], true, true);
} else {
setState(sSTATE_IDLE, true, true);
}
}
function pressed() {
setState(sSTATE_PRESSED);
bPressed = true;
}
function missed() {
setState(sSTATE_MISSED);
}
function addDelay(_nDelayAdded) {
nTimerStart = nTimerStart + _nDelayAdded;
}
function state_Missed() {
state_Press();
}
function state_Press() {
if (stateFinished()) {
Mc._visible = false;
oKeysGen.removeKey(this);
}
}
static var sSTATE_IDLE = "Idle";
static var sSTATE_PRESSED = "Press";
static var sSTATE_MISSED = "Missed";
static var aSTATES_MULTIPLIER = ["x1", "x2", "x3"];
}
Symbol 1079 MovieClip [__Packages.com.disney.gem.games.robotDance.GameData] Frame 0
class com.disney.gem.games.robotDance.GameData
{
function GameData () {
}
static var nMINUTE = 60000;
static var nSTAGE_WIDTH = 580;
static var nTARGET_FPS = 30;
static var nMAX_LEVEL = 3;
static var sLINKAGE_UP = "mcUp";
static var sLINKAGE_DOWN = "mcDown";
static var sLINKAGE_LEFT = "mcLeft";
static var sLINKAGE_RIGHT = "mcRight";
static var sLINKAGE_SPACE = "mcSpace";
static var sLINKAGE_UP_DOWN = "mcUpDown";
static var sLINKAGE_UP_LEFT = "mcUpLeft";
static var sLINKAGE_UP_RIGHT = "mcUpRight";
static var sLINKAGE_LEFT_RIGHT = "mcLeftRight";
static var sLINKAGE_DOWN_RIGHT = "mcDownRight";
static var sLINKAGE_DOWN_LEFT = "mcDownLeft";
static var sDIRECTION_LEFT = "Left";
static var sDIRECTION_RIGHT = "Right";
static var nATTACH_TRESHOLD = 30;
static var nCAMERA_SHAKE_AMPLITUDE = 5;
static var nCAMERA_SHAKE_TIME = 15;
static var nDELAY_GOOD_PRESS = 10;
static var nCURSOR_ZONE = 60;
static var nPAUSE_BEGINING = 8;
static var nSCORE_UPS_SMALL = 50;
static var nSCORE_UPS_BIG = 500;
static var nPOPUP_DELAY = 90;
static var aKEY_SPEED_BPM = [140, 150, 160];
static var nKEYS_ON_SCREEN = 4;
static var nSTICH_ENERGY = 15;
static var nSTICH_KEYS_SHOTS = 4;
static var aCANNON_ENERGY = [5, 11, 18];
static var nBONUS_KEYS_TRIGGER = 32;
static var nBONUS_MISS_CHANCES = 2;
static var sLEVEL1_NORMAL_BLOCK0 = " W W S S A D A D";
static var sLEVEL1_NORMAL_BLOCK1 = " W S W S D A D A";
static var sLEVEL1_NORMAL_BLOCK2 = " A S D S W S W S";
static var sLEVEL1_NORMAL_BLOCK3 = " A D A D S W S W";
static var sLEVEL1_NORMAL_BLOCK4 = " W A S D W A S D";
static var sLEVEL1_NORMAL_BLOCK5 = " D W D W A W A W";
static var sLEVEL1_NORMAL_BLOCK6 = " A W D W S A S D";
static var sLEVEL1_NORMAL_BLOCK7 = " S S D A D A W W";
static var sLEVEL1_BONUS_BEAT_FIRSTKEY_0 = " A A";
static var sLEVEL1_BONUS_BEAT_SECNDKEY_0 = " D D";
static var sLEVEL1_BONUS_BEAT_FIRSTKEY_1 = " W W";
static var sLEVEL1_BONUS_BEAT_SECNDKEY_1 = " S S";
static var sLEVEL1_BONUS_BEAT_FIRSTKEY_2 = " W W";
static var sLEVEL1_BONUS_BEAT_SECNDKEY_2 = " A A";
static var sLEVEL1_BONUS_BEAT_FIRSTKEY_3 = " W W";
static var sLEVEL1_BONUS_BEAT_SECNDKEY_3 = " D D";
static var sLEVEL2_NORMAL_BLOCK0 = " W W SSS A D AAA";
static var sLEVEL2_NORMAL_BLOCK1 = " S S WWW D A DDA";
static var sLEVEL2_NORMAL_BLOCK2 = " D D A A S S WWS";
static var sLEVEL2_NORMAL_BLOCK3 = " AAA DDD SWS SSW";
static var sLEVEL2_NORMAL_BLOCK4 = " W W SDS SAS S S";
static var sLEVEL2_NORMAL_BLOCK5 = " W S S W A D DDD";
static var sLEVEL2_NORMAL_BLOCK6 = " DSA ASD ADA AAD";
static var sLEVEL2_NORMAL_BLOCK7 = " WSW ASD DSA SSW";
static var sLEVEL2_BONUS_BEAT_FIRSTKEY_0 = " A A";
static var sLEVEL2_BONUS_BEAT_SECNDKEY_0 = " D D";
static var sLEVEL2_BONUS_BEAT_FIRSTKEY_1 = " W W";
static var sLEVEL2_BONUS_BEAT_SECNDKEY_1 = " S S";
static var sLEVEL2_BONUS_BEAT_FIRSTKEY_2 = " W W";
static var sLEVEL2_BONUS_BEAT_SECNDKEY_2 = " A D";
static var sLEVEL2_BONUS_BEAT_FIRSTKEY_3 = " W W";
static var sLEVEL2_BONUS_BEAT_SECNDKEY_3 = " D A";
static var sLEVEL3_NORMAL_BLOCK0 = "WWAASSDDDDSSAAWW";
static var sLEVEL3_NORMAL_BLOCK1 = "WWDDAASSWWDDAASS";
static var sLEVEL3_NORMAL_BLOCK2 = " S S W S S S W S";
static var sLEVEL3_NORMAL_BLOCK3 = " A D A D A D A D";
static var sLEVEL3_NORMAL_BLOCK4 = "WWWSWWWAWWWDWWWS";
static var sLEVEL3_NORMAL_BLOCK5 = "AADDDDAAAAWWDDWW";
static var sLEVEL3_NORMAL_BLOCK6 = " D A S W W S A D";
static var sLEVEL3_NORMAL_BLOCK7 = "SSSWSSSDSSSASSSS";
static var sLEVEL3_BONUS_BEAT_FIRSTKEY_0 = " A S";
static var sLEVEL3_BONUS_BEAT_SECNDKEY_0 = " S D";
static var sLEVEL3_BONUS_BEAT_FIRSTKEY_1 = " A W";
static var sLEVEL3_BONUS_BEAT_SECNDKEY_1 = " D S";
static var sLEVEL3_BONUS_BEAT_FIRSTKEY_2 = " W S";
static var sLEVEL3_BONUS_BEAT_SECNDKEY_2 = " A D";
static var sLEVEL3_BONUS_BEAT_FIRSTKEY_3 = " W W";
static var sLEVEL3_BONUS_BEAT_SECNDKEY_3 = " D S";
static var nSCORE_KEY_PRESS = 200;
static var nSCORE_KEY_PRESS_BONUS = 2000;
static var aSCORE_MULTIPLIER_TRIGGER = [8, 16, 32];
static var aSCORE_MULTIPLIER = [1, 2, 3, 4];
static var aSCORE_PERFECT = [50000, 100000, 200000];
static var nSOUND_VOLUME_SOUND = 80;
static var nSOUND_VOLUME_MUSIC = 100;
static var sSOUND_TRANSITION = "Transition.wav";
static var sSOUND_CLICK = "ButtonClick.wav";
static var nSOUND_CLICK_VOL = 70;
static var sSOUND_ROLL = "ButtonRoll.wav";
static var nSOUND_ROLL_VOL = 100;
static var aMUSIC_GAME = ["MusicRPM1-Normal.wav", "MusicRPM2-Normal.wav", "MusicRPM3-Normal.wav"];
static var aMUSIC_BONUS = ["MusicRPM1-Bonus.wav", "MusicRPM2-Bonus.wav", "MusicRPM3-Bonus.wav"];
static var sMUSIC_PACK = "MusicRPM3-Normal.wav";
static var sSTITCH_LOSE_NORMAL = "StitchLose_Normal.wav";
static var aSTITCH_LOSE_BONUS = ["StitchLose_Bonus_01.wav", "StitchLose_Bonus_02.wav"];
static var sSTITCH_SHOOT_NORMAL = "StitchShoot.wav";
static var aSTITCH_SHOOT_BONUS = ["StitchShootBonus_01.wav", "StitchShootBonus_02.wav", "StitchShootBonus_03.wav"];
static var aSTITCH_SHOT = ["StitchShoot_01.wav", "StitchShoot_02.wav"];
static var sSTITCH_WIN = "StitchWin.wav";
static var sSTITCH_SWITCH = "StitchSwitchround.wav";
static var sLASER_APPEAR = "LaserAppear.wav";
static var nLASER_APPEAR_VOL = 40;
static var sLASER_DESTROYED_BONUS = "LaserDestroyed_without_shooting.wav";
static var sLASER_DESTROYED = "LaserDestroyed.wav";
static var sKEY_UP = "W";
static var sKEY_DOWN = "S";
static var sKEY_LEFT = "A";
static var sKEY_RIGHT = "D";
static var sKEY_SPACE = " ";
static var sKEY_TAB = "\t";
static var sKEY_UP_DOWN = "WS";
static var sKEY_DOWN_UP = "SW";
static var sKEY_LEFT_RIGHT = "AD";
static var sKEY_RIGHT_LEFT = "DA";
static var sKEY_UP_LEFT = "WA";
static var sKEY_LEFT_UP = "AW";
static var sKEY_UP_RIGHT = "WD";
static var sKEY_RIGHT_UP = "DW";
static var sKEY_DOWN_LEFT = "SA";
static var sKEY_LEFT_DOWN = "AS";
static var sKEY_DOWN_RIGHT = "SD";
static var sKEY_RIGHT_DOWN = "DS";
static var aLEVEL1_NORMAL_BEATS = [sLEVEL1_NORMAL_BLOCK0, sLEVEL1_NORMAL_BLOCK1, sLEVEL1_NORMAL_BLOCK2, sLEVEL1_NORMAL_BLOCK3, sLEVEL1_NORMAL_BLOCK4, sLEVEL1_NORMAL_BLOCK5, sLEVEL1_NORMAL_BLOCK6, sLEVEL1_NORMAL_BLOCK7];
static var aLEVEL2_NORMAL_BEATS = [sLEVEL2_NORMAL_BLOCK0, sLEVEL2_NORMAL_BLOCK1, sLEVEL2_NORMAL_BLOCK2, sLEVEL2_NORMAL_BLOCK3, sLEVEL2_NORMAL_BLOCK4, sLEVEL2_NORMAL_BLOCK5, sLEVEL2_NORMAL_BLOCK6, sLEVEL2_NORMAL_BLOCK7];
static var aLEVEL3_NORMAL_BEATS = [sLEVEL3_NORMAL_BLOCK0, sLEVEL3_NORMAL_BLOCK1, sLEVEL3_NORMAL_BLOCK2, sLEVEL3_NORMAL_BLOCK3, sLEVEL3_NORMAL_BLOCK4, sLEVEL3_NORMAL_BLOCK5, sLEVEL3_NORMAL_BLOCK6, sLEVEL3_NORMAL_BLOCK7];
static var aLEVEL1_BONUS_BEATS_FIRSTKEY = [sLEVEL1_BONUS_BEAT_FIRSTKEY_0, sLEVEL1_BONUS_BEAT_FIRSTKEY_1, sLEVEL1_BONUS_BEAT_FIRSTKEY_2, sLEVEL1_BONUS_BEAT_FIRSTKEY_3];
static var aLEVEL1_BONUS_BEATS_SECNDKEY = [sLEVEL1_BONUS_BEAT_SECNDKEY_0, sLEVEL1_BONUS_BEAT_SECNDKEY_1, sLEVEL1_BONUS_BEAT_SECNDKEY_2, sLEVEL1_BONUS_BEAT_SECNDKEY_3];
static var aLEVEL2_BONUS_BEATS_FIRSTKEY = [sLEVEL2_BONUS_BEAT_FIRSTKEY_0, sLEVEL2_BONUS_BEAT_FIRSTKEY_1, sLEVEL2_BONUS_BEAT_FIRSTKEY_2, sLEVEL2_BONUS_BEAT_FIRSTKEY_3];
static var aLEVEL2_BONUS_BEATS_SECNDKEY = [sLEVEL2_BONUS_BEAT_SECNDKEY_0, sLEVEL2_BONUS_BEAT_SECNDKEY_1, sLEVEL2_BONUS_BEAT_SECNDKEY_2, sLEVEL2_BONUS_BEAT_SECNDKEY_3];
static var aLEVEL3_BONUS_BEATS_FIRSTKEY = [sLEVEL3_BONUS_BEAT_FIRSTKEY_0, sLEVEL3_BONUS_BEAT_FIRSTKEY_1, sLEVEL3_BONUS_BEAT_FIRSTKEY_2, sLEVEL3_BONUS_BEAT_FIRSTKEY_3];
static var aLEVEL3_BONUS_BEATS_SECNDKEY = [sLEVEL3_BONUS_BEAT_SECNDKEY_0, sLEVEL3_BONUS_BEAT_SECNDKEY_1, sLEVEL3_BONUS_BEAT_SECNDKEY_2, sLEVEL3_BONUS_BEAT_SECNDKEY_3];
static var aNORMAL_BEATS = [aLEVEL1_NORMAL_BEATS, aLEVEL2_NORMAL_BEATS, aLEVEL3_NORMAL_BEATS];
static var aBONUS_BEATS_FIRSTKEY = [aLEVEL1_BONUS_BEATS_FIRSTKEY, aLEVEL2_BONUS_BEATS_FIRSTKEY, aLEVEL3_BONUS_BEATS_FIRSTKEY];
static var aBONUS_BEATS_SECNDKEY = [aLEVEL1_BONUS_BEATS_SECNDKEY, aLEVEL2_BONUS_BEATS_SECNDKEY, aLEVEL3_BONUS_BEATS_SECNDKEY];
}
Symbol 1080 MovieClip [__Packages.com.disney.gem.games.robotDance.game.BaseCharacter] Frame 0
class com.disney.gem.games.robotDance.game.BaseCharacter extends com.sarbakan.utils.StateManaged
{
function BaseCharacter (_mcRef) {
super(_mcRef);
}
}
Symbol 1081 MovieClip [__Packages.com.disney.gem.games.robotDance.game.Stitch] Frame 0
class com.disney.gem.games.robotDance.game.Stitch extends com.disney.gem.games.robotDance.game.BaseCharacter
{
var oGameEngine, bSwitching, bInBonus, bGameWon, nHitPoints, sState, stateFinished, mcRef;
function Stitch (_mcRef, _oGameEngine) {
super(_mcRef);
oGameEngine = _oGameEngine;
init();
bSwitching = false;
bInBonus = false;
bGameWon = false;
setState(sSTATE_IDLE, true, true);
}
function init() {
nHitPoints = com.disney.gem.games.robotDance.GameData.nSTICH_ENERGY;
}
function shoot(_sShootingAt) {
switch (_sShootingAt) {
case com.disney.gem.games.robotDance.GameData.sDIRECTION_LEFT :
setState(sSTATE_SHOOT_LEFT, true, true);
break;
case com.disney.gem.games.robotDance.GameData.sDIRECTION_RIGHT :
setState(sSTATE_SHOOT_RIGHT, true, true);
}
if (bInBonus) {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.aSTITCH_SHOOT_BONUS[Math.floor(Math.random() * (com.disney.gem.games.robotDance.GameData.aSTITCH_SHOOT_BONUS.length - 1))], com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
} else {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSTITCH_SHOOT_NORMAL, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
}
}
function shot(_sDirection) {
nHitPoints--;
if (nHitPoints > 0) {
if (_sDirection == com.disney.gem.games.robotDance.GameData.sDIRECTION_LEFT) {
setState(sSTATE_SHOT_LEFT, true, true);
} else {
setState(sSTATE_SHOT_RIGHT, true, true);
}
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.aSTITCH_SHOT[Math.floor(Math.random() * (com.disney.gem.games.robotDance.GameData.aSTITCH_SHOT.length - 1))], com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
} else {
setState(sSTATE_LOSE);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSTITCH_LOSE_NORMAL, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
oGameEngine.stitchDestroyed();
}
}
function get Health() {
return(nHitPoints);
}
function won() {
if (!bInBonus) {
setState(sSTATE_WIN);
} else {
bGameWon = true;
bInBonus = false;
setState(sSTATE_WIN_BONUS);
}
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSTITCH_WIN, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
}
function switchGameMode() {
bSwitching = true;
}
function get isReady() {
return(!bSwitching);
}
function endBonus() {
bInBonus = false;
setState(sSTATE_SWITCH_NORMAL, true, true);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSTITCH_SWITCH, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
}
function destroy() {
super.destroy();
delete oGameEngine;
}
function isHurt() {
return((sState == sSTATE_SHOT_LEFT) || (sState == sSTATE_SHOT_RIGHT));
}
function onUpdate() {
super.onUpdate();
}
function state_Idle1Bonus() {
state_Idle();
}
function state_Idle2Bonus() {
state_Idle();
}
function state_Idle3Bonus() {
state_Idle();
}
function state_Idle1() {
state_Idle();
}
function state_Idle2() {
state_Idle();
}
function state_Idle3() {
state_Idle();
}
function state_Idle() {
if (stateFinished()) {
if (bSwitching) {
setState(sSTATE_SWITCH_BONUS, true, true);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSTITCH_SWITCH, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
} else {
setState(sSTATE_IDLE);
}
}
}
function state_ShotLeft() {
state_Shot();
}
function state_ShotRight() {
state_Shot();
}
function state_Shot() {
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function state_ShootLeftBonus() {
state_Shoot();
}
function state_ShootRightBonus() {
state_Shoot();
}
function state_ShootLeft() {
state_Shoot();
}
function state_ShootRight() {
state_Shoot();
}
function state_Shoot() {
if (stateFinished()) {
if (bSwitching) {
setState(sSTATE_SWITCH_BONUS, true, true);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSTITCH_SWITCH, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
} else {
setState(sSTATE_IDLE);
}
}
}
function state_Lose() {
if (stateFinished()) {
oGameEngine.playerLost();
mcRef.mcState.stop();
}
}
function state_Win() {
if (stateFinished()) {
oGameEngine.playerWon();
setState(sSTATE_IDLE, true, true);
}
}
function state_SwitchToBonus() {
if (stateFinished()) {
bInBonus = true;
bSwitching = false;
setState(sSTATE_IDLE, true, true);
oGameEngine.switchDone();
} else if (mcRef.mcState._currentframe == nFRAME_BACKGROUND_CHANGE) {
oGameEngine.changingBackground();
}
}
function state_SwitchToNormal() {
if (stateFinished()) {
if (bGameWon) {
setState(sSTATE_IDLE, true, true);
bSwitching = false;
oGameEngine.playerWon();
bGameWon = false;
} else {
setState(sSTATE_IDLE);
bSwitching = false;
oGameEngine.switchDone();
}
} else if (mcRef.mcState._currentframe == nFRAME_BACKGROUND_CHANGE) {
oGameEngine.changingBackground();
}
}
function state_BonusWin() {
if (stateFinished()) {
setState(sSTATE_SWITCH_NORMAL);
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sSTITCH_SWITCH, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
}
}
function setState(_sState, _bInstant, _bForce) {
if (_bInstant == undefined) {
_bInstant = false;
}
if (_bForce == undefined) {
_bForce = false;
}
if (_sState == sSTATE_IDLE) {
var _local6 = aSTATE_IDLE[Math.floor(Math.random() * aSTATE_IDLE.length)];
if (bInBonus) {
super.setState(_local6 + "Bonus", _bInstant, _bForce);
} else {
super.setState(_local6, _bInstant, _bForce);
}
} else if (bInBonus) {
super.setState(_sState + "Bonus", _bInstant, _bForce);
} else {
super.setState(_sState, _bInstant, _bForce);
}
}
static var aSTATE_IDLE = ["Idle1", "Idle2", "Idle3"];
static var sSTATE_IDLE = "Idle";
static var sSTATE_SHOT_LEFT = "ShotLeft";
static var sSTATE_SHOT_RIGHT = "ShotRight";
static var sSTATE_SHOOT_LEFT = "ShootLeft";
static var sSTATE_SHOOT_RIGHT = "ShootRight";
static var sSTATE_LOSE = "Lose";
static var sSTATE_WIN = "Win";
static var sSTATE_WIN_BONUS = "BonusWin";
static var sSTATE_SWITCH_BONUS = "SwitchToBonus";
static var sSTATE_SWITCH_NORMAL = "SwitchToNormal";
static var nFRAME_BACKGROUND_CHANGE = 15;
}
Symbol 1082 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();
if (NewSoundAllowed) {
if (_nVolume == undefined) {
_nVolume = 100;
}
if (_nLoop == undefined) {
_nLoop = 1;
}
if (_bUnique == undefined) {
_bUnique = false;
}
if (_bUnique) {
var _local9 = isSoundPlaying(_sLinkage);
if (_local9.bPlaying) {
var _local8 = false;
var _local7 = _local9.oSound;
} else {
var _local8 = true;
}
} else {
var _local8 = true;
}
if (_local8) {
doManageCategory(_sCategoryName);
var _local10 = getMCForSound();
var _local11 = new Sound(_local10);
_local11.attachSound(_sLinkage);
if (_local11.duration != undefined) {
var _local7 = new com.sarbakan.sound.SoundItem(_local11, _sLinkage, _nVolume, _nLoop, _sCategoryName, _local10);
}
_local7.doAddListener(com.sarbakan.sound.SoundManager);
aSounds.push(_local7);
}
}
return(_local7);
}
static function isSoundPlaying(_sLinkageName) {
var _local3 = new Object();
_local3.bPlaying = false;
_local3.oSound = undefined;
var _local4 = aSounds.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSounds[_local4].LinkageName == _sLinkageName) {
_local3.oSound = aSounds[_local4];
_local3.bPlaying = true;
}
}
return(_local3);
}
function getPlayingQty(_sLinkageName) {
var _local3 = 0;
var _local4 = aSounds.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSounds[_local4].LinkageName == _sLinkageName) {
_local3++;
}
}
return(_local3);
}
static function doManageExternalSound(_oSound) {
doCheckInit();
doManageCategory(_oSound.Category);
_oSound.doAddListener(com.sarbakan.sound.SoundManager);
aSounds.push(_oSound);
}
static function getMCForSound() {
var _local2 = getNextDepth();
var _local3 = mcAttach.createEmptyMovieClip("Snd" + _local2, _local2);
return(_local3);
}
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 _local2 = aSounds.length - 1;
for ( ; _local2 >= 0 ; _local2--) {
aSounds[_local2].doEnterFrame();
}
}
static function setCategoryVolume(_sCategoryName, _nVol) {
doManageCategory(_sCategoryName);
var _local4 = aSoundCategories.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSoundCategories[_local4].sName == _sCategoryName) {
aSoundCategories[_local4].nVolume = _nVol;
}
}
doUpdateAllSoundsVolume();
}
static function getCategoryVolume(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local4 = aSoundCategories.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSoundCategories[_local4].sName == _sCategoryName) {
var _local3 = aSoundCategories[_local4].nVolume;
}
}
return(_local3);
}
static function isCategoryMuted(_sCategoryName) {
doManageCategory(_sCategoryName);
var _local4 = aSoundCategories.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSoundCategories[_local4].sName == _sCategoryName) {
var _local3 = aSoundCategories[_local4].bMuted;
}
}
return(_local3);
}
static function doSoundEvent(_nEvent, _oSound) {
if (!(_nEvent === nEVENT_SOUND_COMPLETE)) {
} else {
var _local4 = false;
var _local5 = aSounds.length - 1;
for ( ; _local5 >= 0 ; _local5--) {
if (!_local4) {
if (aSounds[_local5] == _oSound) {
_local4 = true;
delete aSounds[_local5];
aSounds.splice(Number(_local5), 1);
}
}
}
}
}
static function doMuteCategory(_sCategoryName) {
var _local3 = aSoundCategories.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
if (aSoundCategories[_local3].sName == _sCategoryName) {
aSoundCategories[_local3].bMuted = true;
}
}
doUpdateAllSoundsVolume();
}
static function doUnMuteCategory(_sCategoryName) {
var _local3 = aSoundCategories.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
if (aSoundCategories[_local3].sName == _sCategoryName) {
aSoundCategories[_local3].bMuted = false;
}
}
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 _local3 = aSounds.length - 1;
for ( ; _local3 >= 0 ; _local3--) {
aSounds[_local3].doRemoveListener(_oListener);
}
}
static function doDestroy() {
doRemoveListenerFromAllSounds();
var _local2 = aSounds.length - 1;
for ( ; _local2 >= 0 ; _local2--) {
aSounds[_local2].doDestroy();
}
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 _local2 = aSounds.length - 1;
for ( ; _local2 >= 0 ; _local2--) {
aSounds[_local2].doUpdateSound();
}
}
static function doCheckInit() {
if (!bInited) {
}
}
static function doManageCategory(_sCategoryName) {
doCheckInit();
var _local3 = false;
var _local4 = aSoundCategories.length - 1;
for ( ; _local4 >= 0 ; _local4--) {
if (aSoundCategories[_local4].sName == _sCategoryName) {
_local3 = true;
}
}
if (!_local3) {
var _local5 = new Object();
_local5.sName = _sCategoryName;
_local5.nVolume = 100;
_local5.bMuted = false;
aSoundCategories.push(_local5);
}
}
static var nEVENT_SOUND_COMPLETE = 1;
static var sDEFAULT_CATEGORY = "SFX";
static var nMAX_SOUNDS_PLAYING = 32;
static var bInited = false;
}
Symbol 1083 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 _local3 = 0;
for ( ; _local3 < aEventListeners.length ; _local3++) {
if (aEventListeners[_local3] == _oListener) {
delete aEventListeners[_local3];
aEventListeners.splice(_local3, 1);
}
}
}
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(15 / 1000, _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 get Position() {
return(sndObj.position);
}
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;
for ( ; _local2 < aEventListeners.length ; _local2++) {
aEventListeners[_local2].doSoundEvent(com.sarbakan.sound.SoundManager.nEVENT_SOUND_COMPLETE, this);
}
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) {
if ((!bMuted) && (!com.sarbakan.sound.SoundManager.isCategoryMuted(sCategory))) {
var _local4 = com.sarbakan.sound.SoundManager.MasterVolume / 100;
var _local5 = com.sarbakan.sound.SoundManager.getCategoryVolume(sCategory) / 100;
var _local3 = _nVolume;
_local3 = _local3 * _local5;
_local3 = _local3 * _local4;
} else {
var _local3 = 0;
}
return(_local3);
}
static var nFADE_RATE = 8;
static var nFADE_AT_END_TIME = 800;
}
Symbol 1084 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 _local3 = 0;
if (__nNum < 0) {
_local3 = -1;
} else if (__nNum > 0) {
_local3 = 1;
}
return(_local3);
}
static function getReachZero(__nNum, __nReducer) {
return(getReachNum(__nNum, 0, __nReducer));
}
static function getReachNum(__nNum, __nTargetNum, __nReducer) {
var _local5 = __nNum;
if (_local5 != __nTargetNum) {
if (_local5 < __nTargetNum) {
_local5 = _local5 + __nReducer;
if (_local5 > __nTargetNum) {
_local5 = __nTargetNum;
}
} else {
_local5 = _local5 - __nReducer;
if (_local5 < __nTargetNum) {
_local5 = __nTargetNum;
}
}
}
return(_local5);
}
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 _local6 = __nX2 - __nX1;
var _local7 = __nY2 - __nY1;
var _local8 = Math.atan2(_local7, _local6);
var _local9 = getDegreeFromRadius(_local8);
return(_local9);
}
static function getCleanedAngle(_nAngle) {
while (_nAngle < 360) {
_nAngle = _nAngle + 360;
}
_nAngle = _nAngle % 360;
return(_nAngle);
}
static function getDegreeFromRadius(__nRadius) {
var _local3 = (__nRadius / MATH_PI) * 180;
return(_local3);
}
static function getRadianFromDegree(__nDegree) {
var _local3 = __nDegree * (MATH_PI / 180);
return(_local3);
}
static function getBoundsCenter(_oBox) {
var _local3 = (_oBox.xMin + _oBox.xMax) / 2;
var _local4 = (_oBox.yMin + _oBox.yMax) / 2;
return({x:_local3, y:_local4});
}
static var MATH_PI = Math.PI;
}
Symbol 1085 MovieClip [__Packages.mx.transitions.OnEnterFrameBeacon] Frame 0
class mx.transitions.OnEnterFrameBeacon
{
function OnEnterFrameBeacon () {
}
static function init() {
var _local2 = _global.MovieClip;
if (!_root.__OnEnterFrameBeacon) {
mx.transitions.BroadcasterMX.initialize(_local2);
var _local3 = _root.createEmptyMovieClip("__OnEnterFrameBeacon", 9876);
_local3.onEnterFrame = function () {
_global.MovieClip.broadcastMessage("onEnterFrame");
};
}
}
}
Symbol 1086 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 _local3 = _listeners;
var _local4 = _local3.length;
while (_local4--) {
if (_local3[_local4] == o) {
_local3.splice(_local4, 1);
if (!_local3.length) {
broadcastMessage = undefined;
}
return(true);
}
}
return(false);
}
function broadcastMessage() {
var _local2 = String(arguments.shift());
var _local3 = _listeners.concat();
var _local4 = _local3.length;
var _local5 = 0;
for ( ; _local5 < _local4 ; _local5++) {
_local3[_local5][_local2].apply(_local3[_local5], arguments);
}
}
}
Symbol 1087 MovieClip [__Packages.com.disney.gem.games.robotDance.game.Robot] Frame 0
class com.disney.gem.games.robotDance.game.Robot
{
var mcRef, oGameEngine, aActiveArms, oArm0, oArm1;
function Robot (_mcRef, _oGameEngine) {
mcRef = _mcRef;
oGameEngine = _oGameEngine;
}
function init() {
flushArms();
aActiveArms = new Array();
oArm0 = new com.disney.gem.games.robotDance.game.RobotArm(mcRef.mcArm1_All, this, com.disney.gem.games.robotDance.GameData.sDIRECTION_LEFT);
oArm1 = new com.disney.gem.games.robotDance.game.RobotArm(mcRef.mcArm2_All, this, com.disney.gem.games.robotDance.GameData.sDIRECTION_RIGHT);
oGameEngine.ControllerRef.oMainBroadcaster.addListener(oArm0);
oGameEngine.ControllerRef.oMainBroadcaster.addListener(oArm1);
oArm0.init();
oArm1.init();
aActiveArms.push(oArm0, oArm1);
}
function get Health() {
var _local2 = [oArm0.Health, oArm1.Health];
return(_local2);
}
function shot() {
var _local2 = com.disney.gem.games.robotDance.game.RobotArm(aActiveArms[Math.floor(Math.random() * aActiveArms.length)]);
_local2.shot();
return(_local2.Direction);
}
function shoot() {
var _local2 = com.disney.gem.games.robotDance.game.RobotArm(aActiveArms[Math.floor(Math.random() * aActiveArms.length)]);
_local2.shoot();
return(_local2.Direction);
}
function armsDestroyed(_oArm) {
var _local3 = 0;
for ( ; _local3 < aActiveArms.length ; _local3++) {
if (_oArm == aActiveArms[_local3]) {
aActiveArms.splice(_local3, 1);
break;
}
}
if (aActiveArms.length == 0) {
oGameEngine.robotDestroyed();
}
}
function armsHidden() {
if (oArm0.isHidden() && (oArm1.isHidden())) {
flushArms();
oGameEngine.armsGone();
}
}
function get Arms() {
return([oArm0, oArm1]);
}
function destroy() {
delete mcRef;
aActiveArms = new Array();
delete aActiveArms;
oGameEngine.ControllerRef.oMainBroadcaster.removeListener(oArm0);
oArm0.destroy();
delete oArm0;
oGameEngine.ControllerRef.oMainBroadcaster.removeListener(oArm1);
oArm1.destroy();
delete oArm1;
delete oGameEngine;
}
function flushArms() {
aActiveArms = new Array();
}
}
Symbol 1088 MovieClip [__Packages.com.disney.gem.games.robotDance.game.RobotArm] Frame 0
class com.disney.gem.games.robotDance.game.RobotArm extends com.disney.gem.games.robotDance.game.BaseCharacter
{
var oRobotController, sArmDirection, nHitPoints, mcRef, setMC, setState, sState, stateFinished, Mc, destroy;
function RobotArm (_mcRef, _oRobotEngine, _sDirection) {
super(_mcRef);
oRobotController = _oRobotEngine;
sArmDirection = _sDirection;
nHitPoints = com.disney.gem.games.robotDance.GameData.aCANNON_ENERGY[com.disney.gem.games.robotDance.Controller.getInstance().getLevel() - 1];
mcRef.gotoAndStop(com.disney.gem.games.robotDance.Controller.getInstance().getLevel());
setMC(mcRef.mcArm);
}
function init() {
setState(sSTATE_APPEAR, true, true);
}
function shoot() {
setState(sSTATE_SHOOT);
}
function shot() {
nHitPoints--;
if (nHitPoints > 0) {
if (com.disney.gem.games.robotDance.Controller.getInstance().oGame.isInBonus) {
setState(sSTATE_SHOT_BONUS);
} else {
setState(sSTATE_SHOT);
}
} else {
oRobotController.armsDestroyed(this);
setState(sSTATE_DISAPPEAR);
}
}
function get Direction() {
return(sArmDirection);
}
function get Health() {
return(nHitPoints);
}
function isHidden() {
return(sState == sSTATE_HIDDEN);
}
function state_ShotBonus() {
state_Shot();
}
function state_Shot() {
if (stateFinished()) {
setState(sSTATE_IDLE);
} else if (Mc.mcState._currentframe == nFRAME_HEALTH_LOST) {
com.disney.gem.games.robotDance.Controller.getInstance().oGame.updateHealth();
}
}
function state_Shoot() {
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
function state_Disappear_init() {
if (com.disney.gem.games.robotDance.Controller.getInstance().oGame.isInBonus) {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sLASER_DESTROYED_BONUS, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
} else {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sLASER_DESTROYED, com.disney.gem.games.robotDance.GameData.nSOUND_VOLUME_SOUND);
}
}
function state_Disappear() {
if (stateFinished()) {
setState(sSTATE_HIDDEN);
} else if (Mc.mcState._currentframe == nFRAME_HEALTH_LOST) {
com.disney.gem.games.robotDance.Controller.getInstance().oGame.updateHealth();
}
}
function state_Hidden_init() {
oRobotController.armsHidden();
com.disney.gem.games.robotDance.Controller.getInstance().oMainBroadcaster.removeListener(this);
destroy();
}
function state_Appear_init() {
com.sarbakan.sound.SoundManager.doPlaySoundInCat(com.disney.gem.games.robotDance.Controller.sSOUND_CAT_SOUND, com.disney.gem.games.robotDance.GameData.sLASER_APPEAR, com.disney.gem.games.robotDance.GameData.nLASER_APPEAR_VOL);
}
function state_Appear() {
if (stateFinished()) {
setState(sSTATE_IDLE);
}
}
static var sSTATE_IDLE = "Idle";
static var sSTATE_APPEAR = "Appear";
static var sSTATE_SHOOT = "Shoot";
static var sSTATE_SHOT = "Shot";
static var sSTATE_SHOT_BONUS = "ShotBonus";
static var sSTATE_DISAPPEAR = "Disappear";
static var sSTATE_HIDDEN = "Hidden";
static var nFRAME_HEALTH_LOST = 17;
}
Symbol 1089 MovieClip [__Packages.com.disney.gem.games.robotDance.game.Cursor] Frame 0
class com.disney.gem.games.robotDance.game.Cursor extends com.sarbakan.utils.StateManaged
{
var setState, sState, mcRef, stateFinished;
function Cursor (_mcRef) {
super(_mcRef);
setState(sSTATE_IDLE, true, true);
}
function setPress() {
setState(sSTATE_PRESS, true, true);
}
function isIdle() {
return(sState == sSTATE_IDLE);
}
function onPause() {
super.onPause();
mcRef.mcState.mcArrowUp.stop();
mcRef.mcState.mcArrowDown.stop();
}
function onUnPause() {
super.onUnPause();
mcRef.mcState.mcArrowUp.play();
mcRef.mcState.mcArrowDown.play();
}
function state_Press() {
if (stateFinished()) {
setState(sSTATE_IDLE, true, true);
}
}
static var sSTATE_IDLE = "Idle";
static var sSTATE_PRESS = "Press";
}
Symbol 1090 MovieClip [__Packages.com.disney.gem.games.robotDance.game.ComboBox] Frame 0
class com.disney.gem.games.robotDance.game.ComboBox extends com.sarbakan.utils.StateManaged
{
var setState, sComboShown, mcRef, stateFinished;
function ComboBox (_mcRef) {
super(_mcRef);
setState(sSTATE_HIDDEN);
}
function setCombo(_sNumberShown) {
sComboShown = _sNumberShown;
setState(sSTATE_SHOWN);
}
function state_Up_init() {
mcRef.mcState.mcContent.txtCombo.text = sComboShown;
}
function state_Up() {
if (stateFinished()) {
setState(sSTATE_HIDDEN);
}
}
static var sSTATE_HIDDEN = "Hidden";
static var sSTATE_SHOWN = "Up";
}
Symbol 1091 MovieClip [__Packages.com.disney.gem.games.robotDance.popups.LevelPopup] Frame 0
class com.disney.gem.games.robotDance.popups.LevelPopup extends com.sarbakan.utils.ScreenController
{
var bHidden, nTimer, oGameEngine, oController, mcRef, hide;
function LevelPopup (_mcRef, _oGameEngine) {
super(_mcRef);
bHidden = false;
nTimer = com.disney.gem.games.robotDance.GameData.nPOPUP_DELAY;
oGameEngine = _oGameEngine;
}
function onUpdate() {
super.onUpdate();
checkTimer();
}
function onPopupHidden() {
oGameEngine.startLevel();
}
function state_in_init() {
super.state_in_init();
setText();
}
function state_idle_init() {
super.state_idle_init();
setText();
}
function state_out_init() {
super.state_out_init();
setText();
}
function setText() {
mcRef.mcState.mcContent.txtLevel.text = com.disney.gem.games.robotDance.Controller(oController).getLevel();
}
function checkTimer() {
if (!bHidden) {
nTimer--;
if (nTimer < 0) {
bHidden = true;
hide(com.sarbakan.utils.Delegate.create(this, onPopupHidden));
}
}
}
}
Symbol 1092 MovieClip [__Packages.com.disney.gem.games.robotDance.popups.PerfectPopup] Frame 0
class com.disney.gem.games.robotDance.popups.PerfectPopup extends com.sarbakan.utils.ScreenController
{
var bHidden, nTimer, oGameEngine, hide;
function PerfectPopup (_mcRef, _oGameEngine) {
super(_mcRef);
bHidden = false;
nTimer = com.disney.gem.games.robotDance.GameData.nPOPUP_DELAY;
oGameEngine = _oGameEngine;
}
function onUpdate() {
super.onUpdate();
checkTimer();
}
function onPopupHidden() {
oGameEngine.perfectClosing();
}
function checkTimer() {
if (!bHidden) {
nTimer--;
if (nTimer < 0) {
bHidden = true;
hide(com.sarbakan.utils.Delegate.create(this, onPopupHidden));
}
}
}
}
Symbol 1093 MovieClip [__Packages.com.disney.gem.games.robotDance.popups.MenuPopup] Frame 0
class com.disney.gem.games.robotDance.popups.MenuPopup extends com.sarbakan.utils.ScreenController
{
var oController, hide, mcRef;
function MenuPopup (_mcRef) {
super(_mcRef);
}
function onBtSound() {
com.disney.gem.games.robotDance.Controller(oController).toggleSound();
updateSoundGroup();
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function onBtHelp() {
com.disney.gem.games.robotDance.Controller(oController).showInstructions();
hide(null, true);
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function onBtQuit() {
com.disney.gem.games.robotDance.Controller(oController).showPopup(new com.disney.gem.games.robotDance.popups.ConfirmPopup(com.disney.gem.games.robotDance.Controller(oController).mcTimeline.mcPopups.mcConfirm, this), true);
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function onBtResume() {
com.disney.gem.games.robotDance.Controller(oController).unpause();
com.disney.gem.games.robotDance.Controller(oController).resumeGame();
hide();
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function state_in_init() {
super.state_in_init();
setBts();
}
function state_idle_init() {
super.state_idle_init();
setBts();
}
function state_idle() {
updateSoundGroup();
}
function state_out_init() {
super.state_out_init();
setBts();
}
function setBts() {
mcRef.mcState.mcContent.btHelp.onRelease = com.sarbakan.utils.Delegate.create(this, onBtHelp);
mcRef.mcState.mcContent.btQuit.onRelease = com.sarbakan.utils.Delegate.create(this, onBtQuit);
mcRef.mcState.mcContent.btResume.onRelease = com.sarbakan.utils.Delegate.create(this, onBtResume);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btHelp);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btQuit);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btResume);
updateSoundGroup();
}
function updateSoundGroup() {
var _local2 = "On";
if (com.disney.gem.games.robotDance.Controller(oController).bSoundMuted) {
_local2 = "Off";
}
mcRef.mcState.mcContent.mcSoundToggle.gotoAndStop(_local2);
mcRef.mcState.mcContent.mcSoundToggle.btSound.onRelease = com.sarbakan.utils.Delegate.create(this, onBtSound);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.mcSoundToggle.btSound);
}
}
Symbol 1094 MovieClip [__Packages.com.disney.gem.games.robotDance.popups.ConfirmPopup] Frame 0
class com.disney.gem.games.robotDance.popups.ConfirmPopup extends com.sarbakan.utils.ScreenController
{
var oMenuOrigin, hide, oController, mcRef;
function ConfirmPopup (_mcRef, _oMenuOrigin) {
super(_mcRef);
oMenuOrigin = _oMenuOrigin;
}
function onBtNo() {
hide();
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function onBtYes() {
hide();
com.disney.gem.games.robotDance.Controller(oController).onGameLose();
oMenuOrigin.hide();
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function state_in_init() {
super.state_in_init();
setBts();
}
function state_idle_init() {
super.state_idle_init();
setBts();
}
function state_out_init() {
super.state_out_init();
setBts();
}
function setBts() {
mcRef.mcState.mcContent.btYes.onRelease = com.sarbakan.utils.Delegate.create(this, onBtYes);
mcRef.mcState.mcContent.btNo.onRelease = com.sarbakan.utils.Delegate.create(this, onBtNo);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btYes);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btNo);
}
}
Symbol 1095 MovieClip [__Packages.com.sarbakan.utils.Tools] Frame 0
class com.sarbakan.utils.Tools
{
function Tools () {
}
static function isItemInArray(_aArray, _oItem) {
var _local4 = false;
var _local5 = _aArray.length - 1;
for ( ; _local5 >= 0 ; _local5--) {
if (_aArray[_local5] == _oItem) {
_local4 = true;
}
}
return(_local4);
}
static function doCopyArray(_aArraySource) {
var _local3 = new Array();
var _local4 = 0;
_local4 = 0;
for ( ; _local4 < _aArraySource.length ; _local4++) {
if (_aArraySource[_local4] instanceof Array) {
_local3.push(doCopyArray(_aArraySource[_local4]));
} else {
_local3.push(_aArraySource[_local4]);
}
}
return(_local3);
}
static function getFormatedNumber(_nNumber, _nMinimumChar) {
return(returnFormatedNumber(_nNumber, _nMinimumChar));
}
static function returnFormatedNumber(_nNumber, _nMinimumChar) {
var _local4 = String(_nNumber);
while (_local4.length < _nMinimumChar) {
_local4 = "0" + _local4;
}
var _local5 = new Array();
var _local6 = _local4.length - 1;
var _local7 = 0;
for ( ; _local7 <= _local6 ; _local7++) {
var _local8 = _local4.charAt(_local7);
_local5.push(_local8);
}
_local4 = "";
var _local9 = 0;
_local7 = _local5.length - 1;
for ( ; _local7 >= 0 ; _local7--) {
if (((_local9 % 3) == 0) && (_local9 != 0)) {
_local4 = "," + _local4;
}
_local4 = _local5[_local7] + _local4;
_local9++;
}
return(_local4);
}
static function getFormatedTime(_nTime, _bIncludeMilliseconds, _bShowMinutes) {
if (_bIncludeMilliseconds == undefined) {
_bIncludeMilliseconds = false;
}
if (_bShowMinutes == undefined) {
_bShowMinutes = true;
}
var _local5 = false;
if (_nTime < 0) {
_local5 = true;
_nTime = Math.abs(_nTime);
}
var _local6 = Math.floor(_nTime / 1000);
if (_bIncludeMilliseconds) {
if (_nTime >= 1000) {
var _local8 = _nTime % (_local6 * 1000);
} else {
var _local8 = _nTime;
}
var _local7 = String(_local8).substr(0, 2);
if (_local7.length <= 1) {
_local7 = "0" + _local7;
}
}
var _local9 = Math.floor(_local6 / 60);
var _local10 = Math.floor(_local6 % 60);
var _local11 = "";
var _local12 = "";
if (_local10 < 10) {
_local12 = "0";
}
if (_local9 < 10) {
_local11 = "0";
}
var _local13 = "";
if (_bShowMinutes) {
_local13 = _local13 + String((_local11 + _local9) + ":");
}
_local13 = _local13 + (_local12 + _local10);
if (_bIncludeMilliseconds) {
_local13 = _local13 + (":" + _local7);
}
if (_local5) {
_local13 = "-" + _local13;
}
return(_local13);
}
static function getTrimmedString(_sStr) {
while (_sStr.charAt(0) == " ") {
_sStr = _sStr.substring(1, _sStr.length);
}
while (_sStr.charAt(_sStr.length - 1) == " ") {
_sStr = _sStr.substring(0, _sStr.length - 1);
}
return(_sStr);
}
}
Symbol 1096 MovieClip [__Packages.com.disney.gem.games.robotDance.screens.TitleScreen] Frame 0
class com.disney.gem.games.robotDance.screens.TitleScreen extends com.sarbakan.utils.ScreenController
{
var nTimesPerfAltered, oController, mcRef, nLastFrame;
function TitleScreen (_mcRef) {
super(_mcRef);
nTimesPerfAltered = 0;
}
function onBtHelp() {
com.disney.gem.games.robotDance.Controller(oController).showInstructions();
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function onBtPlay() {
com.disney.gem.games.robotDance.Controller(oController).startNewGame();
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function state_idle_init() {
super.state_idle_init();
mcRef.mcState.mcContent.btHelp.onRelease = com.sarbakan.utils.Delegate.create(this, onBtHelp);
mcRef.mcState.mcContent.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btPlay);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btHelp);
}
function state_idle() {
if (com.disney.gem.games.robotDance.Controller.bPerfAltered == undefined) {
if (nLastFrame != undefined) {
var _local2 = (getTimer() - nLastFrame) / (1000 / com.disney.gem.games.robotDance.GameData.nTARGET_FPS);
if (Math.abs(1 - _local2) > 1) {
nTimesPerfAltered++;
} else {
nTimesPerfAltered--;
}
}
if (nTimesPerfAltered >= 10) {
com.disney.gem.games.robotDance.Controller.bPerfAltered = true;
} else if (nTimesPerfAltered < -10) {
com.disney.gem.games.robotDance.Controller.bPerfAltered = false;
}
nLastFrame = getTimer();
}
}
}
Symbol 1097 MovieClip [__Packages.com.disney.gem.games.robotDance.screens.HelpScreen] Frame 0
class com.disney.gem.games.robotDance.screens.HelpScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function HelpScreen (_mcRef) {
super(_mcRef);
}
function onBtBack() {
com.disney.gem.games.robotDance.Controller(oController).hideInstructions();
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function state_idle_init() {
super.state_idle_init();
mcRef.mcState.mcContent.btBack.onRelease = com.sarbakan.utils.Delegate.create(this, onBtBack);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btBack);
}
}
Symbol 1098 MovieClip [__Packages.com.disney.gem.games.robotDance.screens.EndScreen] Frame 0
class com.disney.gem.games.robotDance.screens.EndScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function EndScreen (_mcRef) {
super(_mcRef);
}
function onBtPlay() {
com.disney.gem.games.robotDance.Controller(oController).showTitleScreen(true);
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function state_in_init() {
super.state_in_init();
updateBtn();
}
function state_idle_init() {
super.state_idle_init();
updateBtn();
}
function state_out_init() {
super.state_out_init();
updateBtn();
}
function updateBtn() {
mcRef.mcState.mcContent.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btPlay);
mcRef.mcState.mcContent.txtScore.text = com.sarbakan.utils.Tools.getFormatedNumber(com.disney.gem.games.robotDance.Controller.getInstance().getScore());
}
}
Symbol 1099 MovieClip [__Packages.com.disney.gem.games.robotDance.screens.WinScreen] Frame 0
class com.disney.gem.games.robotDance.screens.WinScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function WinScreen (_mcRef) {
super(_mcRef);
}
function onBtPlay() {
com.disney.gem.games.robotDance.Controller(oController).showTitleScreen(true);
com.disney.gem.games.robotDance.Controller(oController).playClickSound();
}
function state_in_init() {
super.state_in_init();
updateBtn();
}
function state_idle_init() {
super.state_idle_init();
updateBtn();
}
function state_out_init() {
super.state_out_init();
updateBtn();
}
function updateBtn() {
mcRef.mcState.mcContent.btPlay.onRelease = com.sarbakan.utils.Delegate.create(this, onBtPlay);
mcRef.mcState.mcContent.txtScore.text = com.sarbakan.utils.Tools.getFormatedNumber(com.disney.gem.games.robotDance.Controller.getInstance().getScore());
com.disney.gem.games.robotDance.Controller(oController).applyRollSound(mcRef.mcState.mcContent.btPlay);
}
}
Symbol 1100 MovieClip [__Packages.com.disney.gem.games.robotDance.screens.PreloaderScreen] Frame 0
class com.disney.gem.games.robotDance.screens.PreloaderScreen extends com.sarbakan.utils.ScreenController
{
var oController, mcRef;
function PreloaderScreen (_mcRef) {
super(_mcRef);
}
function state_idle() {
var _local2 = com.disney.gem.games.robotDance.Controller(oController).mcTimeline.getBytesLoaded() / com.disney.gem.games.robotDance.Controller(oController).mcTimeline.getBytesTotal();
mcRef.mcState.txtLoading.text = Math.round(_local2 * 100);
if (_local2 == 1) {
com.disney.gem.games.robotDance.Controller(oController).onPreloadingDone();
}
}
}
Symbol 130 MovieClip Frame 1
stop();
Symbol 506 MovieClip Frame 1
stop();