Frame 1
var game = (new com.midasplayer.bouncer.Game(_root));
Symbol 49 MovieClip [mcSantaCrash] Frame 3
stop();
Symbol 97 MovieClip Frame 1
_zindexcounter = 0;
_screenSizeX = 342;
_screenSizeY = 110;
_nrofflakes = 20;
_i = 1;
while (_i <= _nrofflakes) {
this._type = random(4) + 1;
duplicateMovieClip ("mc_snow1", "mc_snowflake" add this._i, this._zindexcounter + this._i);
tellTarget ("mc_snowflake" add this._i) {
_x = random(this._screenSizeX);
_y = random(this._screenSizeY);
_type = _parent._type;
(_speed = _parent._type * 1);
_alpha = (_parent._type * 25);
};
_i++;
}
Symbol 97 MovieClip Frame 2
_i = 1;
while (_i <= this._nrofflakes) {
tellTarget ("mc_snowflake" add _i) {
_x = (_x + (Math.cos(_y / (_type * 4)) * random(_type * 2)));
if (_y < this._screenSizeY) {
_y = (_y + _speed);
} else {
_y = 0;
_x = (0 + random(this._screenSizeX));
}
};
_i++;
}
Symbol 97 MovieClip Frame 3
gotoAndPlay(_currentframe - 1);
Symbol 137 MovieClip Frame 1
_parent.animateCloud(this);
Symbol 140 MovieClip Frame 1
_parent.animateCloud(this);
Symbol 141 MovieClip Frame 1
function animateCloud(_cloud) {
tellTarget (_cloud) {
_x = (_x - _speed);
if (_x < -100) {
_x = 400;
_y = (random(100) - 50);
}
};
}
mcCloud01._speed = 1;
mcCloud02._speed = 1.5;
mcCloud03._speed = 0.5;
Symbol 148 MovieClip Frame 1
_zindexcounter = 0;
_screenSizeX = 342;
_screenSizeY = 110;
_nrofflakes = 20;
_i = 1;
while (_i <= _nrofflakes) {
this._type = random(4) + 1;
duplicateMovieClip ("mc_snow1", "mc_snowflake" add this._i, this._zindexcounter + this._i);
tellTarget ("mc_snowflake" add this._i) {
_x = random(this._screenSizeX);
_y = random(this._screenSizeY);
_type = _parent._type;
(_speed = _parent._type * 1);
_alpha = (_parent._type * 25);
};
_i++;
}
Symbol 148 MovieClip Frame 2
_i = 1;
while (_i <= this._nrofflakes) {
tellTarget ("mc_snowflake" add _i) {
_x = (_x + (Math.cos(_y / (_type * 4)) * random(_type * 2)));
if (_y < this._screenSizeY) {
_y = (_y + _speed);
} else {
_y = 0;
_x = (0 + random(this._screenSizeX));
}
};
_i++;
}
Symbol 148 MovieClip Frame 3
gotoAndPlay(_currentframe - 1);
Symbol 213 MovieClip [mcScoreBubbleYellow] Frame 4
stop();
Symbol 223 MovieClip [mcScoreBubbleWhite] Frame 4
stop();
Symbol 233 MovieClip [mcScoreBubbleRed] Frame 4
stop();
Symbol 243 MovieClip [mcScoreBubbleGrey] Frame 4
stop();
Symbol 253 MovieClip [mcScoreBubbleGreen] Frame 4
stop();
Symbol 263 MovieClip [mcScoreBubbleBlue] Frame 4
stop();
Symbol 277 MovieClip [mcSmallbearYellowCrash] Frame 2
stop();
Symbol 300 MovieClip [mcSmallbearRedCrash] Frame 2
stop();
Symbol 323 MovieClip [mcSmallbearGreenCrash] Frame 2
stop();
Symbol 346 MovieClip [mcBigbearYellowCrash] Frame 2
stop();
Symbol 369 MovieClip [mcBigbearRedCrash] Frame 2
stop();
Symbol 392 MovieClip [mcBigbearGreenCrash] Frame 2
stop();
Symbol 415 MovieClip [mcBigbearBlueCrash] Frame 2
stop();
Symbol 445 MovieClip [mcBounceMatAnimBlue02] Frame 1
stop();
Symbol 473 MovieClip [mcSantaSplash] Frame 19
stop();
Symbol 508 MovieClip [mcSplash01] Frame 52
stop();
Symbol 585 MovieClip [mcSmallbearBlueCrash] Frame 2
stop();
Symbol 631 MovieClip Frame 2
stop();
Symbol 639 MovieClip Frame 2
stop();
Symbol 640 MovieClip [mcInstructions] Frame 133
this._y = this._y + 10;
Symbol 640 MovieClip [mcInstructions] Frame 134
this._y = this._y - 12;
Symbol 640 MovieClip [mcInstructions] Frame 136
this._y = this._y + 2;
Symbol 640 MovieClip [mcInstructions] Frame 144
this._y = this._y + 5;
Symbol 640 MovieClip [mcInstructions] Frame 145
this._y = this._y - 6;
Symbol 640 MovieClip [mcInstructions] Frame 147
this._y = this._y + 1;
Symbol 640 MovieClip [mcInstructions] Frame 193
stop();
Symbol 641 MovieClip [__Packages.com.midasplayer.bouncer.Game] Frame 0
class com.midasplayer.bouncer.Game
{
static var NUMBER_TRAMPOLINES, NUMBER_LEVELS, QUALIFICATION, TIME_LIMIT, NUMBER_BEARS, NUMBER_BUMPERS, DOOR_TOP_Y, DOOR_BOTTOM_Y, SCORE_TRAMPOLINE_BOUNCE, SCORE_BEAR_SMALL, SCORE_BEAR_BIG, SCORE_BEAR_SANTA, SCORE_COLOR_ADDITION, LAST_LEVEL_BONUS, POWER_GAME_DURATION, POWER_ICE_DURATION, POWER_EXTRA_BEAR_DURATION;
var m_resetTick, m_tickCount, m_gameState, m_scopeRef, m_world, m_bumperPosArray, m_doorPosArray, m_doorColorArray, m_bearPosArray, m_bearSizeArray, m_bearColorArray, m_bearPosReserveArray, m_powerPosArray, m_powerTypeArray, m_powerTimeArray, m_trampolineArray, m_colorSaveCount, m_clientInputValues, m_gda, m_scoreBoard, m_gameBorder, m_powerEnabledArray, m_powerIconArray, m_fpsCounter, m_timeLeft, m_oceanBillboard, m_whaleBillboard, m_infoScreen, m_activeTrampoline, m_activeTrampolinePoint;
function Game (scope) {
m_resetTick = true;
m_tickCount = 0;
m_lastTickTime = -1;
m_ipTime = 0;
m_gameState = STATE_INTRUCTIONS;
m_scopeRef = scope;
m_world = new com.midasplayer.bouncer.World(m_scopeRef, this);
m_world.getClip()._x = GUI_X;
m_bumperPosArray = new Array();
m_doorPosArray = new Array();
m_doorColorArray = new Array();
m_bearPosArray = new Array();
m_bearSizeArray = new Array();
m_bearColorArray = new Array();
m_bearPosReserveArray = new Array();
var _local2 = 0;
while (_local2 <= com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT) {
m_bearPosReserveArray.push(false);
_local2++;
}
m_powerPosArray = new Array();
m_powerTypeArray = new Array();
m_powerTimeArray = new Array();
m_trampolineArray = new Array();
m_colorSaveCount = new Array(0, 0, 0, 0);
m_clientInputValues = new Array();
m_gda = new com.midasplayer.util.GameDataAcquirer();
m_gda.beginWait(mx.utils.Delegate.create(this, setupGame));
}
function addClientInput(type, x, y) {
var _local3 = new com.midasplayer.bouncer.ClientInput();
_local3.m_type = type;
_local3.m_x = x;
_local3.m_y = y;
var _local2 = 0;
while (_local2 < m_clientInputValues.length) {
if (m_clientInputValues[_local2].m_type == INPUT_MOVE) {
m_clientInputValues.splice(_local2, 1);
_local2--;
}
_local2++;
}
m_clientInputValues.push(_local3);
}
function popClientInput() {
if (m_clientInputValues.length == 0) {
return(undefined);
}
var _local2 = m_clientInputValues[0];
m_clientInputValues.splice(0, 1);
return(_local2);
}
static function isServer() {
return(SERVER);
}
static function isClient() {
return(!SERVER);
}
function setupGame() {
getGameData();
init();
}
function init() {
initScoreBoard();
updateGUI();
setupInput();
startUpdate();
setBackground(m_level);
}
function getGameData() {
com.midasplayer.util.Randomizer.seed(new Number(m_gda.getGameData("randomseed")));
NUMBER_TRAMPOLINES = Number(m_gda.getGameData("numberTrampolines"));
NUMBER_LEVELS = Number(m_gda.getGameData("numberLevels"));
QUALIFICATION = m_gda.getGameData("qualification");
TIME_LIMIT = m_gda.getGameData("timeLimit");
NUMBER_BEARS = m_gda.getGameData("numberBears");
NUMBER_BUMPERS = m_gda.getGameData("numberBumpers");
DOOR_TOP_Y = Number(m_gda.getGameData("doorTopY"));
DOOR_BOTTOM_Y = Number(m_gda.getGameData("doorBottomY"));
SCORE_TRAMPOLINE_BOUNCE = Number(m_gda.getGameData("scoreTrampolineBounce"));
SCORE_BEAR_SMALL = Number(m_gda.getGameData("scoreBearSmall"));
SCORE_BEAR_BIG = Number(m_gda.getGameData("scoreBearBig"));
SCORE_BEAR_SANTA = Number(m_gda.getGameData("scoreBearSanta"));
SCORE_COLOR_ADDITION = Number(m_gda.getGameData("scoreColorAddition"));
LAST_LEVEL_BONUS = Number(m_gda.getGameData("lastLevelBonus"));
POWER_GAME_DURATION = Number(m_gda.getGameData("powerGameDuration"));
POWER_ICE_DURATION = Number(m_gda.getGameData("powerIceDuration"));
POWER_EXTRA_BEAR_DURATION = Number(m_gda.getGameData("powerExtraBearDuration"));
m_bumperPosArray = m_gda.getGameData("bumperPosArray");
m_doorPosArray = m_gda.getGameData("doorPosArray");
m_doorColorArray = m_gda.getGameData("doorColorArray");
var _local2 = 0;
while (_local2 < NUMBER_LEVELS) {
m_bearPosArray.push(m_gda.getGameData("bearPosArray_" + _local2));
m_bearSizeArray.push(m_gda.getGameData("bearSizeArray_" + _local2));
m_bearColorArray.push(m_gda.getGameData("bearColorArray_" + _local2));
var _local3 = String(m_gda.getGameData("powerTimeArray_" + _local2)) != "";
m_powerPosArray.push((_local3 ? (m_gda.getGameData("powerPosArray_" + _local2)) : (new Array())));
m_powerTypeArray.push((_local3 ? (m_gda.getGameData("powerTypeArray_" + _local2)) : (new Array())));
m_powerTimeArray.push((_local3 ? (m_gda.getGameData("powerTimeArray_" + _local2)) : (new Array())));
_local2++;
}
}
function initScoreBoard() {
m_scoreBoard = m_scopeRef.attachMovie("mcScoreboard01", "scoreboard", m_scopeRef.getNextHighestDepth());
m_gameBorder = m_scopeRef.attachMovie("mcGameBorder", "gameBorder", m_scopeRef.getNextHighestDepth());
m_gameBorder._x = GUI_X;
createOutline();
m_powerEnabledArray = new Array();
m_powerIconArray = new Array();
var _local2 = 0;
while (_local2 < POWER_NUMBER) {
m_powerEnabledArray.push(0);
var _local3 = getPowerString(_local2);
m_powerIconArray.push(m_scopeRef.attachMovie(("mcPowerup" + _local3) + "-active", "powerIcon_" + _local2, m_scopeRef.getNextHighestDepth()));
m_powerIconArray[_local2]._y = 3;
if (_local2 == 0) {
m_powerIconArray[_local2]._x = GUI_X + 3;
} else if (_local2 == 1) {
m_powerIconArray[_local2]._x = (GUI_X + com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT) - 3;
m_powerIconArray[_local2]._xscale = -100;
} else if (_local2 == 2) {
m_powerIconArray[_local2]._x = GUI_X + 3;
m_powerIconArray[_local2]._y = m_powerIconArray[_local2]._height;
}
_local2++;
}
m_scoreBoard.score_text.text = com.midasplayer.util.I18n.getString("score");
m_scoreBoard.saved_text.text = com.midasplayer.util.I18n.getString("saved");
m_scoreBoard.missed_text.text = com.midasplayer.util.I18n.getString("missed");
m_scoreBoard.time_text.text = com.midasplayer.util.I18n.getString("time");
m_scoreBoard.level_text.text = com.midasplayer.util.I18n.getString("level");
m_scoreBoard.sound_text.text = com.midasplayer.util.I18n.getString("sound");
m_scoreBoard.exit_text.text = com.midasplayer.util.I18n.getString("exit");
new com.midasplayer.bouncer.SoundToggle(m_scopeRef, 161, 497);
var _local4 = m_scopeRef.attachMovie("mcExitButton", "exitButton", m_scopeRef.getNextHighestDepth());
_local4._x = 161;
_local4._y = 542;
_local4.onRelease = mx.utils.Delegate.create(this, exitGame);
if (DEV) {
m_fpsCounter = new com.midasplayer.util.FpsCounter(m_scopeRef);
}
}
function exitGame() {
if (getState() == STATE_INTRUCTIONS) {
return(undefined);
}
if (!PRACTICE_GAME) {
var _local2 = ("666," + getTick()) + " ,=0";
fscommand ("playData", _local2);
trace("playData: " + _local2);
}
m_level++;
setState(STATE_GAME_OVER);
}
function getTickCount() {
return(m_tickCount);
}
function getScore() {
return(m_score);
}
function getState() {
return(m_gameState);
}
function setState(state) {
m_gameState = state;
}
static function setTimeFactor(factor) {
TIME_FACTOR = factor;
TIME_PER_TICK = 1000 / (TICKS_PER_SECOND * TIME_FACTOR);
}
function startUpdate() {
m_scopeRef.onEnterFrame = mx.utils.Delegate.create(this, update);
updateGUI();
}
function getIPTime() {
return(m_ipTime);
}
function getTick() {
return(m_tickCount);
}
function update() {
if (m_gameState == STATE_NONE) {
trace("INVALID GAME STATE!!");
}
if (m_gameState == STATE_INTRUCTIONS) {
updateInstructions();
}
if (m_gameState == STATE_START_GAME) {
fscommand ("gameStart");
setState(STATE_SETUP);
}
if (m_gameState == STATE_SETUP) {
trace("-- State: SETUP");
setupWorld();
setState(STATE_RUNNING);
}
if (m_gameState == STATE_RUNNING) {
gameLoop();
}
if (m_gameState == STATE_LEVEL_OVER) {
trace("-- State: LEVEL_OVER");
com.midasplayer.fx.SoundManager.stopAll();
if (((m_level + 1) >= NUMBER_LEVELS) || (getSavedBears() < QUALIFICATION[m_level])) {
setState(STATE_GAME_OVER);
} else {
setState(STATE_LEVEL_SUMMARY);
}
m_level++;
m_world.clearWorldObjects();
}
if (m_gameState == STATE_LEVEL_SUMMARY) {
updateSummary();
}
if (m_gameState == STATE_GAME_OVER) {
if (getSavedBears() >= QUALIFICATION[NUMBER_LEVELS - 1]) {
m_score = m_score + LAST_LEVEL_BONUS;
m_scoreBoard.score.text = m_score;
}
setState(STATE_GAME_SUMMARY);
}
if (m_gameState == STATE_GAME_SUMMARY) {
if (!m_gameEnd) {
m_gameEnd = true;
fscommand ("gameEnd", m_score);
trace("gameEnd: " + m_score);
}
updateGameOver();
}
if (m_gameState == STATE_END_GAME) {
com.midasplayer.fx.SoundManager.stopAll();
if (!m_gameQuit) {
m_gameQuit = true;
fscommand ("gameQuit");
trace("gameQuit");
}
}
}
function gameLoop() {
if (m_resetTick) {
m_resetTick = false;
m_lastTickTime = getTimer();
}
var _local2 = 0;
for(;;){
m_ipTime = (getTimer() - m_lastTickTime) / TIME_PER_TICK;
if (m_ipTime == undefined) {
trace("error");
}
if (m_ipTime < 1) {
break;
}
updateGame();
if (getState() != STATE_RUNNING) {
break;
}
updateBillboards();
if (_local2 >= 1000) {
trace("Infinite recursions or intolerable delay in gameLoop");
break;
}
_local2++;
};
m_world.render(m_ipTime);
}
function updateGame() {
var _local2;
while (_local2 = popClientInput() , _local2 != undefined) {
switch (_local2.m_type) {
case INPUT_PRESS :
addTrampoline(_local2.m_x, _local2.m_y);
break;
case INPUT_RELEASE :
moveTrampoline(_local2.m_x, _local2.m_y);
enableTrampoline();
break;
case INPUT_MOVE :
moveTrampoline(_local2.m_x, _local2.m_y);
}
}
trace("---------------------------");
trace("tick: " + getTickCount());
m_world.update();
updatePowers();
var _local3 = m_numberBears;
if (isPowerEnabled(POWER_EXTRA_BEAR)) {
_local3++;
}
if (m_bearCount < _local3) {
if (isClient()) {
addBear();
}
}
if (isPowerEnabled(POWER_SANTA)) {
if (addBear(COLOR_NONE, com.midasplayer.bouncer.Bear.SIZE_SANTA)) {
disablePower(POWER_SANTA);
}
}
updateGUI();
m_timeLeft = m_timeLeft - TIME_PER_TICK;
m_lastTickTime = m_lastTickTime + TIME_PER_TICK;
m_tickCount++;
if (m_timeLeft <= 0) {
setState(STATE_LEVEL_OVER);
}
}
function updatePowers() {
var _local7 = TIME_LIMIT[m_level] - m_timeLeft;
var _local8 = _local7 - TIME_PER_TICK;
var _local3 = 0;
while (_local3 < m_powerTimeArray[m_level].length) {
var _local4 = m_powerTimeArray[m_level][_local3] * 1000;
if ((_local4 > _local8) && (_local4 <= _local7)) {
trace("---- Add power: " + m_powerTypeArray[m_level][_local3]);
var _local2 = new com.midasplayer.bouncer.PowerUp();
var _local6 = Number(m_powerPosArray[m_level][_local3 * 2]);
var _local5 = Number(m_powerPosArray[m_level][(_local3 * 2) + 1]);
_local2.setPos(_local6, _local5);
_local2.setPower(Number(m_powerTypeArray[m_level][_local3]), this);
_local2.setDestroyTick(getTickCount() + (POWER_GAME_DURATION * TICKS_PER_SECOND));
m_world.addWorldObject(_local2, COLLISION_LAYER);
}
_local3++;
}
_local3 = 0;
while (_local3 < m_powerEnabledArray.length) {
m_powerEnabledArray[_local3] = Math.max(0, m_powerEnabledArray[_local3] - 1);
_local3++;
}
}
function updateBillboards() {
var _local3 = m_world.getBackground().getClip()._framesloaded / m_world.getBackground().getPlaybackSpeed();
var _local2 = Math.sin(((getTickCount() / _local3) * Math.PI) * 2);
var _local5 = -10 + (10 * _local2);
m_oceanBillboard.setNextX(_local5);
var _local4 = (com.midasplayer.bouncer.World.WORLD_EDGE_BOTTOM - 40) + (_local2 * 5);
m_whaleBillboard.setNextY(_local4);
if (Math.abs(m_whaleBillboard.getX() - (com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT / 2)) >= 600) {
m_whaleBillboard.setVelX(m_whaleBillboard.getVelX() * -1);
m_whaleBillboard.setScaleX(m_whaleBillboard.getScaleX() * -1);
}
}
function getSavedBears() {
return(m_saveCount - m_killCount);
}
function updateGUI() {
var _local3 = Math.round(m_timeLeft / 1000);
m_scoreBoard.score.text = m_score;
m_scoreBoard.time.text = _local3;
if (m_scoreBoard.time.text == "NaN") {
m_scoreBoard.time.text = "-";
}
if ((_local3 < 10) && ((m_timeLeft % 500) < 250)) {
m_scoreBoard.time._visible = false;
} else {
m_scoreBoard.time._visible = true;
}
m_scoreBoard.save_count.text = (getSavedBears() + " / ") + QUALIFICATION[m_level];
m_scoreBoard.miss_count.text = m_killCount;
m_scoreBoard.level.text = m_level + 1;
var _local2 = 0;
while (_local2 < m_powerEnabledArray.length) {
if (m_powerEnabledArray[_local2] <= 0) {
m_powerIconArray[_local2]._visible = false;
} else {
m_powerIconArray[_local2]._visible = true;
}
_local2++;
}
}
function infoScreenExit(state) {
setState(state);
delete m_infoScreen;
}
function updateInstructions() {
if (m_infoScreen == undefined) {
m_infoScreen = new com.midasplayer.bouncer.InfoScreen();
m_infoScreen.init(this, m_scopeRef, "mcInstructions");
m_infoScreen.setExitState(STATE_START_GAME);
m_infoScreen.setExpireTime(15);
m_infoScreen.setExitDelay(0);
m_infoScreen.setSound(SOUND_INTRO);
m_infoScreen.setFps(16);
m_infoScreen.setLooping(false);
m_infoScreen.setPos((GUI_X + (com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT / 2)) - 5, MOVIE_HEIGHT / 2);
m_infoScreen.setText("instruction_text", com.midasplayer.util.I18n.getString("instruction_text"));
m_infoScreen.setText("how_to_draw", com.midasplayer.util.I18n.getString("how_to_draw"));
}
m_infoScreen.update();
}
function updateSummary() {
if (m_infoScreen == undefined) {
var _local3 = -171;
var _local2 = -163;
m_infoScreen = new com.midasplayer.bouncer.InfoScreen();
m_infoScreen.init(this, m_scopeRef, "mcLevelWindow");
m_infoScreen.setExitState(STATE_SETUP);
m_infoScreen.setExpireTime(10);
m_infoScreen.setExitDelay(1);
m_infoScreen.setSound(SOUND_LEVEL_COMPLETE);
m_infoScreen.setPos((GUI_X + (com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT / 2)) + _local3, (MOVIE_HEIGHT / 2) + _local2);
m_infoScreen.setText("header", (((com.midasplayer.util.I18n.getString("level") + " ") + getLevel()) + " ") + com.midasplayer.util.I18n.getString("completed"));
m_infoScreen.setText("qualify_text", com.midasplayer.util.I18n.getString("qualified"));
setInfoFields();
}
m_infoScreen.update();
}
function updateGameOver() {
if (m_infoScreen == undefined) {
var _local4 = -171;
var _local3 = -163;
m_infoScreen = new com.midasplayer.bouncer.InfoScreen();
m_infoScreen.init(this, m_scopeRef, "mcGameoverWindow");
m_infoScreen.setExitState(STATE_END_GAME);
m_infoScreen.setExpireTime(10);
m_infoScreen.setExpireTime(10);
m_infoScreen.setExitDelay(1);
m_infoScreen.setSound(SOUND_GAME_OVER);
m_infoScreen.setPos((GUI_X + (com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT / 2)) + _local4, (MOVIE_HEIGHT / 2) + _local3);
var _local2 = "";
if (m_level < NUMBER_LEVELS) {
_local2 = com.midasplayer.util.I18n.getString("not_qualified");
} else if ((m_level == NUMBER_LEVELS) && (getSavedBears() >= QUALIFICATION[m_level - 1])) {
_local2 = "+" + LAST_LEVEL_BONUS;
m_infoScreen.getClip().qualify_text.align = "right";
}
m_infoScreen.setText("header", com.midasplayer.util.I18n.getString("game_over"));
m_infoScreen.setText("qualify_text", _local2);
m_infoScreen.setButtonText(com.midasplayer.util.I18n.getString("game_over"));
setInfoFields();
}
m_infoScreen.update();
}
function setInfoFields() {
m_infoScreen.setText("saved_text", com.midasplayer.util.I18n.getString("saved"));
m_infoScreen.setText("saved", m_saveCount + "");
m_infoScreen.setText("missed_text", com.midasplayer.util.I18n.getString("missed"));
m_infoScreen.setText("missed", m_killCount + "");
m_infoScreen.setText("result_text", com.midasplayer.util.I18n.getString("result"));
m_infoScreen.setText("result", (getSavedBears() + " / ") + QUALIFICATION[m_level - 1]);
m_infoScreen.setText("score_text", com.midasplayer.util.I18n.getString("score"));
m_infoScreen.setText("score", m_score + "");
m_infoScreen.setText("start", com.midasplayer.util.I18n.getString("start"));
}
function setupInput() {
Mouse.addListener(this);
Key.addListener(this);
}
function setBackground(level) {
var _local2;
if (m_level == 0) {
_local2 = "mcBackdrop02-blue-anim";
}
if (m_level == 1) {
_local2 = "mcBackdrop02-yellow-anim";
}
if (m_level == 2) {
_local2 = "mcBackdrop02-pink-anim";
}
if (m_level == NUMBER_LEVELS) {
_local2 = "mcBackdrop02-pink-anim";
}
trace("setBackground: " + _local2);
m_world.setBackground(_local2);
m_world.getBackground().getClip().onPress = mx.utils.Delegate.create(this, onBackgroundPress);
m_world.getBackground().getClip().useHandCursor = false;
}
function setupWorld() {
m_resetTick = true;
m_activeTrampoline = undefined;
m_trampolineArray.splice(0);
m_bearCount = 0;
m_bearIndex = 0;
m_saveCount = 0;
m_killCount = 0;
releaseReservedBearPos(0, com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT);
resetColorSaveCount();
resetPowerEnabled();
m_timeLeft = TIME_LIMIT[m_level];
m_numberBears = NUMBER_BEARS[m_level];
m_numberBumpers = NUMBER_BUMPERS[m_level];
updateGUI();
setBackground(m_level);
var _local5 = 10;
var _local7 = 200;
var _local6 = new com.midasplayer.bouncer.StaticPlane();
_local6.setPoint(com.midasplayer.bouncer.LineSegment.POINT_START, _local5, com.midasplayer.bouncer.World.WORLD_EDGE_TOP - 100);
_local6.setPoint(com.midasplayer.bouncer.LineSegment.POINT_END, _local5, com.midasplayer.bouncer.World.WORLD_EDGE_BOTTOM + _local7);
_local6.setBounceSound(SOUND_BOUNCE_WALL);
m_world.addWorldObject(_local6, COLLISION_LAYER);
_local6 = new com.midasplayer.bouncer.StaticPlane();
_local6.setPoint(com.midasplayer.bouncer.LineSegment.POINT_START, com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT - _local5, com.midasplayer.bouncer.World.WORLD_EDGE_BOTTOM + _local7);
_local6.setPoint(com.midasplayer.bouncer.LineSegment.POINT_END, com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT - _local5, com.midasplayer.bouncer.World.WORLD_EDGE_TOP - 100);
_local6.setBounceSound(SOUND_BOUNCE_WALL);
m_world.addWorldObject(_local6, COLLISION_LAYER);
_local6 = new com.midasplayer.bouncer.StaticPlane();
_local6.setPoint(com.midasplayer.bouncer.LineSegment.POINT_START, com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT, com.midasplayer.bouncer.World.WORLD_EDGE_TOP);
_local6.setPoint(com.midasplayer.bouncer.LineSegment.POINT_END, com.midasplayer.bouncer.World.WORLD_EDGE_LEFT, com.midasplayer.bouncer.World.WORLD_EDGE_TOP);
_local6.setDoubleSided(false);
_local6.setImpassable(false);
m_world.addWorldObject(_local6, COLLISION_LAYER);
_local6 = new com.midasplayer.bouncer.StaticPlane();
_local6.setPoint(com.midasplayer.bouncer.LineSegment.POINT_START, com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT, com.midasplayer.bouncer.World.WORLD_EDGE_TOP - 100);
_local6.setPoint(com.midasplayer.bouncer.LineSegment.POINT_END, com.midasplayer.bouncer.World.WORLD_EDGE_LEFT, com.midasplayer.bouncer.World.WORLD_EDGE_TOP - 100);
m_world.addWorldObject(_local6, COLLISION_LAYER);
var _local3 = 4 * m_level;
var _local4 = new com.midasplayer.bouncer.Door();
_local4.setX(0);
_local4.setY(DOOR_TOP_Y + Number(m_doorPosArray[_local3]));
_local4.setColor(Number(m_doorColorArray[_local3]));
m_world.addWorldObject(_local4, DOOR_LAYER);
_local3++;
_local4 = new com.midasplayer.bouncer.Door();
_local4.setX(com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT);
_local4.setY(DOOR_TOP_Y + Number(m_doorPosArray[_local3]));
_local4.setColor(Number(m_doorColorArray[_local3]));
_local4.setAlign(-1);
m_world.addWorldObject(_local4, DOOR_LAYER);
_local3++;
_local4 = new com.midasplayer.bouncer.Door();
_local4.setX(0);
_local4.setY(DOOR_BOTTOM_Y + Number(m_doorPosArray[_local3]));
_local4.setColor(Number(m_doorColorArray[_local3]));
m_world.addWorldObject(_local4, DOOR_LAYER);
_local3++;
_local4 = new com.midasplayer.bouncer.Door();
_local4.setX(com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT);
_local4.setY(DOOR_BOTTOM_Y + Number(m_doorPosArray[_local3]));
_local4.setColor(Number(m_doorColorArray[_local3]));
_local4.setAlign(-1);
m_world.addWorldObject(_local4, DOOR_LAYER);
_local3++;
m_whaleBillboard = new com.midasplayer.bouncer.Billboard();
m_whaleBillboard.setX(-300);
m_whaleBillboard.setVelX(3);
m_whaleBillboard.setPlaybackSpeed(0.5);
m_world.addWorldObject(m_whaleBillboard, BILLBOARD_LAYER, "mcKiller01");
m_oceanBillboard = new com.midasplayer.bouncer.Billboard();
m_oceanBillboard.setY(com.midasplayer.bouncer.World.WORLD_EDGE_BOTTOM - 30);
m_world.addWorldObject(m_oceanBillboard, BILLBOARD_LAYER, "mcOcean02");
var _local2 = 0;
while (_local2 < m_numberBumpers) {
addBumper();
_local2++;
}
com.midasplayer.fx.SoundManager.play(SOUND_LOOP, undefined, true);
}
function addBumper() {
var _local4 = Number(m_bumperPosArray[m_bumperIndex++]);
var _local3 = Number(m_bumperPosArray[m_bumperIndex++]);
var _local2 = new com.midasplayer.bouncer.Bumper();
_local2.setX(_local4);
_local2.setY(_local3);
m_world.addWorldObject(_local2, BEAR_LAYER);
}
function isBearPosReserved(fromX, toX) {
var _local2 = 0;
while (_local2 < m_bearPosReserveArray.length) {
if (m_bearPosReserveArray[_local2] == true) {
return(true);
}
_local2++;
}
return(false);
}
function reserveBearPos(fromX, toX) {
var _local2 = fromX;
while (_local2 <= toX) {
m_bearPosReserveArray[_local2] = true;
_local2++;
}
}
function releaseReservedBearPos(fromX, toX) {
var _local2 = fromX;
while (_local2 <= toX) {
m_bearPosReserveArray[_local2] = false;
_local2++;
}
}
function addBear(color, size) {
var _local3 = Number(m_bearPosArray[m_level][m_bearIndex]);
if (size == undefined) {
size = Number(m_bearSizeArray[m_level][m_bearIndex]);
}
if (color == undefined) {
color = Number(m_bearColorArray[m_level][m_bearIndex]);
}
var _local10 = com.midasplayer.bouncer.World.WORLD_EDGE_TOP;
var _local5 = ((size == com.midasplayer.bouncer.Bear.SIZE_BIG) ? (com.midasplayer.bouncer.Bear.BOUND_RADIUS_BIG) : (com.midasplayer.bouncer.Bear.BOUND_RADIUS_SMALL));
var _local7 = _local3 - _local5;
var _local6 = _local3 + _local5;
if (isBearPosReserved(_local7, _local6)) {
return(false);
}
reserveBearPos(_local7, _local6);
var _local2 = new com.midasplayer.bouncer.Bear();
_local2.setSize(size);
_local2.setColor(color);
_local2.setX(_local3);
_local2.setY(_local10 - _local2.getBoundRadius());
_local2.setReservedX(_local3);
var _local11 = com.midasplayer.util.Randomizer.randomRange(0, 1);
if (_local11 == 0) {
_local2.setScaleX(-100);
}
m_world.addWorldObject(_local2, BEAR_LAYER);
m_bearIndex++;
if (m_bearIndex >= m_bearPosArray[m_level].length) {
m_bearIndex = 0;
}
if (size != com.midasplayer.bouncer.Bear.SIZE_SANTA) {
m_bearCount++;
if (!PRACTICE_GAME) {
var _local9 = ("9," + getTick()) + " ,=0";
fscommand ("playData", _local9);
}
}
return(true);
}
function resetColorSaveCount() {
m_colorSaveCount[0] = 0;
m_colorSaveCount[1] = 0;
m_colorSaveCount[2] = 0;
m_colorSaveCount[3] = 0;
}
function resetPowerEnabled() {
var _local2 = 0;
while (_local2 < m_powerEnabledArray.length) {
m_powerEnabledArray[_local2] = 0;
_local2++;
}
}
function getLevel() {
return(m_level);
}
function getLevelMultiplier() {
var _local2 = 1;
if (m_level == 1) {
_local2 = 1.1;
} else if (m_level == 2) {
_local2 = 1.2;
}
return(_local2);
}
function onBounceTrampoline() {
m_score = m_score + (SCORE_TRAMPOLINE_BOUNCE * getLevelMultiplier());
}
function saveBear(bear, door) {
if (!bear.isPhysicsEnabled()) {
return(0);
}
bear.setPhysicsEnabled(false);
bear.setPerformCollision(false);
var _local2 = 0;
if (bear.getSize() == com.midasplayer.bouncer.Bear.SIZE_SMALL) {
_local2 = SCORE_BEAR_SMALL;
} else if (bear.getSize() == com.midasplayer.bouncer.Bear.SIZE_BIG) {
_local2 = SCORE_BEAR_BIG;
} else if (bear.getSize() == com.midasplayer.bouncer.Bear.SIZE_SANTA) {
_local2 = SCORE_BEAR_SANTA;
}
if (door.getColor() == bear.getColor()) {
var _local4 = bear.getColor();
var _local6 = m_colorSaveCount[_local4] * SCORE_COLOR_ADDITION;
m_colorSaveCount[_local4]++;
_local2 = _local2 + _local6;
}
_local2 = _local2 * getLevelMultiplier();
m_score = m_score + _local2;
m_saveCount++;
if (!PRACTICE_GAME) {
var _local5 = ((((((((("42," + getTick()) + " ") + bear.getX()) + " ") + bear.getY()) + " ") + _local2) + " ") + getScore()) + " ,=0";
fscommand ("playData", _local5);
trace("playData: " + _local5);
}
return(_local2);
}
function killBear(bear) {
m_killCount++;
removeBear(bear);
}
function removeBear(bear) {
if (bear.getSize() != com.midasplayer.bouncer.Bear.SIZE_SANTA) {
m_bearCount--;
}
m_world.removeWorldObject(bear);
}
function isPowerEnabled(power) {
return(m_powerEnabledArray[power] > 0);
}
function getPowerString(power) {
return(POWER_STRING_ARRAY[power]);
}
function enablePower(power) {
com.midasplayer.fx.SoundManager.play(SOUND_POWER_UP);
if (power == POWER_ICE) {
m_powerEnabledArray[power] = m_powerEnabledArray[power] + (POWER_ICE_DURATION * TICKS_PER_SECOND);
var _local2 = new com.midasplayer.bouncer.StaticPlane();
_local2.setClipSize(550);
_local2.setPoint(com.midasplayer.bouncer.LineSegment.POINT_START, com.midasplayer.bouncer.World.WORLD_EDGE_LEFT, com.midasplayer.bouncer.World.WORLD_EDGE_BOTTOM - 30);
_local2.setPoint(com.midasplayer.bouncer.LineSegment.POINT_END, com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT, com.midasplayer.bouncer.World.WORLD_EDGE_BOTTOM - 30);
_local2.setDoubleSided(false);
_local2.setImpassable(false);
_local2.setMinBounce(10);
_local2.setDestroyTick(getTickCount() + (POWER_ICE_DURATION * TICKS_PER_SECOND));
m_world.addWorldObject(_local2, COLLISION_LAYER, "mcBlocksIce");
} else if (power == POWER_EXTRA_BEAR) {
m_powerEnabledArray[power] = m_powerEnabledArray[power] + (POWER_EXTRA_BEAR_DURATION * TICKS_PER_SECOND);
} else if (power == POWER_SANTA) {
m_powerEnabledArray[power] = 60000 * TICKS_PER_SECOND;
}
}
function disablePower(power) {
m_powerEnabledArray[power] = 0;
}
function worldMouseX() {
return(_xmouse - m_world.getClip()._x);
}
function worldMouseY() {
return(_ymouse - m_world.getClip()._y);
}
function onBackgroundPress() {
if (m_gameState != STATE_RUNNING) {
return(undefined);
}
if (m_activeTrampoline == undefined) {
addClientInput(INPUT_PRESS, worldMouseX(), worldMouseY());
}
}
function onMouseUp() {
if (m_gameState != STATE_RUNNING) {
return(undefined);
}
if (m_activeTrampoline != undefined) {
addClientInput(INPUT_RELEASE, worldMouseX(), worldMouseY());
}
}
function onMouseMove() {
if (m_gameState != STATE_RUNNING) {
return(undefined);
}
if (m_activeTrampoline != undefined) {
addClientInput(INPUT_MOVE, worldMouseX(), worldMouseY());
}
}
function enableTrampoline() {
if (m_activeTrampoline != undefined) {
m_activeTrampoline.enable(true);
clearActiveTrampoline();
}
}
function moveTrampoline(x, y) {
if (m_activeTrampoline != undefined) {
m_activeTrampoline.setPoint(m_activeTrampolinePoint, x, y);
if (!PRACTICE_GAME) {
}
}
}
function addTrampoline(worldX, worldY) {
while (m_trampolineArray.length >= NUMBER_TRAMPOLINES) {
removeTrampoline(m_trampolineArray[0]);
}
if (m_activeTrampoline == undefined) {
var _local2 = new com.midasplayer.bouncer.Trampoline();
m_world.addWorldObject(_local2, TRAMPOLINE_LAYER);
_local2.setPoint(com.midasplayer.bouncer.LineSegment.POINT_START, worldX, worldY);
setActiveTrampoline(_local2, com.midasplayer.bouncer.LineSegment.POINT_END);
m_trampolineArray.push(m_activeTrampoline);
if (!PRACTICE_GAME) {
var _local3 = ((((("1," + getTickCount()) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(m_activeTrampoline.getStartPoint().x)) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(m_activeTrampoline.getStartPoint().y)) + " ,=0";
fscommand ("playData", _local3);
_local3 = ((((("1," + getTickCount()) + " ") + m_activeTrampoline.getStartPoint().x) + " ") + m_activeTrampoline.getStartPoint().y) + " ,=0";
trace("playData: " + _local3);
}
}
}
function setActiveTrampoline(trampoline, point) {
m_activeTrampoline = trampoline;
m_activeTrampolinePoint = point;
}
function getActiveTrampoline() {
return(m_activeTrampoline);
}
function clearActiveTrampoline() {
m_activeTrampoline = undefined;
}
function removeTrampoline(trampoline) {
var _local2 = 0;
while (_local2 < m_trampolineArray.length) {
if (m_trampolineArray[_local2] == trampoline) {
m_world.removeWorldObject(trampoline);
m_trampolineArray.splice(_local2, 1);
break;
}
_local2++;
}
}
function createOutline() {
var _local2 = m_scopeRef.createEmptyMovieClip("black_outline", m_scopeRef.getNextHighestDepth());
_local2.beginFill(0);
_local2.moveTo(-MOVIE_OUTLINE, -MOVIE_OUTLINE);
_local2.lineTo(MOVIE_WIDTH + MOVIE_OUTLINE, -MOVIE_OUTLINE);
_local2.lineTo(MOVIE_WIDTH + MOVIE_OUTLINE, 0);
_local2.lineTo(-MOVIE_OUTLINE, 0);
_local2.endFill();
_local2.beginFill(0);
_local2.moveTo(-MOVIE_OUTLINE, 0);
_local2.lineTo(0, 0);
_local2.lineTo(0, MOVIE_HEIGHT);
_local2.lineTo(-MOVIE_OUTLINE, MOVIE_HEIGHT);
_local2.endFill();
_local2.beginFill(0);
_local2.moveTo(MOVIE_WIDTH, 0);
_local2.lineTo(MOVIE_WIDTH + MOVIE_OUTLINE, 0);
_local2.lineTo(MOVIE_WIDTH + MOVIE_OUTLINE, MOVIE_HEIGHT);
_local2.lineTo(MOVIE_WIDTH, MOVIE_HEIGHT);
_local2.endFill();
_local2.beginFill(0);
_local2.moveTo(-MOVIE_OUTLINE, MOVIE_HEIGHT);
_local2.lineTo(MOVIE_WIDTH + MOVIE_OUTLINE, MOVIE_HEIGHT);
_local2.lineTo(MOVIE_WIDTH + MOVIE_OUTLINE, MOVIE_HEIGHT + MOVIE_OUTLINE);
_local2.lineTo(-MOVIE_OUTLINE, MOVIE_HEIGHT + MOVIE_OUTLINE);
_local2.endFill();
}
static var SERVER = false;
static var LOCAL_GAME = false;
static var PRACTICE_GAME = false;
static var DEV = false;
static var MOVIE_OUTLINE = 20;
static var MOVIE_WIDTH = 743;
static var MOVIE_HEIGHT = 570;
static var TIME_FACTOR = 1;
static var TICKS_PER_SECOND = 20;
static var TIME_PER_TICK = 1000 / (TICKS_PER_SECOND * TIME_FACTOR);
static var INPUT_PRESS = 1;
static var INPUT_RELEASE = 2;
static var INPUT_MOVE = 3;
static var STATE_NONE = -1;
static var STATE_INTRUCTIONS = 0;
static var STATE_START_GAME = 1;
static var STATE_SETUP = 2;
static var STATE_RUNNING = 3;
static var STATE_LEVEL_OVER = 4;
static var STATE_LEVEL_SUMMARY = 5;
static var STATE_GAME_OVER = 6;
static var STATE_GAME_SUMMARY = 7;
static var STATE_END_GAME = 8;
static var COLOR_NONE = -1;
static var COLOR_RED = 0;
static var COLOR_YELLOW = 1;
static var COLOR_BLUE = 2;
static var COLOR_GREEN = 3;
static var POWER_ICE = 0;
static var POWER_EXTRA_BEAR = 1;
static var POWER_SANTA = 2;
static var POWER_NUMBER = 3;
static var POWER_STRING_ARRAY = new Array("Ice", "ExtraBear", "Santa");
static var COLLISION_LAYER = 0;
static var BACKGROUND_LAYER = 1;
static var DOOR_LAYER = 2;
static var TRAMPOLINE_LAYER = 3;
static var BEAR_LAYER = 4;
static var BILLBOARD_LAYER = 5;
static var SOUND_INTRO = "intro";
static var SOUND_LOOP = "loop";
static var SOUND_ENABLE_TRAMPOLINE = "enable_trampoline";
static var SOUND_BOUNCE_TRAMPOLINE_LOW = "bounce_trampoline_low";
static var SOUND_BOUNCE_TRAMPOLINE_MID = "bounce_trampoline_mid";
static var SOUND_BOUNCE_TRAMPOLINE_HIGH = "bounce_trampoline_high";
static var SOUND_BOUNCE_TRAMPOLINE_ULTRA_HIGH = "bounce_trampoline_ultra_high";
static var SOUND_BOUNCE_WALL = "bounce_wall";
static var SOUND_BOUNCE_SPHERE = "bounce_wall";
static var SOUND_POWER_UP = "power_up";
static var SOUND_BEAR_THUMP = "bear_thump";
static var SOUND_BEAR_CRASH_SMALL = "bear_crash_small";
static var SOUND_BEAR_CRASH_BIG = "bear_crash_big";
static var SOUND_SPLASH_AND_EAT = "splash_and_eat";
static var SOUND_LEVEL_COMPLETE = "level_complete";
static var SOUND_GAME_OVER = "game_over";
static var GUI_X = 193;
var m_lastTickTime = -1;
var m_ipTime = 0;
var m_numberBumpers = 0;
var m_bumperIndex = 0;
var m_numberBears = 0;
var m_bearIndex = 0;
var m_bearCount = 0;
var m_score = 0;
var m_saveCount = 0;
var m_killCount = 0;
var m_level = 0;
var m_gameEnd = false;
var m_gameQuit = false;
}
Symbol 642 MovieClip [__Packages.com.midasplayer.util.GameDataAcquirer] Frame 0
class com.midasplayer.util.GameDataAcquirer
{
var attrib, multiplayerAttrib, trees, targetVar, dataEvent, timerFn, timer, error;
function GameDataAcquirer (variable) {
attrib = new com.midasplayer.util.Map();
multiplayerAttrib = new com.midasplayer.util.Map();
trees = new com.midasplayer.util.Map();
if (variable != undefined) {
targetVar = variable;
} else {
targetVar = "gameData";
}
}
function beginWait(fn) {
dataEvent = fn;
timerFn = function (caller) {
var _local1 = _level0[caller.targetVar];
if (((_local1 != undefined) && (_local1 != null)) && (_local1.length > 0)) {
caller.parse(_local1);
if (caller.dataEvent != undefined) {
caller.dataEvent();
}
caller.dataEvent = undefined;
clearInterval(caller.timer);
}
};
timer = setInterval(timerFn, 100, this);
}
function poll() {
if (!parsed) {
var _local2 = _level0[targetVar];
if (((_local2 != undefined) && (_local2 != null)) && (_local2.length > 0)) {
parse(_local2);
parsed = true;
return(true);
}
}
return(false);
}
function getAttributes() {
return(attrib);
}
function getSubTrees(name) {
return(trees.get(name));
}
function getGameData(name) {
return(attrib.get(name));
}
function getMultiplayerData(name) {
return(multiplayerAttrib.get(name));
}
function parse(data) {
attrib.clear();
var _local7 = new com.midasplayer.util.Map();
var _local9 = new XML();
_local9.ignoreWhite = true;
_local9.parseXML(data);
var _local4 = _local9.firstChild;
if (_local4.nodeName != "gamedata") {
error = "Bad XML (expected <gamedata>)";
return(undefined);
}
for (var _local8 in _local4.attributes) {
var _local5;
var _local3 = _local4.attributes[_local8];
if ((_local3.indexOf("[") == 0) && ((_local5 = _local3.indexOf("]")) != -1)) {
_local3 = _local3.substring(1, _local5).split(",");
}
attrib.put(_local8, _local3);
}
for (var _local8 in _local4.childNodes) {
var _local2 = _local4.childNodes[_local8];
switch (_local2.nodeName) {
case "text" :
_local7.put(_local2.attributes.id, _local2.firstChild.nodeValue);
break;
case "multiplayer" :
for (var _local8 in _local2.attributes) {
multiplayerAttrib.put(_local8, _local2.attributes[_local8]);
}
break;
default :
var _local6;
_local6 = trees.get(_local2.nodeName);
if (_local6 == undefined) {
trees.put(_local2.nodeName, [_local2]);
} else {
_local6.push(_local2);
}
}
}
trace("parse(): completed");
com.midasplayer.util.I18n.init(_local7);
}
var parsed = false;
}
Symbol 643 MovieClip [__Packages.com.midasplayer.util.Map] Frame 0
class com.midasplayer.util.Map
{
var map, lastSize;
function Map (init) {
map = new Object();
for (var _local3 in init) {
map["@" + _local3] = init[_local3];
}
lastSize = -1;
}
function put(key, value) {
map["@" + key] = value;
lastSize = -1;
}
function get(key) {
return(map["@" + key]);
}
function remove(key) {
var _local2 = map["@" + key];
delete map["@" + key];
lastSize = -1;
return(_local2);
}
function count() {
if (lastSize < 0) {
lastSize = 0;
for (var _local2 in map) {
lastSize++;
}
}
return(lastSize);
}
function size() {
return(count());
}
function clear() {
map = {};
lastSize = 0;
}
function dump() {
var _local2 = "";
for (var _local3 in map) {
_local2 = _local2 + (((_local3 + "=>") + map[_local3]) + newline);
}
trace(_local2);
}
function toArray() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = map[_local3];
}
return(_local2);
}
function keySet() {
var _local2 = [];
for (var _local3 in map) {
_local2[_local2.length] = _local3.substring(1);
}
return(_local2);
}
function foreach(fn) {
do {
if ((in map) == null) {
break;
}
var _local3 = in map;
} while (fn(_local3.substring(1), map[_local3]) != false);
do {
} while ("foreach" != null);
lastSize = -1;
}
}
Symbol 644 MovieClip [__Packages.com.midasplayer.util.I18n] Frame 0
class com.midasplayer.util.I18n
{
static var lang;
function I18n () {
}
static function init(newLang) {
lang = newLang;
}
static function getString(name) {
var _local1 = lang.get(name);
if (_local1 == undefined) {
return(("{" + name) + "}");
}
return(_local1.toString());
}
}
Symbol 645 MovieClip [__Packages.com.midasplayer.bouncer.World] Frame 0
class com.midasplayer.bouncer.World
{
var m_scopeRef, m_game, m_clip, m_layers, m_worldObjects, m_worldObjectRemove, m_background;
function World (scope, game) {
m_scopeRef = scope;
m_game = game;
m_clip = m_scopeRef.createEmptyMovieClip("world", m_scopeRef.getNextHighestDepth());
m_layers = new Array();
m_worldObjects = new Array();
m_worldObjectRemove = new Array();
m_background = new com.midasplayer.bouncer.Billboard();
addWorldObjectHelper(m_background, 0, "");
m_background.setPlaybackSpeed(BACKGROUND_PLAYBACK_SPEED);
}
function getGame() {
return(m_game);
}
function getClip() {
return(m_clip);
}
function getBackground() {
return(m_background);
}
function setBackground(symbol) {
m_background.setClip(0, symbol, "background");
}
function render(ipTime) {
m_background.renderClip(ipTime);
var _local2 = 0;
while (_local2 < m_worldObjects.length) {
m_worldObjects[_local2].renderClip(ipTime);
_local2++;
}
}
function update() {
var _local4 = m_worldObjects.length;
m_background.updatePhysics();
var _local2 = 0;
while (_local2 < _local4) {
m_worldObjects[_local2].updatePhysics();
_local2++;
}
m_background.update();
_local2 = 0;
while (_local2 < _local4) {
m_worldObjects[_local2].update();
_local2++;
}
var _local3 = 0;
while (_local3 < m_worldObjectRemove.length) {
_local2 = 0;
while (_local2 < m_worldObjects.length) {
if (m_worldObjects[_local2].getObjId() == m_worldObjectRemove[_local3]) {
m_worldObjects[_local2].getClip().removeMovieClip();
m_worldObjects[_local2].onRemovedFromWorld();
m_worldObjects.splice(_local2, 1);
break;
}
_local2++;
}
_local3++;
}
if (m_worldObjectRemove.length > 0) {
m_worldObjectRemove.splice(0);
}
}
function getLayer(layer) {
if (m_layers.length <= layer) {
var _local2 = m_layers.length;
while (_local2 <= layer) {
addLayer();
_local2++;
}
}
return(m_layers[layer]);
}
function addLayer() {
m_layers.push(getClip().createEmptyMovieClip("layer_" + m_layers.length, getClip().getNextHighestDepth()));
return(m_layers.length);
}
function addWorldObject(obj, worldLayer, symbol, clipName) {
var _local3 = m_worldObjectIdCounter;
m_worldObjectIdCounter++;
obj.setObjId(_local3);
m_worldObjects.push(obj);
addWorldObjectHelper(obj, worldLayer, symbol, clipName);
return(obj.getObjId());
}
function addWorldObjectHelper(obj, worldLayer, symbol, clipName) {
obj.setGame(m_game);
obj.setWorld(this);
obj.setClip(worldLayer, symbol, clipName);
obj.onAddedToWorld();
}
function clearWorldObjects() {
var _local2 = 0;
while (_local2 < m_worldObjects.length) {
m_worldObjects[_local2].getClip().removeMovieClip();
_local2++;
}
m_worldObjects.splice(0);
}
function removeWorldObject(obj) {
m_worldObjectRemove.push(obj.getObjId());
}
function getAllWorldObjects() {
return(m_worldObjects);
}
function getWorldObject(objId) {
var _local2 = 0;
while (_local2 < m_worldObjects.length) {
var _local3 = m_worldObjects[_local2];
if (_local3.getObjId() == objId) {
return(m_worldObjects[_local2]);
}
_local2++;
}
return(undefined);
}
static var WORLD_EDGE_TOP = -70;
static var WORLD_EDGE_BOTTOM = 550;
static var WORLD_EDGE_LEFT = 0;
static var WORLD_EDGE_RIGHT = 550;
static var BACKGROUND_PLAYBACK_SPEED = 0.4;
var m_worldObjectIdCounter = 0;
}
Symbol 646 MovieClip [__Packages.com.midasplayer.bouncer.WorldObject] Frame 0
class com.midasplayer.bouncer.WorldObject
{
var m_animFrame, m_posX, m_posY, m_rotation, m_scaleX, m_scaleY, m_alpha, m_clip, m_game, m_world, m_parent;
function WorldObject () {
m_animFrame = new com.midasplayer.bouncer.InterpolationValue(0);
m_posX = new com.midasplayer.bouncer.InterpolationValue();
m_posY = new com.midasplayer.bouncer.InterpolationValue();
m_rotation = new com.midasplayer.bouncer.InterpolationValue();
m_scaleX = new com.midasplayer.bouncer.InterpolationValue(100);
m_scaleY = new com.midasplayer.bouncer.InterpolationValue(100);
m_alpha = new com.midasplayer.bouncer.InterpolationValue(100);
}
function getClip() {
return(m_clip);
}
function setObjId(id) {
m_id = id;
}
function getObjId() {
return(m_id);
}
function setGame(game) {
m_game = game;
}
function getGame() {
return(m_game);
}
function setWorld(world) {
m_world = world;
}
function getWorld() {
return(m_world);
}
function setPerformCollision(collision) {
m_performCollision = collision;
}
function getPerformCollision() {
return(m_performCollision);
}
function setPhysicsEnabled(physics) {
m_physicsEnabled = physics;
}
function isPhysicsEnabled() {
return(m_physicsEnabled);
}
function setAnimated(animated) {
m_animated = animated;
}
function setPlaybackSpeed(speed) {
m_playbackSpeed = speed;
}
function getPlaybackSpeed() {
return(m_playbackSpeed);
}
function getFrame(ipTime) {
return(m_animFrame.getValue(ipTime));
}
function setParent(parent) {
m_parent = parent;
}
function getParent() {
return(m_parent);
}
function setX(x) {
m_posX.setValue(x);
}
function setY(y) {
m_posY.setValue(y);
}
function setPos(x, y) {
setX(x);
setY(y);
}
function setPrevX(x) {
m_posX.setPrevValue(x);
}
function setPrevY(y) {
m_posY.setPrevValue(y);
}
function setNextX(x) {
m_posX.setNextValue(x);
}
function setNextY(y) {
m_posY.setNextValue(y);
}
function setVelX(vel) {
m_posVelocityX = vel;
}
function setVelY(vel) {
m_posVelocityY = vel;
}
function setVel(vel) {
m_posVelocityX = vel.x;
m_posVelocityY = vel.y;
}
function addVelX(vel) {
m_posVelocityX = m_posVelocityX + vel;
}
function addVelY(vel) {
m_posVelocityY = m_posVelocityY + vel;
}
function setGravity(vel) {
m_gravity = vel;
}
function setRotation(rot) {
m_rotation.setValue(rot);
}
function setRotationVel(vel) {
m_rotationVelocity = vel;
}
function setScaleX(scale) {
m_scaleX.setValue(scale);
}
function setScaleXVel(vel) {
m_scaleXVelocity = vel;
}
function setScaleY(scale) {
m_scaleY.setValue(scale);
}
function setScaleYVel(vel) {
m_scaleYVelocity = vel;
}
function setAlpha(alpha) {
m_alpha.setValue(alpha);
}
function setAlphaVel(vel) {
m_alphaVelocity = vel;
}
function getX(ipTime) {
return(m_posX.getValue(ipTime));
}
function getY(ipTime) {
return(m_posY.getValue(ipTime));
}
function getPos(ipTime) {
return(new com.midasplayer.MathUtil.Vec2D(m_posX.getValue(ipTime), m_posY.getValue(ipTime)));
}
function getVelX() {
return(m_posVelocityX);
}
function getVelY() {
return(m_posVelocityY);
}
function getVel() {
return(new com.midasplayer.MathUtil.Vec2D(m_posVelocityX, m_posVelocityY));
}
function getGravity() {
return(m_gravity);
}
function getRotation(ipTime) {
return(m_rotation.getValue(ipTime));
}
function getRotationVel() {
return(m_rotationVelocity);
}
function getScaleX(ipTime) {
return(m_scaleX.getValue(ipTime));
}
function getScaleXVel() {
return(m_scaleXVelocity);
}
function getScaleY(ipTime) {
return(m_scaleY.getValue(ipTime));
}
function getScaleYVel() {
return(m_scaleYVelocity);
}
function getAlpha(ipTime) {
return(m_alpha.getValue(ipTime));
}
function getAlphaVel() {
return(m_alphaVelocity);
}
function setDestroyTick(tick) {
m_destroyTick = tick;
}
function getDestroyTick() {
return(m_destroyTick);
}
function setClip(worldLayer, symbol, clipName) {
if (worldLayer != undefined) {
m_worldLayer = worldLayer;
}
if (symbol == undefined) {
symbol = DEFAULT_SYMBOL;
}
if ((clipName == undefined) || (clipName == null)) {
clipName = (symbol + "_") + getObjId();
}
var _local4 = m_world.getLayer(m_worldLayer);
var _local3 = _local4.getNextHighestDepth();
if (m_clip != undefined) {
_local3 = m_clip.getDepth();
m_clip.removeMovieClip();
}
m_clip = _local4.attachMovie(symbol, clipName, _local3);
if (m_clip == undefined) {
trace(((((("Falied to attach clip: " + symbol) + " for objId: ") + getObjId()) + " Symbol: '") + symbol) + "'");
}
m_animFrame.setValue(0);
if (m_animated) {
m_clip.stop();
}
onClipLoaded();
renderClip(0);
}
function onClipLoaded() {
}
function onAddedToWorld() {
}
function onRemovedFromWorld() {
}
function updatePhysics() {
if (m_performCollision) {
var _local6 = m_world.getAllWorldObjects();
var _local9 = new com.midasplayer.bouncer.CollisionData();
var _local7 = 0;
while (_local7 < 10) {
var _local2 = new com.midasplayer.bouncer.CollisionData();
var _local5 = 0;
while (_local5 < _local6.length) {
var _local4 = _local6[_local5];
if (!isPhysicsEnabled()) {
return(undefined);
}
if (!_local4.isPhysicsEnabled()) {
} else if (_local4.getObjId() == getObjId()) {
} else {
var _local3 = com.midasplayer.bouncer.CollisionManager.testCollision(this, _local4);
if (_local3.collisionOccured() && ((_local3.getStartTime() < _local2.getStartTime()) || (!_local2.collisionOccured()))) {
_local2 = _local3;
}
}
_local5++;
}
if (_local2.collisionOccured() && (_local9.getObjId() != _local2.getObjId())) {
var _local8 = m_world.getWorldObject(_local2.getObjId());
com.midasplayer.bouncer.CollisionManager.handleCollision(this, _local8, _local2);
_local9 = _local2;
if (_local2.getStartTime() == NaN) {
trace("-- coltime NaN");
}
} else {
break;
}
_local7++;
}
}
}
function update() {
if ((m_destroyTick != -1) && (m_game.getTickCount() >= m_destroyTick)) {
m_world.removeWorldObject(this);
}
m_posX.updateValue(m_posX.getNextValue() + m_posVelocityX);
m_posY.updateValue(m_posY.getNextValue() + m_posVelocityY);
if (isPhysicsEnabled()) {
m_posVelocityY = m_posVelocityY + m_gravity;
}
m_rotation.updateValue(m_rotation.getNextValue() + m_rotationVelocity);
m_alpha.updateValue(m_alpha.getNextValue() + m_alphaVelocity);
m_scaleX.updateValue(m_scaleX.getNextValue() + m_scaleXVelocity);
m_scaleY.updateValue(m_scaleY.getNextValue() + m_scaleYVelocity);
if (m_animated) {
var _local2 = m_animFrame.getNextValue() + m_playbackSpeed;
m_animFrame.updateValue(_local2);
}
}
function renderClip(ipTime) {
if (getClip() == undefined) {
return(undefined);
}
m_clip._x = getX(ipTime);
if (getParent() != undefined) {
m_clip._x = m_clip._x + getParent().getX(ipTime);
}
m_clip._y = getY(ipTime);
if (getParent() != undefined) {
m_clip._y = m_clip._y + getParent().getY(ipTime);
}
m_clip._rotation = getRotation(ipTime);
m_clip._xscale = getScaleX(ipTime);
m_clip._yscale = getScaleY(ipTime);
m_clip._alpha = getAlpha(ipTime);
if (m_animated) {
var _local3 = Math.floor(getFrame(ipTime));
_local3 = (_local3 % getClip()._framesloaded) + 1;
m_clip.gotoAndStop(_local3);
}
if (m_clip._y == undefined) {
trace("error! Objid: " + getObjId());
}
}
var DEFAULT_SYMBOL = "ball";
var m_id = -1;
var m_worldLayer = 0;
var m_performCollision = false;
var m_physicsEnabled = true;
var m_animated = false;
var m_playbackSpeed = 0.2;
var m_posVelocityX = 0;
var m_posVelocityY = 0;
var m_gravity = 0;
var m_rotationVelocity = 0;
var m_scaleXVelocity = 0;
var m_scaleYVelocity = 0;
var m_alphaVelocity = 0;
var m_destroyTick = -1;
}
Symbol 647 MovieClip [__Packages.com.midasplayer.bouncer.InterpolationValue] Frame 0
class com.midasplayer.bouncer.InterpolationValue
{
function InterpolationValue (startValue) {
if (startValue != undefined) {
setValue(startValue);
}
}
function getPrevValue() {
return(m_prevValue);
}
function getNextValue() {
return(m_nextValue);
}
function setValue(valueParam) {
setPrevValue(valueParam);
setNextValue(valueParam);
}
function setPrevValue(valueParam) {
m_prevValue = valueParam;
}
function setNextValue(valueParam) {
m_nextValue = valueParam;
}
function setWaypointValue(valueParam, IPparam) {
m_waypointValue = valueParam;
m_waypointIP = IPparam;
}
function clearWaypoint() {
m_waypointIP = -1;
}
function updateValue(valueParam) {
setPrevValue(getNextValue());
setNextValue(valueParam);
}
function getValue(ipTime) {
if (((ipTime == undefined) || (ipTime == 1)) || (m_prevValue == m_nextValue)) {
return(m_nextValue);
}
if (ipTime == 0) {
return(m_prevValue);
}
if ((m_waypointIP > 0) && (m_waypointIP < 1)) {
if (ipTime == m_waypointIP) {
return(m_waypointValue);
}
if (ipTime < m_waypointIP) {
return(m_prevValue + ((m_waypointValue - m_prevValue) * (ipTime / m_waypointIP)));
}
if (ipTime > m_waypointIP) {
return(m_waypointValue + (((m_nextValue - m_waypointValue) * (ipTime - m_waypointIP)) / (1 - m_waypointIP)));
}
}
return(m_prevValue + ((m_nextValue - m_prevValue) * ipTime));
}
var m_prevValue = 0;
var m_nextValue = 0;
var m_waypointValue = 0;
var m_waypointIP = -1;
}
Symbol 648 MovieClip [__Packages.com.midasplayer.MathUtil.Vec2D] Frame 0
class com.midasplayer.MathUtil.Vec2D
{
function Vec2D (x, y) {
if (x != undefined) {
this.x = x;
}
if (y != undefined) {
this.y = y;
}
}
function toString() {
return(((("<" + x) + ", ") + y) + ">");
}
function addition(vec) {
return(new com.midasplayer.MathUtil.Vec2D(x + vec.x, y + vec.y));
}
function subtract(vec) {
return(new com.midasplayer.MathUtil.Vec2D(x - vec.x, y - vec.y));
}
function multiply(scalar) {
return(new com.midasplayer.MathUtil.Vec2D(x * scalar, y * scalar));
}
function divide(scalar) {
return(new com.midasplayer.MathUtil.Vec2D(x / scalar, y / scalar));
}
function normalize() {
return(divide(length()));
}
function length() {
return(Math.sqrt(lengthSqr()));
}
function lengthSqr() {
return(Math.pow(x, 2) + Math.pow(y, 2));
}
function dot(vec) {
return((x * vec.x) + (y * vec.y));
}
function project(vec) {
var _local4 = dot(vec);
var _local3 = new com.midasplayer.MathUtil.Vec2D();
_local3.x = (_local4 / ((vec.x * vec.x) + (vec.y * vec.y))) * vec.x;
_local3.y = (_local4 / ((vec.x * vec.x) + (vec.y * vec.y))) * vec.y;
return(_local3);
}
var x = 0;
var y = 0;
}
Symbol 649 MovieClip [__Packages.com.midasplayer.bouncer.CollisionData] Frame 0
class com.midasplayer.bouncer.CollisionData
{
function CollisionData () {
}
function collisionOccured() {
return(m_collisionOccured);
}
function setCollision(col) {
m_collisionOccured = col;
return(this);
}
function setCollisionObj(obj) {
m_collisionOccured = true;
m_objId = obj.getObjId();
return(this);
}
function setObjId(id) {
m_objId = id;
}
function setStartTime(time) {
m_startTimeFraction = time;
}
function setEndTime(time) {
m_endTimeFraction = time;
}
function setData(data) {
m_data = data;
}
function getObjId() {
return(m_objId);
}
function getStartTime() {
return(m_startTimeFraction);
}
function getEndTime() {
return(m_endTimeFraction);
}
function getData() {
return(m_data);
}
var m_collisionOccured = false;
var m_objId = -1;
var m_startTimeFraction = 0;
var m_endTimeFraction = 1;
var m_data = 0;
}
Symbol 650 MovieClip [__Packages.com.midasplayer.bouncer.CollisionManager] Frame 0
class com.midasplayer.bouncer.CollisionManager
{
function CollisionManager () {
}
static function testCollision(obj1, obj2) {
var _local3 = 0;
var _local2 = 0;
var _local1 = new com.midasplayer.bouncer.CollisionData();
if ((obj1 instanceof com.midasplayer.bouncer.Sphere) && (obj2 instanceof com.midasplayer.bouncer.Box)) {
var _local4 = com.midasplayer.bouncer.Sphere(obj1);
var _local7 = com.midasplayer.bouncer.Box(obj2);
var _local8 = (new com.midasplayer.MathUtil.Vec2D(_local4.getX(), _local4.getY())).addition(_local4.getVel());
var _local22 = _local4.getBoundRadius();
var _local5 = 0;
var _local31 = 0;
if (_local8.x < _local7.getEdge(com.midasplayer.bouncer.Box.EDGE_LEFT)) {
_local5 = _local8.x - _local7.getEdge(com.midasplayer.bouncer.Box.EDGE_LEFT);
_local31 = _local31 + (_local5 * _local5);
} else if (_local8.x > _local7.getEdge(com.midasplayer.bouncer.Box.EDGE_RIGHT)) {
_local5 = _local8.x - _local7.getEdge(com.midasplayer.bouncer.Box.EDGE_RIGHT);
_local31 = _local31 + (_local5 * _local5);
}
if (_local8.y < _local7.getEdge(com.midasplayer.bouncer.Box.EDGE_TOP)) {
_local5 = _local8.y - _local7.getEdge(com.midasplayer.bouncer.Box.EDGE_TOP);
_local31 = _local31 + (_local5 * _local5);
} else if (_local8.y > _local7.getEdge(com.midasplayer.bouncer.Box.EDGE_BOTTOM)) {
_local5 = _local8.y - _local7.getEdge(com.midasplayer.bouncer.Box.EDGE_BOTTOM);
_local31 = _local31 + (_local5 * _local5);
}
if (_local31 <= (_local22 * _local22)) {
if (_local31 <= (_local22 * _local22)) {
if ((obj1 instanceof com.midasplayer.bouncer.Bear) && (obj2 instanceof com.midasplayer.bouncer.Box)) {
var _local46 = com.midasplayer.bouncer.Bear(obj1);
_local7.bearCollision(_local46, _local1);
}
}
}
return(_local1);
}
if ((obj1 instanceof com.midasplayer.bouncer.Sphere) && (obj2 instanceof com.midasplayer.bouncer.Sphere)) {
var _local24 = com.midasplayer.bouncer.Sphere(obj1);
var _local15 = com.midasplayer.bouncer.Sphere(obj2);
var _local45 = _local24.getVel();
var _local42 = _local15.getVel();
var _local41 = new com.midasplayer.MathUtil.Vec2D(_local24.getX(), _local24.getY());
var _local40 = new com.midasplayer.MathUtil.Vec2D(_local15.getX(), _local15.getY());
var _local19 = _local40.subtract(_local41);
var _local18 = _local42.subtract(_local45);
var _local25 = _local24.getBoundRadius() + _local15.getBoundRadius();
if (_local19.dot(_local19) <= (_local25 * _local25)) {
_local1.setStartTime(0);
_local1.setEndTime(0);
return(_local1.setCollisionObj(_local15));
}
if ((_local18.x == 0) && (_local18.y == 0)) {
return(_local1);
}
var _local33 = _local18.dot(_local18);
var _local21 = 2 * _local18.dot(_local19);
var _local39 = _local19.dot(_local19) - (_local25 * _local25);
var _local35 = (_local21 * _local21) - ((4 * _local33) * _local39);
if (_local35 >= 0) {
var _local30 = Math.sqrt(_local35);
var _local31 = 1 / (2 * _local33);
_local3 = ((-_local21) + _local30) * _local31;
_local2 = ((-_local21) - _local30) * _local31;
if (_local3 > _local2) {
var _local38 = _local3;
_local3 = _local2;
_local2 = _local38;
}
if ((_local3 > 1) || (_local2 < 0)) {
return(_local1.setCollision(false));
}
if (_local3 < 0) {
_local3 = 0;
}
if (_local2 > 1) {
_local2 = 1;
}
_local1.setStartTime(_local3);
_local1.setEndTime(_local2);
return(_local1.setCollisionObj(_local15));
}
return(_local1);
}
if (((obj1 instanceof com.midasplayer.bouncer.Sphere) && (obj2 instanceof com.midasplayer.bouncer.LineSegment)) || ((obj1 instanceof com.midasplayer.bouncer.LineSegment) && (obj2 instanceof com.midasplayer.bouncer.Sphere))) {
var _local4 = com.midasplayer.bouncer.Sphere(((obj1 instanceof com.midasplayer.bouncer.Sphere) ? (obj1) : (obj2)));
var _local12 = com.midasplayer.bouncer.LineSegment(((obj1 instanceof com.midasplayer.bouncer.LineSegment) ? (obj1) : (obj2)));
if (!_local4.isPhysicsEnabled()) {
return(_local1);
}
var _local14 = _local4.getBoundRadius();
var _local32 = new com.midasplayer.MathUtil.Vec2D(_local4.getVelX(), _local4.getVelY());
var _local16 = _local12.getNormal();
var _local29 = _local32.dot(_local16);
var _local34 = _local12.getStartPoint();
var _local43 = _local12.getEndPoint();
var _local44 = new com.midasplayer.MathUtil.Vec2D(_local4.getX(), _local4.getY());
var _local36 = _local44.subtract(_local34);
var _local9 = _local36.dot(_local16);
if (_local29 == 0) {
if (Math.abs(_local9) > _local14) {
return(_local1);
}
_local3 = 0;
_local2 = 1;
} else {
_local3 = (_local14 - _local9) / _local29;
_local2 = ((-_local14) - _local9) / _local29;
if (_local3 > _local2) {
var _local38 = _local3;
_local3 = _local2;
_local2 = _local38;
}
if ((_local3 > 1) || (_local2 < 0)) {
return(_local1);
}
if (_local3 < 0) {
_local3 = 0;
}
if (_local2 > 1) {
_local2 = 1;
}
}
var _local17 = _local43.subtract(_local34);
var _local28 = _local17.length();
_local17 = _local17.divide(_local28);
var _local27 = _local32.dot(_local17);
_local9 = _local36.dot(_local17);
var _local11;
var _local10;
if (_local27 == 0) {
if ((_local9 < (-_local14)) || (_local9 > (_local28 + _local14))) {
return(_local1);
}
_local11 = 0;
_local10 = 1;
} else {
_local11 = ((_local14 + _local28) - _local9) / _local27;
_local10 = ((-_local14) - _local9) / _local27;
if (_local11 > _local10) {
var _local38 = _local11;
_local11 = _local10;
_local10 = _local38;
}
if ((_local11 > 1) || (_local10 < 0)) {
return(_local1);
}
if (_local11 < 0) {
_local11 = 0;
}
if (_local10 > 1) {
_local10 = 1;
}
_local3 = Math.max(_local3, _local11);
_local2 = Math.max(_local2, _local10);
}
var _local20 = _local12.getStartPoint();
var _local26 = new com.midasplayer.MathUtil.Vec2D(_local20.x - _local4.getX(), _local20.y - _local4.getY());
var _local23 = _local26.dot(_local16);
if (_local23 > 0) {
if (!_local12.isDoubleSided()) {
return(_local1);
}
}
if (Math.abs(_local23) < _local4.getBoundRadius()) {
if (_local12.isImpassable()) {
var _local47 = Math.abs(_local23) - _local4.getBoundRadius();
var _local37 = _local16.multiply(-_local47);
_local4.setNextX(_local4.getX() + _local37.x);
_local4.setNextY(_local4.getY() + _local37.y);
_local26 = new com.midasplayer.MathUtil.Vec2D(_local20.x - _local4.getX(), _local20.y - _local4.getY());
_local23 = _local26.dot(_local16);
} else {
return(_local1);
}
}
_local1.setStartTime(_local3);
_local1.setEndTime(_local2);
return(_local1.setCollisionObj(_local12));
}
return(_local1);
}
static function handleCollision(obj1, obj2, colData) {
if ((obj1 instanceof com.midasplayer.bouncer.Sphere) && (obj2 instanceof com.midasplayer.bouncer.Sphere)) {
var _local3 = com.midasplayer.bouncer.Sphere(obj1);
var _local4 = com.midasplayer.bouncer.Sphere(obj2);
var _local22 = new com.midasplayer.MathUtil.Vec2D(_local3.getX(), _local3.getY());
var _local21 = new com.midasplayer.MathUtil.Vec2D(_local4.getX(), _local4.getY());
var _local28 = _local3.getVel();
var _local26 = _local4.getVel();
var _local8 = _local22.subtract(_local21);
var _local18 = _local8.length();
_local8 = _local8.divide(_local18);
var _local27 = _local3.getBoundRadius() + _local4.getBoundRadius();
var _local20 = _local3.getMass() + _local4.getMass();
if (_local18 <= _local27) {
var _local17 = (_local27 - _local18) + 0.1;
var _local16 = _local3.getMass() / _local20;
_local3.setX(_local3.getX() + ((_local8.x * _local16) * _local17));
_local3.setY(_local3.getY() + ((_local8.y * _local16) * _local17));
_local16 = _local4.getMass() / _local20;
_local4.setX(_local4.getX() + ((_local8.x * (-_local16)) * _local17));
_local4.setY(_local4.getY() + ((_local8.y * (-_local16)) * _local17));
_local22 = new com.midasplayer.MathUtil.Vec2D(_local3.getX(), _local3.getY());
_local21 = new com.midasplayer.MathUtil.Vec2D(_local4.getX(), _local4.getY());
_local8 = _local22.subtract(_local21);
_local8 = _local8.divide(_local18);
}
var _local33 = _local28.dot(_local8);
var _local32 = _local26.dot(_local8);
var _local23 = (2 * (_local33 - _local32)) / _local20;
var _local19 = _local8.multiply(_local23 * _local4.getMass());
_local19 = _local19.multiply(-1);
var _local12 = _local28.addition(_local19);
var _local31 = _local8.multiply(_local23 * _local3.getMass());
var _local10 = _local26.addition(_local31);
var _local24 = new com.midasplayer.MathUtil.Vec2D(-_local8.y, _local8.x);
var _local14 = _local12.dot(_local24);
var _local11 = _local10.dot(_local24);
var _local9 = Math.abs(_local14 - _local11) / 2;
var _local2 = 0;
while (_local2 < 2) {
var _local29 = _local3;
var _local1 = _local12;
var _local7 = _local9;
var _local5 = _local14;
if (_local2 == 1) {
_local29 = _local4;
_local1 = _local10;
_local7 = _local9;
_local5 = -_local11;
}
var _local6 = _local7 / (Math.PI * (_local29.getBoundRadius() + _local29.getBoundRadius()));
if (_local5 < 0) {
_local6 = _local6 * -1;
}
_local29.setVelX(_local1.x);
_local29.setVelY(_local1.y);
_local29.setRotationVel((_local6 * 360) * 0.8);
_local2++;
}
if (!com.midasplayer.bouncer.Game.PRACTICE_GAME) {
var _local25 = ((((((((((((((((("888," + _local3.getGame().getTickCount()) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(_local3.getX())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(_local3.getY())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(_local3.getVelX())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(_local3.getVelY())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(_local4.getX())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(_local4.getY())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(_local4.getVelX())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(_local4.getVelY())) + " ,=0";
fscommand ("playData", _local25);
trace("playData: " + _local25);
}
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_BOUNCE_SPHERE);
return(undefined);
}
if (((obj1 instanceof com.midasplayer.bouncer.Sphere) && (obj2 instanceof com.midasplayer.bouncer.LineSegment)) || ((obj1 instanceof com.midasplayer.bouncer.LineSegment) && (obj2 instanceof com.midasplayer.bouncer.Sphere))) {
var _local29 = com.midasplayer.bouncer.Sphere(((obj1 instanceof com.midasplayer.bouncer.Sphere) ? (obj1) : (obj2)));
var _local30 = com.midasplayer.bouncer.LineSegment(((obj1 instanceof com.midasplayer.bouncer.LineSegment) ? (obj1) : (obj2)));
_local30.bounceSphere(_local29, colData);
}
if ((obj1 instanceof com.midasplayer.bouncer.Bear) && (obj2 instanceof com.midasplayer.bouncer.Box)) {
}
}
}
Symbol 651 MovieClip [__Packages.com.midasplayer.bouncer.Sphere] Frame 0
class com.midasplayer.bouncer.Sphere extends com.midasplayer.bouncer.WorldObject
{
var m_animated;
function Sphere () {
super();
m_animated = true;
}
function setBoundRadius(radius) {
m_boundRadius = radius;
}
function setElasticity(elasticity) {
m_elasticity = elasticity;
}
function setMass(mass) {
m_mass = mass;
}
function getBoundRadius() {
return(m_boundRadius);
}
function getElasticity() {
return(m_elasticity);
}
function getMass() {
return(m_mass);
}
var DEFAULT_SYMBOL = "sphere";
var m_boundRadius = 20;
var m_elasticity = 0.9;
var m_mass = 1;
}
Symbol 652 MovieClip [__Packages.com.midasplayer.bouncer.Box] Frame 0
class com.midasplayer.bouncer.Box extends com.midasplayer.bouncer.WorldObject
{
var setPerformCollision, getX, getY, setScaleX;
function Box () {
super();
setPerformCollision(false);
}
function getWidth() {
return(m_width);
}
function getHeight() {
return(m_height);
}
function getAlign() {
return(m_align);
}
function setAlign(align) {
m_align = align;
}
function getEdge(num) {
if (num == EDGE_LEFT) {
return((m_offsetX + getX()) + ((m_align == 1) ? 0 : (-m_width)));
}
if (num == EDGE_TOP) {
return(m_offsetY + getY());
}
if (num == EDGE_RIGHT) {
return((m_offsetX + getX()) + ((m_align == 1) ? (m_width) : 0));
}
if (num == EDGE_BOTTOM) {
return((m_offsetY + getY()) + m_height);
}
return(-1);
}
function onClipLoaded() {
super.onClipLoaded();
setScaleX(m_align * 100);
}
function bearCollision(bear, colData) {
return(false);
}
var DEFAULT_SYMBOL = "mcDoor";
static var EDGE_LEFT = 0;
static var EDGE_TOP = 1;
static var EDGE_RIGHT = 2;
static var EDGE_BOTTOM = 3;
var m_width = 5;
var m_height = 50;
var m_offsetX = 0;
var m_offsetY = 10;
var m_align = 1;
}
Symbol 653 MovieClip [__Packages.com.midasplayer.bouncer.Bear] Frame 0
class com.midasplayer.bouncer.Bear extends com.midasplayer.bouncer.Sphere
{
var setPerformCollision, setGravity, setBoundRadius, setElasticity, setMass, m_reservedX, m_animSuffix, m_colorSuffix, m_sizePrefix, m_size, m_anim, getClip, setClip, m_color, m_playbackSpeed, setPhysicsEnabled, m_saveDoor, m_game, m_walkDir, m_scoreSign, getBoundRadius, setY, setVel, getRotation, setScaleX, getScaleX, setRotationVel, setRotation, m_world, m_mask, getObjId, getY, getX, getVelY, getVelX, getPerformCollision, m_posX, m_posY;
function Bear () {
super();
setPerformCollision(false);
setGravity(GRAVITY);
setBoundRadius(22);
setElasticity(0.9);
setMass(1);
setColor(com.midasplayer.bouncer.Game.COLOR_BLUE);
setSize(SIZE_BIG);
setAnim(ANIM_FALL);
}
function setReservedX(x) {
m_reservedX = x;
}
function updateSymbol() {
DEFAULT_SYMBOL = ((("mc" + m_sizePrefix) + "bear") + m_colorSuffix) + m_animSuffix;
if (m_size == SIZE_SANTA) {
DEFAULT_SYMBOL = ("mc" + m_sizePrefix) + m_animSuffix;
} else if (m_anim == ANIM_SPLASH) {
DEFAULT_SYMBOL = ("mc" + m_animSuffix) + "01";
}
if (getClip() != undefined) {
setClip();
}
}
function getColor() {
return(m_color);
}
function setColor(color) {
m_color = color;
if (m_color == com.midasplayer.bouncer.Game.COLOR_RED) {
m_colorSuffix = "Red";
} else if (m_color == com.midasplayer.bouncer.Game.COLOR_YELLOW) {
m_colorSuffix = "Yellow";
} else if (m_color == com.midasplayer.bouncer.Game.COLOR_BLUE) {
m_colorSuffix = "Blue";
} else if (m_color == com.midasplayer.bouncer.Game.COLOR_GREEN) {
m_colorSuffix = "Green";
}
updateSymbol();
}
function getSize() {
return(m_size);
}
function setSize(size) {
m_size = size;
if (m_size == SIZE_SMALL) {
setBoundRadius(BOUND_RADIUS_SMALL);
setMass(MASS_SMALL);
setElasticity(ELASTICITY_SMALL);
m_sizePrefix = "Small";
} else if (m_size == SIZE_BIG) {
setBoundRadius(BOUND_RADIUS_BIG);
setMass(MASS_BIG);
setElasticity(ELASTICITY_BIG);
m_sizePrefix = "Big";
} else if (m_size == SIZE_SANTA) {
setBoundRadius(BOUND_RADIUS_SANTA);
setMass(MASS_SANTA);
setElasticity(ELASTICITY_SANTA);
m_sizePrefix = "Santa";
}
updateSymbol();
}
function getAnim() {
return(m_anim);
}
function setAnim(anim) {
m_anim = anim;
if (m_anim == ANIM_CRASH) {
m_animSuffix = "Crash";
m_playbackSpeed = 0.2;
} else if (m_anim == ANIM_FALL) {
m_animSuffix = "Fall";
m_playbackSpeed = 0.8;
} else if (m_anim == ANIM_HAPPY) {
m_animSuffix = "Happy";
m_playbackSpeed = 0.4;
} else if (m_anim == ANIM_SPLASH) {
m_animSuffix = "Splash";
m_playbackSpeed = 0.75;
} else {
trace("undefined anim called: " + m_anim);
}
updateSymbol();
}
function startFall() {
m_fallTick = -1;
setPhysicsEnabled(true);
setAnim(ANIM_FALL);
}
function crash(door, y) {
m_saveDoor = door;
m_walkTick = m_game.getTickCount() + CRASH_DELAY;
m_walkDir = door.getAlign() * -1;
setAnim(ANIM_CRASH);
var _local2 = m_game.saveBear(this, m_saveDoor);
m_scoreSign = createScoreSign(_local2, m_saveDoor);
m_scoreSign.setParent(this);
m_scoreSign.setX(m_walkDir * 10);
m_scoreSign.setY(-1.5 * getBoundRadius());
setY(y - getBoundRadius());
setVel(new com.midasplayer.MathUtil.Vec2D(0, 0));
if (Math.cos((getRotation() / 180) * Math.PI) < 0) {
setScaleX(getScaleX() * -1);
}
setRotationVel(0);
setRotation(0);
if (getSize() == SIZE_SMALL) {
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_BEAR_CRASH_SMALL);
} else {
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_BEAR_CRASH_BIG);
}
}
function createScoreSign(score, door) {
var _local3 = new com.midasplayer.bouncer.ScoreSign();
var _local2 = "mcScoreBubble";
if (door.getColor() == getColor()) {
if (getColor() == com.midasplayer.bouncer.Game.COLOR_RED) {
_local2 = _local2 + "Red";
} else if (getColor() == com.midasplayer.bouncer.Game.COLOR_GREEN) {
_local2 = _local2 + "Green";
} else if (getColor() == com.midasplayer.bouncer.Game.COLOR_YELLOW) {
_local2 = _local2 + "Yellow";
} else if (getColor() == com.midasplayer.bouncer.Game.COLOR_BLUE) {
_local2 = _local2 + "Blue";
}
} else {
_local2 = _local2 + "White";
}
m_world.addWorldObject(_local3, com.midasplayer.bouncer.Game.BEAR_LAYER, _local2);
_local3.setScore(score);
return(_local3);
}
function startWalk() {
m_walkTick = -1;
setAnim(ANIM_HAPPY);
setPhysicsEnabled(false);
setPerformCollision(false);
var _local2 = 0;
if (getSize() == SIZE_SMALL) {
_local2 = WALK_SPEED_SMALL;
} else if (getSize() == SIZE_BIG) {
_local2 = WALK_SPEED_BIG;
} else if (getSize() == SIZE_SANTA) {
_local2 = WALK_SPEED_SANTA;
}
setVel(new com.midasplayer.MathUtil.Vec2D(m_walkDir * _local2, 0));
setScaleX(m_walkDir * 100);
setRotationVel(0);
setRotation(0);
var _local3 = m_saveDoor.getClip();
m_mask = _local3.attachMovie(MASK_NAME, (_local3._name + "_mask_") + getObjId(), _local3.getNextHighestDepth());
getClip().setMask(m_mask);
}
function onRemovedFromWorld() {
m_mask.removeMovieClip();
if (m_scoreSign != undefined) {
m_world.removeWorldObject(m_scoreSign);
}
}
function onAddedToWorld() {
m_fallTick = m_game.getTickCount() + FALL_DELAY;
setPhysicsEnabled(false);
}
function update() {
super.update();
trace(((("- Bear <" + getX()) + ", ") + getY()) + ">");
trace(((("- Bear vel <" + getVelX()) + ", ") + getVelY()) + ">");
if ((getY() > com.midasplayer.bouncer.World.WORLD_EDGE_BOTTOM) && (m_anim != ANIM_SPLASH)) {
setAnim(ANIM_SPLASH);
m_killTick = m_game.getTickCount() + SPLASH_ANIM_TICKS;
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_SPLASH_AND_EAT);
setPhysicsEnabled(false);
setPerformCollision(false);
setY(com.midasplayer.bouncer.World.WORLD_EDGE_BOTTOM - 45);
setVel(new com.midasplayer.MathUtil.Vec2D(0, 0));
setRotation(0);
setRotationVel(0);
}
if ((getX() <= KILL_X_LEFT) || (getX() >= KILL_X_RIGHT)) {
trace("Bear outside box! Removing it!");
m_game.removeBear(this);
}
if ((getPerformCollision() == false) && (m_anim == ANIM_FALL)) {
if ((((getY() > (com.midasplayer.bouncer.World.WORLD_EDGE_TOP + getBoundRadius())) || (getY() < (com.midasplayer.bouncer.World.WORLD_EDGE_TOP - getBoundRadius()))) || (getX() < 50)) || (getX() > (com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT - 50))) {
setPerformCollision(true);
var _local4 = Math.floor(m_reservedX - getBoundRadius());
var _local3 = Math.ceil(m_reservedX + getBoundRadius());
m_game.releaseReservedBearPos(_local4, _local3);
}
}
if ((m_killTick != -1) && (m_game.getTickCount() >= m_killTick)) {
m_game.killBear(this);
}
if ((m_walkTick != -1) && (m_game.getTickCount() >= m_walkTick)) {
startWalk();
}
if ((m_fallTick != -1) && (m_game.getTickCount() >= m_fallTick)) {
startFall();
}
}
function traceStuff() {
trace(" tick: " + m_game.getTickCount());
trace(" ipTime: " + m_game.getIPTime());
trace(" getTimer: " + getTimer());
trace(" - id: " + getObjId());
trace(" fromX: " + m_posX.getPrevValue());
trace(" toX: " + m_posX.getNextValue());
trace(" fromY: " + m_posY.getPrevValue());
trace(" toY: " + m_posY.getNextValue());
trace(" --------");
}
var DEFAULT_SYMBOL = "bear";
var MASK_NAME = "mcDoorMask";
static var SIZE_SMALL = 0;
static var SIZE_BIG = 1;
static var SIZE_SANTA = 2;
static var ANIM_CRASH = 0;
static var ANIM_FALL = 1;
static var ANIM_HAPPY = 2;
static var ANIM_SPLASH = 3;
static var WALK_SPEED_SMALL = 10;
static var WALK_SPEED_BIG = 4;
static var WALK_SPEED_SANTA = 1.5;
static var EDGE_OFFSET = 30;
static var KILL_X_LEFT = com.midasplayer.bouncer.World.WORLD_EDGE_LEFT - EDGE_OFFSET;
static var KILL_X_RIGHT = com.midasplayer.bouncer.World.WORLD_EDGE_RIGHT + EDGE_OFFSET;
static var FALL_DELAY = 0;
static var CRASH_DELAY = 10;
static var SPLASH_ANIM_TICKS = 70;
static var GRAVITY = 0.25;
static var BOUND_RADIUS_SMALL = 16;
static var MASS_SMALL = 0.5;
static var ELASTICITY_SMALL = 0.95;
static var BOUND_RADIUS_BIG = 20;
static var MASS_BIG = 1;
static var ELASTICITY_BIG = 0.8;
static var BOUND_RADIUS_SANTA = 16;
static var MASS_SANTA = 5.5;
static var ELASTICITY_SANTA = 0.1;
var m_killTick = -1;
var m_fallTick = -1;
var m_walkTick = -1;
}
Symbol 654 MovieClip [__Packages.com.midasplayer.bouncer.ScoreSign] Frame 0
class com.midasplayer.bouncer.ScoreSign extends com.midasplayer.bouncer.WorldObject
{
var m_animated, setPhysicsEnabled, m_removeTick, m_game, getClip, m_world;
function ScoreSign () {
super();
m_animated = false;
setPhysicsEnabled(false);
}
function setScore(score) {
m_removeTick = m_game.getTickCount() + TICK_DURATION;
getClip().score.text = score;
}
function update() {
if (m_game.getTickCount() >= m_removeTick) {
m_world.removeWorldObject(this);
}
}
var DEFAULT_SYMBOL = "ball";
static var TICK_DURATION = 1.5 * com.midasplayer.bouncer.Game.TICKS_PER_SECOND;
}
Symbol 655 MovieClip [__Packages.com.midasplayer.bouncer.Door] Frame 0
class com.midasplayer.bouncer.Door extends com.midasplayer.bouncer.Box
{
var m_width, m_height, m_offsetY, m_performCollision, getClip, m_game, m_align, getX, getY, m_world, getAlign;
function Door () {
super();
m_width = 5;
m_height = 50;
m_offsetY = 10;
m_performCollision = false;
}
function getColor() {
return(m_color);
}
function setColor(color) {
m_color = color;
getClip().gotoAndStop(m_color + 1);
}
function onAddedToWorld() {
super.onAddedToWorld();
setColor(getColor());
var _local8 = 6 - m_game.getLevel();
var _local5 = 17 * _local8;
var _local7;
var _local9;
if (m_align == 1) {
_local7 = getX();
_local9 = getX() + _local5;
} else if (m_align == -1) {
_local7 = getX() - _local5;
_local9 = getX();
}
var _local10 = 60;
var _local6 = getY() + _local10;
var _local3 = new com.midasplayer.bouncer.CaveBoard();
_local3.setPoint(com.midasplayer.bouncer.LineSegment.POINT_START, _local7, _local6);
_local3.setPoint(com.midasplayer.bouncer.LineSegment.POINT_END, _local9, _local6);
_local3.setImpassable(false);
_local3.setParentDoor(this);
_local3.setClipSize(_local5);
m_world.addWorldObject(_local3, com.midasplayer.bouncer.Game.COLLISION_LAYER, "mcBlocks_" + _local8);
var _local4 = new com.midasplayer.bouncer.Billboard();
m_world.addWorldObject(_local4, com.midasplayer.bouncer.Game.COLLISION_LAYER, "mcBlockSingle");
_local4.setY(_local6);
if (m_align == 1) {
_local4.setX(getX() + _local5);
} else if (m_align == -1) {
_local4.setX(getX() - _local5);
_local4.setScaleX(-100);
}
}
function bearCollision(bear, colData) {
trace("col with door");
if (bear.getAnim() != com.midasplayer.bouncer.Bear.ANIM_HAPPY) {
var _local4 = m_game.saveBear(bear, this);
var _local2 = bear.createScoreSign(_local4, this);
_local2.setParent(this);
_local2.setX(getAlign() * 50);
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_BEAR_THUMP);
}
m_game.removeBear(bear);
return(false);
}
var DEFAULT_SYMBOL = "mcDoor";
var m_color = 0;
}
Symbol 656 MovieClip [__Packages.com.midasplayer.bouncer.LineSegment] Frame 0
class com.midasplayer.bouncer.LineSegment extends com.midasplayer.bouncer.WorldObject
{
var m_startPos, m_endPos, m_normal, setPerformCollision, m_bounceVec, setScaleX, setRotation, setX, setY, getRotation, m_game, setDestroyTick;
function LineSegment () {
super();
MIN_LENGTH = 0;
MAX_LENGTH = 10000;
m_startPos = new com.midasplayer.MathUtil.Vec2D();
m_endPos = new com.midasplayer.MathUtil.Vec2D();
m_normal = new com.midasplayer.MathUtil.Vec2D(0, -1);
m_oneShot = false;
setPerformCollision(false);
m_bounceVec = new com.midasplayer.MathUtil.Vec2D();
m_minBounce = 0;
}
function setClipSize(clipSize) {
m_clipSize = clipSize;
updateClip();
}
function getClipSize() {
return(m_clipSize);
}
function setDoubleSided(doubleSided) {
m_doubleSided = doubleSided;
}
function setImpassable(impassable) {
m_impassable = impassable;
}
function isDoubleSided() {
return(m_doubleSided);
}
function isImpassable() {
return(m_impassable);
}
function getStartPoint() {
return(m_startPos);
}
function getEndPoint() {
return(m_endPos);
}
function getNormal() {
return(m_normal);
}
function setMinBounce(minBounce) {
m_minBounce = minBounce;
}
function getBouncePower() {
return(m_bouncePower);
}
function enable(enable) {
if ((m_oneShot && (m_hasBounced)) && (enable)) {
return(undefined);
}
m_enabled = enable;
}
function setPoint(point, x, y) {
if ((point == POINT_START) || (!m_initialized)) {
m_startPos.x = x;
m_startPos.y = y;
}
if ((point == POINT_END) || (!m_initialized)) {
m_endPos.x = x;
m_endPos.y = y;
}
m_initialized = true;
if (m_enabled != false) {
enable(false);
}
if ((m_startPos.x == m_endPos.x) && (m_startPos.y == m_endPos.y)) {
m_endPos.x = m_startPos.x + MIN_LENGTH;
}
var _local3 = new com.midasplayer.MathUtil.Vec2D(m_endPos.x - m_startPos.x, m_endPos.y - m_startPos.y);
var _local2 = _local3.length();
if ((_local2 > MAX_LENGTH) || (_local2 < MIN_LENGTH)) {
_local3 = _local3.normalize();
if ((_local2 > MAX_LENGTH) || (_local2 < MIN_LENGTH)) {
var _local4 = Math.min(Math.max(MIN_LENGTH, _local2), MAX_LENGTH);
m_endPos = m_startPos.addition(_local3.multiply(_local4));
}
}
updateClip();
}
function updateClip() {
var _local7 = new com.midasplayer.MathUtil.Vec2D(m_endPos.x - m_startPos.x, m_endPos.y - m_startPos.y);
var _local2 = _local7.length();
if (_local2 == 0) {
return(undefined);
}
var _local6 = _local2;
setScaleX((100 * _local6) / m_clipSize);
var _local4 = m_endPos.y - m_startPos.y;
var _local5 = m_endPos.x - m_startPos.x;
var _local3 = Math.atan(_local4 / _local5);
if (m_endPos.x < m_startPos.x) {
_local3 = _local3 - Math.PI;
}
_local3 = _local3 * 57.2957795130823;
setRotation(_local3);
m_normal = new com.midasplayer.MathUtil.Vec2D(_local4 / _local2, (-_local5) / _local2);
setX(m_startPos.x);
setY(m_startPos.y);
}
function bounceSphere(sphere, colData) {
if (!m_enabled) {
return(0);
}
var _local8 = new com.midasplayer.MathUtil.Vec2D(sphere.getVelX(), sphere.getVelY());
var _local19 = (getRotation() / 180) * Math.PI;
var _local3 = getNormal();
var _local11 = new com.midasplayer.MathUtil.Vec2D(m_startPos.x - sphere.getX(), m_startPos.y - sphere.getY(0));
var _local13 = _local11.dot(_local3);
if (_local13 > 0) {
if (m_doubleSided) {
_local3 = _local3.multiply(-1);
} else {
return(0);
}
}
var _local18 = sphere.getElasticity() * getBouncePower();
var _local14 = new com.midasplayer.MathUtil.Vec2D(-_local3.y, _local3.x);
var _local12 = _local8.project(_local3);
var _local16 = _local12.length();
var _local5 = _local16 * _local18;
if (_local5 < m_minBounce) {
_local5 = m_minBounce;
}
var _local10 = _local3.multiply(_local5);
var _local4 = _local8.project(_local14);
_local4 = _local4.multiply(FRICTION_FACTOR);
var _local6;
_local6 = _local10;
_local6 = _local6.addition(_local4);
var _local17 = new com.midasplayer.MathUtil.Vec2D(-_local3.y, _local3.x);
var _local15 = _local17.dot(_local4);
var _local9 = _local4.length() / (Math.PI * (sphere.getBoundRadius() + sphere.getBoundRadius()));
if (_local15 < 0) {
_local9 = _local9 * -1;
}
sphere.setRotationVel((_local9 * 360) * 0.8);
sphere.setVel(_local6);
if (m_mobileBounce) {
m_bounceTick = m_game.getTickCount();
m_bounceVec = _local10.multiply(-1);
}
m_hasBounced = true;
if (m_oneShot) {
remove();
}
if (!com.midasplayer.bouncer.Game.PRACTICE_GAME) {
var _local7 = ((((((((((((((((("999," + m_game.getTick()) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(sphere.getX())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(sphere.getY())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(sphere.getVelX())) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(sphere.getVelY())) + " ") + getStartPoint().x) + " ") + getStartPoint().y) + " ") + getEndPoint().x) + " ") + getEndPoint().y) + " ,=0";
fscommand ("playData", _local7);
_local7 = ((((((((((((((((("999," + m_game.getTick()) + " ") + sphere.getX()) + " ") + sphere.getY()) + " ") + sphere.getVelX()) + " ") + sphere.getVelY()) + " <") + getStartPoint().x) + " ") + getStartPoint().y) + "> <") + getEndPoint().x) + " ") + getEndPoint().y) + "> ,=0";
trace("playData: " + _local7);
}
return(_local5);
}
function remove() {
setDestroyTick(m_game.getTickCount() + FADE_OUT_TICKS);
}
var DEFAULT_SYMBOL = "mcTrampolineRed";
static var POINT_START = 0;
static var POINT_END = 1;
var MIN_LENGTH = 0;
var MAX_LENGTH = 10000;
var FRICTION_FACTOR = 1;
var FADE_OUT_TICKS = 1;
var m_initialized = false;
var m_clipSize = 100;
var m_oneShot = false;
var m_hasBounced = false;
var m_enabled = false;
var m_doubleSided = true;
var m_impassable = false;
var m_mobileBounce = false;
var m_bounceTick = -1;
var m_minBounce = 0;
var m_bouncePower = 1;
}
Symbol 657 MovieClip [__Packages.com.midasplayer.util.FloatEncoder] Frame 0
class com.midasplayer.util.FloatEncoder
{
function FloatEncoder () {
}
static function encodeBits(val) {
var _local6 = val < 0;
if (_local6) {
val = -val;
}
var _local4 = 0;
while (val > 1) {
val = val / 2;
_local4++;
}
if (_local6) {
_local4 = (-_local4) - 1;
}
var _local5 = _local4 + ".";
do {
var _local3 = 0;
var _local1 = 0;
while (_local1 < 6) {
if (val >= 1) {
val = val - 1;
_local3 = _local3 | (1 << _local1);
}
val = val * 2;
_local1++;
}
_local5 = _local5 + BASE_64_CHARS.charAt(_local3);
} while (val > 0);
return(_local5);
}
static function decodeBits(encodedData) {
var _local6 = encodedData.split(".");
var _local7 = parseInt(_local6[0]);
var _local8 = _local7 < 0;
var _local5 = _local6[1];
var _local2 = 0;
if (_local8) {
_local7 = (-_local7) - 1;
}
var _local4 = 0;
while (_local4 < _local5.length) {
_local6 = _local5.charAt((_local5.length - _local4) - 1);
var _local3 = BASE_64_CHARS.indexOf(_local6);
var _local1 = 0;
while (_local1 < 6) {
_local2 = _local2 / 2;
if (((_local3 >> (5 - _local1)) & 1) > 0) {
_local2 = _local2 + 1;
}
_local1++;
}
_local4++;
}
_local4 = 0;
while (_local4 < _local7) {
_local2 = _local2 * 2;
_local4++;
}
if (_local8) {
_local2 = -_local2;
}
return(_local2);
}
static var BASE_64_CHARS = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ()";
}
Symbol 658 MovieClip [__Packages.com.midasplayer.bouncer.StaticPlane] Frame 0
class com.midasplayer.bouncer.StaticPlane extends com.midasplayer.bouncer.LineSegment
{
var enable, setDoubleSided, setImpassable, m_minBounce, m_bouncePower, m_bounceSound;
function StaticPlane () {
super();
enable(true);
setDoubleSided(false);
setImpassable(true);
m_minBounce = 0;
m_bouncePower = 0.7;
}
function setBounceSound(sound) {
m_bounceSound = sound;
}
function getBounceSound() {
return(m_bounceSound);
}
function setClip(worldLayer, symbol, clipName) {
super.setClip(worldLayer, symbol, clipName);
}
function getBouncePower() {
return(m_bouncePower);
}
function setPoint(point, x, y) {
super.setPoint(point, x, y);
enable(true);
}
function bounceSphere(sphere, colData) {
var _local3 = super.bounceSphere(sphere, colData);
if (m_bounceSound != undefined) {
com.midasplayer.fx.SoundManager.play(m_bounceSound);
}
return(_local3);
}
var DEFAULT_SYMBOL = "";
}
Symbol 659 MovieClip [__Packages.com.midasplayer.fx.SoundManager] Frame 0
class com.midasplayer.fx.SoundManager
{
function SoundManager () {
}
static function parseGroup(group) {
return(((group == undefined) ? (DEFAULT_GROUP) : (group)));
}
static function addSoundGroup(group) {
var _local1 = soundEnabledMap.get(group);
if (_local1 == undefined) {
soundEnabledMap.put(group, {groupEnabled:isSoundEnabled(DEFAULT_GROUP)});
}
}
static function isSoundEnabled(group) {
group = parseGroup(group);
var _local1 = soundEnabledMap.get(group).groupEnabled;
if (_local1 == undefined) {
_local1 = true;
}
return(_local1);
}
static function enableSounds(enabled, group) {
group = parseGroup(group);
addSoundGroup(group);
var _local2 = (soundEnabledMap.get(group).groupEnabled = enabled);
trace(((("soundEnabled: " + isSoundEnabled(group)) + " '") + group) + "'");
if (!enabled) {
muteAll(group);
} else {
restoreMuteAll(group);
}
}
static function stopAll(group) {
sounds.foreach(function (name, soundEntry) {
soundEntry.sound.stop();
soundEntry.playStatus = false;
});
}
static function muteAll(group) {
group = parseGroup(group);
sounds.foreach(function (name, soundEntry) {
if (soundEntry.group == group) {
soundEntry.sound.setVolume(0);
}
});
}
static function restoreMuteAll(group) {
group = parseGroup(group);
sounds.foreach(function (name, soundEntry) {
if (soundEntry.group == group) {
soundEntry.sound.setVolume(soundEntry.realVol);
}
});
}
static function stop(resource) {
var _local1 = sounds.get(resource);
if (_local1 != undefined) {
_local1.sound.stop();
_local1.playStatus = false;
}
}
static function getCalibratedVolume(flashVolume) {
flashVolume = Math.min(100, flashVolume);
flashVolume = Math.max(0, flashVolume);
return(Math.ceil(Math.pow(flashVolume / 100, 1.46) * 100));
}
static function setVolume(resource, percent) {
var _local1 = sounds.get(resource);
if ((_local1 != undefined) && (_local1.playStatus == true)) {
var _local2 = getCalibratedVolume(percent);
_local1.sound.setVolume(_local2);
_local1.sound.volume = _local2;
}
}
static function isPlaying(resource) {
var _local1 = sounds.get(resource);
return((_local1 != undefined) && (_local1.playStatus == true));
}
static function play(resource, volume, isLoop, group) {
if (volume == undefined) {
volume = 100;
}
if (isLoop == undefined) {
isLoop = false;
}
volume = getCalibratedVolume(volume);
var _local1 = sounds.get(resource);
if (_local1 == undefined) {
_local1 = loadResource(resource, group);
}
if (_local1 != undefined) {
_local1.sound.setVolume((isSoundEnabled(_local1.group) ? (volume) : 0));
_local1.realVol = volume;
_local1.playStatus = true;
_local1.sound.start(0, (isLoop ? 32767 : 1));
}
}
static function loadResource(resource, group) {
group = parseGroup(group);
addSoundGroup(group);
var _local3 = _root.getNextHighestDepth();
var _local2 = new Sound(_root.createEmptyMovieClip("sm_sndhold_" + _local3, _local3));
_local2.attachSound(resource);
_local2.onSoundComplete = function () {
var _local1 = com.midasplayer.fx.SoundManager.sounds.get(resource);
_local1.playStatus = false;
};
sounds.put(resource, {realVol:100, sound:_local2, playStatus:true, group:group});
return(sounds.get(resource));
}
static var DEFAULT_GROUP = "default";
static var sounds = new com.midasplayer.util.Map();
static var soundEnabledMap = new com.midasplayer.util.Map();
}
Symbol 660 MovieClip [__Packages.com.midasplayer.bouncer.CaveBoard] Frame 0
class com.midasplayer.bouncer.CaveBoard extends com.midasplayer.bouncer.StaticPlane
{
var m_parentDoor, getY;
function CaveBoard () {
super();
}
function setParentDoor(door) {
m_parentDoor = door;
}
function getParentDoor() {
return(m_parentDoor);
}
function bounceSphere(sphere, colData) {
var _local2 = com.midasplayer.bouncer.Bear(sphere);
_local2.crash(m_parentDoor, getY());
if (m_parentDoor == undefined) {
trace("ERROR: board does not have a door defined");
}
return(0);
}
var DEFAULT_SYMBOL = "static_plane";
}
Symbol 661 MovieClip [__Packages.com.midasplayer.bouncer.Billboard] Frame 0
class com.midasplayer.bouncer.Billboard extends com.midasplayer.bouncer.WorldObject
{
var m_animated, setPhysicsEnabled;
function Billboard () {
super();
m_animated = true;
setPhysicsEnabled(false);
}
var DEFAULT_SYMBOL = "ball";
}
Symbol 662 MovieClip [__Packages.com.midasplayer.util.FpsCounter] Frame 0
class com.midasplayer.util.FpsCounter
{
var m_clip, m_textField;
function FpsCounter (scope) {
var _local4 = 0;
var _local3 = 0;
var _local2 = "fpsTextField";
m_clip = scope.createEmptyMovieClip("fpsCounter", scope.getNextHighestDepth());
m_clip.createTextField(_local2, m_clip.getNextHighestDepth(), _local4, _local3, 100, 30);
m_textField = m_clip[_local2];
m_textField.textColor = 16711680 /* 0xFF0000 */;
m_clip.onEnterFrame = mx.utils.Delegate.create(this, onRender);
}
function onRender() {
var _local2 = getTimer();
m_fpsCount++;
if ((getTimer() - m_lastFpsUpdateTime) >= 1000) {
var _local3 = "FPS: " + m_fpsCount;
m_lastFpsUpdateTime = _local2;
m_textField.text = _local3;
m_fpsCount = 0;
m_lastFpsUpdateTime = getTimer();
}
}
var m_fpsCount = 0;
var m_lastFpsUpdateTime = 0;
}
Symbol 663 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 664 MovieClip [__Packages.com.midasplayer.bouncer.InfoScreen] Frame 0
class com.midasplayer.bouncer.InfoScreen
{
var m_okButtonText, m_clip, m_game, m_soundIdentifier;
function InfoScreen () {
m_okButtonText = com.midasplayer.util.I18n.getString("start");
}
function setExitDelay(delay) {
m_exitDelay = delay;
}
function setFps(fps) {
m_fps = fps;
}
function setLooping(looping) {
m_looping = looping;
}
function getClip() {
return(m_clip);
}
function init(game, parent, symbol, expireTime) {
if (game == undefined) {
trace("-- InfoScreen have no reference to game!");
}
if (symbol == undefined) {
symbol = DEFAULT_SYMBOL;
}
if (expireTime != undefined) {
m_expireTime = expireTime;
}
m_game = game;
m_clip = parent.attachMovie(symbol, symbol + "_infoscreen", parent.getNextHighestDepth());
m_clip.ok_button.onPress = mx.utils.Delegate.create(this, exit);
m_startTime = getTimer();
}
function setPos(x, y) {
m_clip._x = x;
m_clip._y = y;
}
function setExitState(exitState) {
m_exitState = exitState;
}
function setExpireTime(expireTime) {
m_expireTime = expireTime;
}
function setSound(sound) {
m_soundIdentifier = sound;
com.midasplayer.fx.SoundManager.play(m_soundIdentifier);
}
function setButtonText(textValue) {
m_okButtonText = textValue;
}
function setText(textFieldName, textValue) {
m_clip[textFieldName].text = textValue;
}
function update() {
var _local3 = (getTimer() - m_startTime) / 1000;
var _local4 = m_expireTime - _local3;
m_clip.ok_button_text.text = ((m_okButtonText + " (") + Math.round(_local4)) + ")";
if (_local4 <= 0) {
exit();
}
var _local2 = Math.floor(_local3 * m_fps);
if (m_looping) {
_local2 = (_local2 % m_clip._framesloaded) + 1;
} else if (_local2 > (m_clip._framesloaded - 1)) {
_local2 = m_clip._framesloaded - 1;
}
m_clip.gotoAndStop(_local2);
}
function exit() {
var _local2 = (getTimer() - m_startTime) / 1000;
if (_local2 < m_exitDelay) {
return(undefined);
}
com.midasplayer.fx.SoundManager.stop(m_soundIdentifier);
m_clip.removeMovieClip();
m_game.infoScreenExit(m_exitState);
}
var DEFAULT_SYMBOL = "info_screen";
var m_startTime = -1;
var m_expireTime = 5000;
var m_exitState = com.midasplayer.bouncer.Game.STATE_NONE;
var m_exitDelay = 0;
var m_fps = 12;
var m_looping = true;
}
Symbol 665 MovieClip [__Packages.com.midasplayer.bouncer.Trampoline] Frame 0
class com.midasplayer.bouncer.Trampoline extends com.midasplayer.bouncer.LineSegment
{
var MIN_LENGTH, MAX_LENGTH, m_oneShot, m_mobileBounce, setMinBounce, setPlaybackSpeed, setClip, m_startPointHandle, getClip, getObjId, m_endPointHandle, getClipSize, getScaleX, m_game, m_bounceTick, m_bounceVec, setNextX, getStartPoint, setNextY, m_enabled, m_endPos, setAlphaVel;
function Trampoline () {
super();
MIN_LENGTH = 50;
MAX_LENGTH = 100;
m_oneShot = true;
m_mobileBounce = true;
setMinBounce(5);
setPlaybackSpeed(10);
}
function onAddedToWorld() {
enable(false);
}
function setColor(color) {
if (!m_mobileBounce) {
return(undefined);
}
setClip(undefined, "mcTrampoline" + color);
m_startPointHandle.removeMovieClip();
m_startPointHandle = getClip().attachMovie(("mcBounceMatAnim" + color) + "02", "startHandle_" + getObjId, getClip().getNextHighestDepth());
m_endPointHandle.removeMovieClip();
m_endPointHandle = getClip().attachMovie(("mcBounceMatAnim" + color) + ((color == "Red") ? "02" : "01"), "endHandle_" + getObjId, getClip().getNextHighestDepth());
m_endPointHandle._rotation = 180;
m_endPointHandle._x = getClipSize();
if (color == "Red") {
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_ENABLE_TRAMPOLINE);
} else if (color == "Blue") {
m_endPointHandle.stop();
}
updateHandles();
}
function updateHandles() {
if ((m_startPointHandle == undefined) && (m_endPointHandle == undefined)) {
return(undefined);
}
var _local2 = 10000 / getScaleX();
m_startPointHandle._xscale = (m_endPointHandle._xscale = _local2);
}
function onRemovedFromWorld() {
m_game.removeTrampoline(this);
}
function update() {
super.update();
if ((m_mobileBounce && (m_bounceTick != -1)) && ((m_bounceVec.x != 0) || (m_bounceVec.y != 0))) {
var _local3 = ((m_game.getTickCount() - m_bounceTick) / 2) + 0.1;
if (_local3 > 1) {
m_bounceTick = -1;
_local3 = 1;
}
var _local4 = Math.sin(_local3 * Math.PI);
var _local6 = (-m_bounceVec.x) * _local4;
var _local7 = (-m_bounceVec.y) * _local4;
setNextX(getStartPoint().x - _local6);
setNextY(getStartPoint().y - _local7);
}
if (!m_enabled) {
var _local5 = (m_endPointHandle._currentframe % m_endPointHandle._framesloaded) + 1;
m_endPointHandle.gotoAndStop(_local5);
}
}
function isEnabled() {
return(m_enabled);
}
function enable(enable) {
m_enabled = enable;
if (m_enabled) {
if (!com.midasplayer.bouncer.Game.PRACTICE_GAME) {
var _local2 = ((((("2," + m_game.getTickCount()) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(m_endPos.x)) + " ") + com.midasplayer.util.FloatEncoder.encodeBits(m_endPos.y)) + " ,=0";
fscommand ("playData", _local2);
_local2 = ((((("2," + m_game.getTickCount()) + " ") + m_endPos.x) + " ") + m_endPos.y) + " ,=0";
trace("playData: " + _local2);
}
setColor("Red");
} else {
setColor("Blue");
}
setAlphaVel(0);
}
function setPoint(point, x, y) {
if (isEnabled()) {
trace((((("trying to set point on enabled trampoline! " + point) + " ") + x) + " ") + y);
return(undefined);
}
super.setPoint(point, x, y);
updateHandles();
}
function bounceSphere(sphere, colData) {
if (!m_enabled) {
if (com.midasplayer.bouncer.Game.isServer()) {
return(0);
}
enable(true);
}
var _local3 = super.bounceSphere(sphere, colData);
if (m_game.getActiveTrampoline() == this) {
m_game.clearActiveTrampoline();
}
if (_local3 <= 5) {
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_BOUNCE_TRAMPOLINE_LOW);
} else if (_local3 < 9) {
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_BOUNCE_TRAMPOLINE_MID);
} else if (_local3 < 14) {
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_BOUNCE_TRAMPOLINE_HIGH);
} else {
com.midasplayer.fx.SoundManager.play(com.midasplayer.bouncer.Game.SOUND_BOUNCE_TRAMPOLINE_ULTRA_HIGH);
}
m_game.onBounceTrampoline();
return(_local3);
}
function getBouncePower() {
return(getScaleX() / MAX_LENGTH);
}
function remove() {
super.remove();
setAlphaVel(-200 / com.midasplayer.bouncer.Game.TICKS_PER_SECOND);
}
var DEFAULT_SYMBOL = "mcTrampolineRed";
}
Symbol 666 MovieClip [__Packages.com.midasplayer.bouncer.ClientInput] Frame 0
class com.midasplayer.bouncer.ClientInput
{
function ClientInput () {
}
var m_type = 0;
var m_x = 0;
var m_y = 0;
}
Symbol 667 MovieClip [__Packages.com.midasplayer.util.Randomizer] Frame 0
class com.midasplayer.util.Randomizer
{
static var m_seedParam;
function Randomizer () {
}
static function getSeed() {
if (!SEEDED) {
seed(DEFAULT_SEED);
}
return(m_seedParam);
}
static function seed(ijkl) {
m_seedParam = ijkl;
CURRENT_SEED = Math.round(Math.abs(ijkl % BIG_PRIME));
ranmarin(CURRENT_SEED);
}
static function ranmarin(ijkl) {
var _local10;
var _local11;
var _local7;
var _local9;
var _local3;
var _local5;
var _local2;
var _local1;
var _local4;
var _local8;
var _local6;
_local10 = ijkl / 30082;
_local11 = ijkl - (30082 * _local10);
_local7 = ((_local10 / 177) % 177) + 2;
_local3 = (_local10 % 177) + 2;
_local2 = ((_local11 / 169) % 178) + 1;
_local1 = _local11 % 169;
_local9 = 0;
while (_local9 < 97) {
_local8 = 0;
_local6 = 0.5;
_local5 = 0;
while (_local5 < 24) {
_local4 = (((_local7 * _local3) % 179) * _local2) % 179;
_local7 = _local3;
_local3 = _local2;
_local2 = _local4;
_local1 = ((53 * _local1) + 1) % 169;
if (((_local1 * _local4) % 64) >= 32) {
_local8 = _local8 + _local6;
}
_local6 = _local6 * 0.5;
_local5++;
}
m_u[_local9] = _local8;
_local9++;
}
m_c = 0.0216028690338135;
m_cd = 0.456233084201813;
m_cm = 0.999999821186066;
m_i97 = 96;
m_j97 = 32;
SEEDED = true;
}
static function random() {
if (!SEEDED) {
seed(DEFAULT_SEED);
}
var _local1;
_local1 = m_u[m_i97] - m_u[m_j97];
if (_local1 < 0) {
_local1 = _local1 + 1;
}
m_u[m_i97] = _local1;
if ((--m_i97) < 0) {
m_i97 = 96;
}
if ((--m_j97) < 0) {
m_j97 = 96;
}
m_c = m_c - m_cd;
if (m_c < 0) {
m_c = m_c + m_cm;
}
_local1 = _local1 - m_c;
if (_local1 < 0) {
_local1 = _local1 + 1;
}
return(_local1);
}
static function randomRange(minValue, maxValue) {
return(Math.floor(random() * ((maxValue - minValue) + 1)) + minValue);
}
static function signedRandom() {
return((random() * 2) - 1);
}
static var m_u = new Array(97);
static var m_uvec = new Array(97);
static var m_c = 0;
static var m_cd = 0;
static var m_cm = 0;
static var m_i97 = 0;
static var m_j97 = 0;
static var DEFAULT_SEED = new Date().getTime();
static var CURRENT_SEED = 54217137;
static var SEEDED = false;
static var BIG_PRIME = 899999963;
}
Symbol 668 MovieClip [__Packages.com.midasplayer.bouncer.SoundToggle] Frame 0
class com.midasplayer.bouncer.SoundToggle extends MovieClip
{
var m_clip;
function SoundToggle (parent, x, y) {
super();
m_clip = parent.attachMovie(SymbolName, "sound_toggle", parent.getNextHighestDepth());
if (x != undefined) {
m_clip._x = x;
}
if (y != undefined) {
m_clip._y = y;
}
m_clip.onEnterFrame = mx.utils.Delegate.create(this, update);
m_clip.onRelease = mx.utils.Delegate.create(this, toggle);
}
function update() {
if (com.midasplayer.fx.SoundManager.isSoundEnabled() && (m_clip._currentframe != SOUND_ENABLED_FRAME)) {
m_clip.gotoAndStop(SOUND_ENABLED_FRAME);
} else if ((!com.midasplayer.fx.SoundManager.isSoundEnabled()) && (m_clip._currentframe != SOUND_DISABLED_FRAME)) {
m_clip.gotoAndStop(SOUND_DISABLED_FRAME);
}
}
function toggle() {
if (com.midasplayer.fx.SoundManager.isSoundEnabled()) {
trace("sound: off");
com.midasplayer.fx.SoundManager.enableSounds(false);
} else {
trace("sound: on");
com.midasplayer.fx.SoundManager.enableSounds(true);
}
}
static var SymbolName = "mcSoundToggle";
static var SOUND_ENABLED_FRAME = 2;
static var SOUND_DISABLED_FRAME = 1;
}
Symbol 669 MovieClip [__Packages.com.midasplayer.bouncer.PowerUp] Frame 0
class com.midasplayer.bouncer.PowerUp extends com.midasplayer.bouncer.Box
{
var m_width, m_height, m_offsetX, m_offsetY, setPerformCollision, m_power, m_game, m_world;
function PowerUp () {
super();
m_width = 30;
m_height = 40;
m_offsetX = 20;
m_offsetY = 22;
setPerformCollision(false);
}
function getPower() {
return(m_power);
}
function setPower(power, game) {
m_power = power;
DEFAULT_SYMBOL = DEFAULT_SYMBOL + game.getPowerString(m_power);
DEFAULT_SYMBOL = DEFAULT_SYMBOL + "01";
}
function bearCollision(bear, colData) {
m_game.enablePower(m_power);
m_world.removeWorldObject(this);
return(false);
}
var DEFAULT_SYMBOL = "mcPowerup";
}
Symbol 670 MovieClip [__Packages.com.midasplayer.bouncer.Bumper] Frame 0
class com.midasplayer.bouncer.Bumper extends com.midasplayer.bouncer.Sphere
{
var setPerformCollision, setGravity, setBoundRadius, setMass, m_animated, m_playbackSpeed, setVelX, getX, getVelX, setVelY, getY, getVelY, setRotationVel, getRotationVel;
function Bumper () {
super();
setPerformCollision(false);
setGravity(0);
setBoundRadius(18);
setMass(BUMPER_MASS);
m_animated = true;
m_playbackSpeed = 1;
}
function setX(x) {
super.setX(x);
m_targetX = x;
}
function setY(y) {
super.setY(y);
m_targetY = y;
}
function update() {
super.update();
setVelX((getVelX() * 0.97) + ((getX() - m_targetX) * -0.01));
setVelY((getVelY() * 0.97) + ((getY() - m_targetY) * -0.01));
setRotationVel(getRotationVel() * 0.98);
}
var DEFAULT_SYMBOL = "mcBumperCloud";
static var BUMPER_MASS = 1.5;
var m_targetX = 200;
var m_targetY = 300;
}