Frame 1
function f_EndGame(b_IsWin) {
if (b_IsWin) {
} else {
_root.f_StartGame("menu", 1, "level");
}
}
function f_CleanUp(b_ModeChange) {
if (_root.o_AchieveQueue == undefined) {
_root.o_AchieveQueue = new Array();
_root.d_AchievementLast = new Date();
}
if (_root.o_Objects != undefined) {
var _local2 = _root.o_Objects.length - 1;
while (_local2 >= 0) {
if (b_ModeChange || ((!b_ModeChange) && (_root.o_Objects[_local2]._name != _root.o_FriendObject._name))) {
_root.f_RemoveBall(_root.o_Objects[_local2]);
}
_local2--;
}
} else {
_root.o_Objects = new Array();
_root.o_FriendObject = undefined;
}
if (_root.o_Explosions != undefined) {
var _local3 = _root.o_Explosions.length - 1;
while (_local3 >= 0) {
_root.o_Explosions[_local3].removeMovieClip();
_local3--;
}
}
_root.o_Explosions = new Array();
if (_root.o_Lightenings != undefined) {
var _local4 = _root.o_Lightenings.length - 1;
while (_local4 >= 0) {
_root.o_Lightenings[_local4].removeMovieClip();
_local4--;
}
}
_root.o_Lightenings = new Array();
if (_root.o_Beams != undefined) {
var _local6 = _root.o_Beams.length - 1;
while (_local6 >= 0) {
_root.o_Beams[_local6].removeMovieClip();
_local6--;
}
}
_root.o_Beams = new Array();
if (_root.o_Vortexes != undefined) {
var _local7 = _root.o_Vortexes.length - 1;
while (_local7 >= 0) {
_root.o_Vortexes[_local7].removeMovieClip();
_local7--;
}
}
_root.o_Vortexes = new Array();
if (b_ModeChange) {
if (_root.o_Collects != undefined) {
var _local5 = _root.o_Collects.length - 1;
while (_local5 >= 0) {
_root.o_Collects[_local5].removeMovieClip();
_local5--;
}
}
_root.o_Collects = new Array();
} else if (_root.o_Collects == undefined) {
_root.o_Collects = new Array();
}
}
function f_StartGame(s_NewMode, n_NewLevel, s_NewGameStyle) {
var o_EnemyBall;
var _local88 = Math.random();
var _local95 = "";
var _local64;
var _local22;
var n_BallType;
var n_BallSize;
var _local79 = s_NewMode != _root.s_GameMode;
if (_root.o_EffectsContainer.o_StartLevelAnim._name != undefined) {
_root.o_EffectsContainer.o_StartLevelAnim.removeMovieClip();
}
_root.b_Instructions = false;
if (s_NewMode == "menu") {
_root.f_CalcLevels();
_root.f_SetAchievements(_root.o_MenuOverlay.o_MenuScroller.o_Main.o_HomeAchievements, []);
if (_local79) {
_root.o_MenuPosition = new Object({_x:0, _y:300});
_root.d_MenuNext = new Date();
_root.d_MenuNext.setTime(new Date().getTime() + _root.n_MenuMinInflate);
_root.d_MenuGravityStart = new Date();
_root.d_MenuGravityStart.setTime((new Date().getTime() - _root.n_MenuGravityInterval) - 1);
}
_root.o_EndScreen._x = 2000;
_root.o_EndScreen.gotoAndStop(1);
_root.b_EndScreen = false;
} else {
if (_local79) {
_root.o_GameOverlay.gotoAndStop(s_NewGameStyle);
}
if ((s_NewGameStyle == "survival") || ((s_NewGameStyle == "level") && (_root.o_Levels[n_NewLevel]._instr > 0))) {
_root.b_Instructions = true;
}
}
if ((s_NewMode != "menu") && (!_root.b_Instructions)) {
_root.o_EffectsContainer.attachMovie("StartLevelAnim", "o_StartLevelAnim", _root.o_EffectsContainer.getNextDepth(), {_x:_root.o_FriendObject._x, _y:_root.o_FriendObject._y});
}
if (_root.o_Instructions._name != undefined) {
_root.o_Instructions.removeMovieClip();
}
if (_root.b_Instructions) {
_root.attachMovie("Instructions", "o_Instructions", _root.getNextHighestDepth(), {_x:_root.n_GameWidth / 2, _y:_root.n_GameHeight / 2});
_root.o_Instructions.gotoAndPlay(s_NewGameStyle.toLowerCase());
}
_root.n_SurvivalTotalClicks = 0;
_root.n_SurvivalTotalCollects = 0;
if (_local79) {
_root.n_PlayerCollects = 0;
}
_root.s_GameMode = s_NewMode;
_root.s_GameStyle = s_NewGameStyle;
_root.b_GameOver = false;
_root.b_GameWin = false;
_root.b_GameOut = false;
_root.f_CleanUp(_local79);
_root.o_ShadowContainer._alpha = _root.n_FadeOutShadowStart;
_root.n_Score = 0;
_root.d_AIIntervalLast = new Date();
if (_root.o_FriendObject._name == undefined) {
_root.o_FriendObject = _root.f_CreateBall(0, _root.n_GameWidth / 2, _root.n_GameHeight / 2, 20, true, -1);
_root.o_Objects.push(_root.o_FriendObject);
}
if (_local79 || (_root.a_MessageArray == undefined)) {
_root.a_MessageArray = new Array();
_root.d_MessageLast = new Date();
}
_root.o_MenuOverlay._visible = s_NewMode == "menu";
_root.o_MenuOverlay._x = ((s_NewMode == "menu") ? 0 : 2000);
_root.o_GameOverlay._visible = s_NewMode != "menu";
_root.o_GameOverlay._x = ((s_NewMode != "menu") ? 0 : 2000);
_root.n_Level = n_NewLevel;
if ((_root.s_GameStyle == "level") || (_root.s_GameMode == "menu")) {
_local64 = ((s_NewMode == "menu") ? (Math.floor(_root.o_Levels.length * Math.random())) : (_root.n_Level));
if (_local64 > (_root.o_Levels.length - 1)) {
_local64 = _root.o_Levels.length - 1;
}
var _local63 = 0;
while (_local63 < _root.o_Levels[_local64]._balls.length) {
_local22 = _root.o_Levels[_local64]._balls[_local63];
var _local56 = 0;
while (_local56 < _local22._q) {
n_BallType = _local22._t;
n_BallSize = _local22._s;
o_EnemyBall = _root.f_CreateBall(n_BallType, _root.n_GameWidth / 2, _root.n_GameHeight / 2, n_BallSize, false, _local22._maxvel);
if (_local22._b) {
_root.f_MakeBallBreeder(o_EnemyBall);
}
_root.o_Objects.push(o_EnemyBall);
_local56++;
}
_local63++;
}
} else if (_root.s_GameStyle == "survival") {
_root.n_SurvivalBallsPopped = 0;
_root.n_SurvivalBallSizeCurrent = _root.n_SurvivalBallSizeLower;
_root.n_SurvivalLast = 0;
var _local63 = 0;
while (_local63 < _root.n_SurvivalBallsStart) {
n_BallType = _root.f_SurvivalType();
n_BallSize = _root.f_SurvivalSize(n_BallType);
o_EnemyBall = _root.f_CreateBall(n_BallType, _root.n_GameWidth / 2, _root.n_GameHeight / 2, n_BallSize, false, -1);
_root.o_Objects.push(o_EnemyBall);
_local63++;
}
}
_root.n_ObjectsAtStart = _root.o_Objects.length - 1;
_root.o_AchievementsNew = new Array();
_root.n_GamePercent = 0;
_root.n_GamePercentNeeded = _root.o_Levels[_local64]._perc;
_root.n_OrigionalBalls = _root.o_Objects.length - 1;
_root.n_SelectorRange = ((_root.s_GameStyle == "survival") ? (_root.n_SurvivalRange) : (_root.o_Levels[_local64]._sel));
_root.n_ClicksAllowed = ((_root.s_GameStyle == "survival") ? (_root.n_SurvivalClicks) : (_root.o_Levels[_local64]._clicks));
_root.o_Clicks = new Array();
_root.n_ClicksOnWin = -1;
if (_local79) {
_root.o_Selector._x = (_root.o_Backlight.o_Light._x = (_root.o_FriendObject._x = _root.n_GameWidth / 2));
_root.o_Selector._y = (_root.o_Backlight.o_Light._y = (_root.o_FriendObject._y = _root.n_GameHeight / 2));
if (s_NewGameStyle == "survival") {
_root.o_GameOverlay.o_Clicks.text = _root.n_ClicksAllowed;
_root.o_GameOverlay.o_Level.text = "-";
_root.o_GameOverlay.o_Level._visible = false;
_root.o_GameOverlay.o_Group.text = "-";
_root.o_GameOverlay.o_Group._visible = false;
} else {
_root.o_GameOverlay.o_Level.text = _root.n_Level.toString();
_root.o_GameOverlay.o_Level._visible = true;
_root.o_GameOverlay.o_Group._visible = true;
switch (_root.o_Levels[_root.n_Level]._group.toUpperCase()) {
case "B" :
_root.o_GameOverlay.o_Group.text = "Basic";
break;
case "S" :
_root.o_GameOverlay.o_Group.text = "Standard";
break;
case "A" :
_root.o_GameOverlay.o_Group.text = "Advanced";
break;
case "E" :
_root.o_GameOverlay.o_Group.text = "Expert";
}
_root.o_GameOverlay.o_Needed.text = _root.n_GamePercentNeeded.toString() + "%";
_root.o_GameOverlay.o_Percent.text = _root.n_GamePercent.toString() + "%";
_root.o_GameOverlay.o_Clicks.text = _root.n_ClicksAllowed - _root.o_Clicks.length;
}
} else if (s_NewGameStyle == "level") {
_root.o_GameOverlay.o_Level.text = _root.n_Level.toString();
_root.o_GameOverlay.o_Level._visible = true;
_root.o_GameOverlay.o_Group._visible = true;
switch (_root.o_Levels[_root.n_Level]._group.toUpperCase()) {
case "B" :
_root.o_GameOverlay.o_Group.text = "Basic";
break;
case "S" :
_root.o_GameOverlay.o_Group.text = "Standard";
break;
case "A" :
_root.o_GameOverlay.o_Group.text = "Advanced";
break;
case "E" :
_root.o_GameOverlay.o_Group.text = "Expert";
}
}
if (((_root.s_GameMode != "menu") && (_root.s_GameStyle != "survival")) && (!b_Instructions)) {
_root.f_CreateNeeded(_root.n_GamePercentNeeded, _root.n_ClicksAllowed);
} else if (_root.o_NeededAnim._name != undefined) {
_root.o_NeededAnim.removeMovieClip();
}
_root.b_MouseDown = false;
_root.f_Invulnerable(_root.s_GameMode != "menu");
if (_root.o_MList != undefined) {
Mouse.removeListener(_root.o_MList);
}
_root.o_MList = new Object();
if (_root.s_GameMode != "menu") {
_root.o_MList.onMouseDown = function () {
if (((!_root.b_Invulnerable) && (!_root.b_EndScreen)) && (!_root.b_Instructions)) {
_root.b_MouseDown = true;
}
};
_root.o_MList.onMouseUp = function () {
if ((((!_root.b_Invulnerable) && (!_root.b_EndScreen)) && (!_root.b_Instructions)) && (((_root.o_Clicks.length < _root.n_ClicksAllowed) && (_root.s_GameStyle != "survival")) || (_root.s_GameStyle == "survival"))) {
_root.b_MouseDown = false;
if (_root.s_GameStyle != "survival") {
_root.o_Clicks.push({_pops:0, _counts:[{_name:"s", _count:0}, {_name:"b", _count:0}, {_name:"e", _count:0}, {_name:"l", _count:0}, {_name:"c", _count:0}], _reported:false});
} else {
_root.n_SurvivalTotalClicks++;
_root.n_ClicksAllowed--;
}
_root.f_CollectInArea(((_root.s_GameStyle == "survival") ? 0 : (_root.o_Clicks.length)), _root.n_SelectorRange, true, _root.o_FriendObject);
}
};
_root.o_MList.onMouseMove = function () {
};
Mouse.addListener(_root.o_MList);
}
if (_root.o_KeyList != undefined) {
Key.removeListener(_root.o_KeyList);
}
_root.o_KeyList = new Object();
_root.o_KeyList.onKeyUp = function () {
if ((Key.getCode() == 77) || (Key.getCode() == 109)) {
_root.f_ToggleSounds();
}
if (_root.s_GameMode != "menu") {
if (Key.getCode() == 27) {
if (_root.s_GameStyle == "level") {
_root.f_EndGame(false);
} else {
_root.n_ClicksAllowed = 0;
_root.n_PlayerCollects = 0;
var _local2 = _root.o_Collects.length - 1;
while (_local2 >= 0) {
_root.o_Collects[_local2].removeMovieClip();
_local2--;
}
}
}
}
};
_root.o_KeyList.onKeyDown = function () {
};
Key.addListener(_root.o_KeyList);
_root.onEnterFrame = function () {
var _local19;
var _local18;
var _local9;
var _local23;
var _local66;
var _local58;
var _local2;
var _local6;
var _local37;
var _local30;
var _local76 = new Object({_x:_root.o_FriendObject._x, _y:_root.o_FriendObject._y});
var _local79;
var _local80;
var _local65;
var _local77;
var _local81 = 0;
var _local31;
var _local34;
var _local86;
var _local84;
var _local85;
var _local61;
var _local82;
var _local4;
var _local7;
var _local8;
var _local83;
var _local87;
var _local64;
var _local43 = false;
var _local44 = new Array();
var _local33 = new Array();
var _local51;
var _local45;
var _local5;
var _local11;
var _local12;
var _local13;
var _local14;
var _local56;
var _local57;
var _local15;
var _local10;
if ((_root.b_EndScreen || (_root.b_Paused)) || (_root.b_Instructions)) {
} else {
if (_root.o_Selector._width != (_root.n_SelectorRange * 2)) {
var _local78 = _root.o_Selector._width - (_root.n_SelectorRange * 2);
_root.o_Selector._width = _root.o_Selector._width - Math.floor(_local78 * 0.15);
_root.o_Selector._height = _root.o_Selector._width;
}
if (_root.s_GameMode != "menu") {
_root.o_GameOverlay.o_Score.text = _root.n_Score.toString();
if (_root.s_GameStyle == "level") {
_root.o_GameOverlay.o_BestScore.text = _root.o_Levels[_root.n_Level]._score.toString();
}
_local31 = _root.f_AngleToObject({_x:_root._xmouse, _y:_root._ymouse}, _root.o_FriendObject);
_local34 = _root.f_DistanceToObject({_x:_root._xmouse, _y:_root._ymouse}, _root.o_FriendObject);
} else {
n_SelectedX = _root.o_MenuPosition._x + _root.o_MenuOverlay.o_MenuScroller._x;
if ((n_SelectedX < 2) && (n_SelectedX > -2)) {
} else {
_root.o_MenuOverlay.o_MenuScroller._x = _root.o_MenuOverlay.o_MenuScroller._x - (n_SelectedX / 5);
}
if ((_root.o_AINearestTarget._name != undefined) && (_root.s_GameMode == "menu")) {
_local31 = _root.f_AngleToObject(_root.o_AINearestTarget, _root.o_FriendObject);
_local34 = _root.f_DistanceToObject(_root.o_AINearestTarget, _root.o_FriendObject) - (_root.o_AINearestTarget.n_Radius + 30);
if ((_local34 < n_SelectorRange) && (_root.d_AIIntervalLast.getTime() < (new Date().getTime() - _root.n_AIInterval))) {
_root.f_CollectInArea(0, _root.o_AINearestTarget.n_BlastRange, false, _root.o_AINearestTarget);
_root.d_AIIntervalLast = new Date();
}
}
}
if ((((_local31 != undefined) && (!isNaN(_local31))) && (_local34 != undefined)) && (!isNaN(_local34))) {
_root.f_ProjectObject(_root.o_FriendObject, _local31 + 180, _local34 * ((_root.s_GameMode == "menu") ? 0.1 : 0.4));
}
if (_root.o_FriendObject._y < (((_root.s_GameMode == "menu") ? 0 : (_root.n_TopBarHeight)) + _root.o_FriendObject.n_Radius)) {
_root.o_FriendObject._y = ((_root.s_GameMode == "menu") ? 0 : (_root.n_TopBarHeight)) + _root.o_FriendObject.n_Radius;
}
_root.o_MessagesContainer._x = (_root.o_Selector._x = _root.o_FriendObject._x);
_root.o_MessagesContainer._y = (_root.o_Selector._y = _root.o_FriendObject._y);
_local77 = new Object({_x:_root._xmouse, _y:_root._ymouse});
_local79 = _root.f_AngleToObject(_local76, _local77);
_local80 = _root.f_DistanceToObject(_local77, _local76);
_root.o_FriendObject.o_VelocityObject = _root.f_CalculateProjection(_local79, _local80);
_root.o_Backlight.o_Light._x = _root.o_FriendObject._x;
_root.o_Backlight.o_Light._y = _root.o_FriendObject._y;
_root.o_MainLight._x = _root.o_FriendObject._x;
_root.o_MainLight._y = _root.o_FriendObject._y;
_root.o_Backlight.o_Light._rotation = _root.o_Backlight.o_Light._rotation + 2;
if (_root.o_Backlight.o_Light._rotation > 360) {
_root.o_Backlight.o_Light._rotation = _root.o_Backlight.o_Light._rotation - 360;
}
if (_root.b_GameOut) {
_root.o_ShadowContainer._alpha = _root.o_ShadowContainer._alpha - _root.n_FadeOutShadowSpeed;
}
var _local47 = _root.o_Explosions.length - 1;
while (_local47 >= 0) {
o_Explosion = _root.o_Explosions[_local47];
if (o_Explosion._alpha <= 0) {
_root.o_Explosions.splice(_local47, 1);
o_Explosion.removeMovieClip();
} else {
o_Explosion._alpha = o_Explosion._alpha - _root.n_ExplosionFade;
}
_local47--;
}
if (_root.s_GameMode != "menu") {
var _local40 = _root.o_Collects.length - 1;
while (_local40 >= 0) {
_local5 = _root.o_Collects[_local40];
_local5.n_Timer++;
if ((_local5.n_Timer <= n_CollectFrames) && (_local5._alpha > 0)) {
if (_local5.n_Timer >= (n_CollectFrames - 10)) {
_local5._alpha = _local5._alpha - 10;
}
if ((_local5.o_VelocityObject.n_xvel + _local5.o_VelocityObject.n_yvel) > 1) {
_local5.o_VelocityObject.n_xvel = _local5.o_VelocityObject.n_xvel * _root.n_ViscocityMulti;
_local5.o_VelocityObject.n_yvel = _local5.o_VelocityObject.n_yvel * _root.n_ViscocityMulti;
_local5._x = _local5._x + _local5.o_VelocityObject.n_xvel;
_local5._y = _local5._y + _local5.o_VelocityObject.n_yvel;
if (_local5._x > (_root.n_GameWidth - _local5.n_Radius)) {
_local5._x = _root.n_GameWidth - _local5.n_Radius;
_local5.o_VelocityObject.n_xvel = _local5.o_VelocityObject.n_xvel * -1;
}
if (_local5._x < _local5.n_Radius) {
_local5._x = _local9;
_local5.o_VelocityObject.n_xvel = _local5.o_VelocityObject.n_xvel * -1;
}
if (_local5._y > (_root.n_GameHeight - _local5.n_Radius)) {
_local5._y = _root.n_GameHeight - _local9;
_local5.o_VelocityObject.n_yvel = _local5.o_VelocityObject.n_yvel * -1;
}
if (_local5._y < (_local5.n_Radius + ((_root.s_GameMode == "menu") ? 0 : (_root.n_TopBarHeight)))) {
_local5._y = _local9 + ((_root.s_GameMode == "menu") ? 0 : (_root.n_TopBarHeight));
_local5.o_VelocityObject.n_yvel = _local5.o_VelocityObject.n_yvel * -1;
}
}
_local19 = _root.f_DistanceToObject(_root.o_FriendObject, _local5, false);
if ((_local19 - _local5.n_Radius) < _root.n_SelectorRange) {
_root.f_PlaySound("o_Sounds", "collect");
_root.o_Collects.splice(_local40, 1);
_root.o_EffectsContainer.attachMovie("Collect_Anim", "o_CollectAnim_" + _root.o_EffectsContainer.getNextHighestDepth(), _root.o_EffectsContainer.getNextHighestDepth(), {_x:_local5._x, _y:_local5._y});
_root.n_PlayerCollects++;
_root.n_SurvivalTotalCollects++;
_local5.removeMovieClip();
if (_root.s_GameMode != "menu") {
if (_root.n_AchievementCollects == undefined) {
_root.n_AchievementCollects = 0;
}
if (_root.n_AchievementCollects < _root.n_AchievementCap) {
_root.n_AchievementCollects++;
switch (_root.n_AchievementCollects) {
case 50 :
case 500 :
case 5000 :
_root.f_MarkAchievement("Part_" + _root.n_AchievementCollects);
}
}
}
}
} else {
_root.o_Collects.splice(_local40, 1);
_local5.removeMovieClip();
}
_local40--;
}
}
_root.b_Hit = false;
_root.o_AINearestTarget = undefined;
_root.o_AIFriendPush = {n_xvel:0, n_yvel:0};
_local64 = 9999;
var _local54 = _root.o_Objects.length - 1;
while (_local54 >= 0) {
_local2 = _root.o_Objects[_local54];
if (_local2._name != undefined) {
_local9 = _local2.n_Radius;
if (_local2.n_InvulTimer > 0) {
_local2.n_InvulTimer--;
}
if (_local2.n_Type == _root.n_BallKiller) {
_local2._alpha = _local2._alpha - _root.n_BallKillerFade;
_root.o_ShadowContainer[_local2._name]._alpha = _local2._alpha;
}
if (_local2._alpha <= 0) {
_local33 = _root.f_PushObjectToArray(_local33, _local2);
} else if (_local2._alpha > 0) {
_local30 = new Object({_x:_local2._x - 100, _y:_local2._y - 100, _x2:_local2._x + 100, y2:_local2._y + 100});
if (_local2._name != o_FriendObject._name) {
if (_local2.b_EnteredField) {
_local61 = new Object({n_xvel:_local2.o_VelocityObject.n_xvel, n_yvel:_local2.o_VelocityObject.n_yvel});
_local2.o_VelocityObject.n_xvel = _local61.n_xvel;
_local2.o_VelocityObject.n_yvel = _local61.n_yvel;
} else {
_local2.o_VelocityObject = _root.f_CalculateProjection(_root.f_AngleToObject(_local2, {_x:_root.n_GameWidth / 2, _y:_root.n_GameHeight / 2}), _local2.n_Velocity);
}
_local2._x = _local2._x + _local2.o_VelocityObject.n_xvel;
_local2._y = _local2._y + _local2.o_VelocityObject.n_yvel;
}
if (_local2.b_EnteredField) {
_local43 = false;
if (_local2._x > (_root.n_GameWidth - _local9)) {
_local2._x = _root.n_GameWidth - _local9;
_local2.o_VelocityObject.n_xvel = _local2.o_VelocityObject.n_xvel * -1;
_local43 = true;
}
if (_local2._x < _local9) {
_local2._x = _local9;
_local2.o_VelocityObject.n_xvel = _local2.o_VelocityObject.n_xvel * -1;
_local43 = true;
}
if (_local2._y > (_root.n_GameHeight - _local9)) {
_local2._y = _root.n_GameHeight - _local9;
_local2.o_VelocityObject.n_yvel = _local2.o_VelocityObject.n_yvel * -1;
_local43 = true;
}
if (_local2._y < (_local9 + ((_root.s_GameMode == "menu") ? 0 : (_root.n_TopBarHeight)))) {
_local2._y = _local9 + ((_root.s_GameMode == "menu") ? 0 : _root.n_TopBarHeight);
_local2.o_VelocityObject.n_yvel = _local2.o_VelocityObject.n_yvel * -1;
_local43 = true;
}
if (_local43) {
}
} else if ((((_local2._x < (_root.n_GameWidth - _local9)) && (_local2._x > _local9)) && (_local2._y < (_root.n_GameHeight - _local9))) && (_local2._y > (_local9 + ((_root.s_GameMode == "menu") ? 0 : _root.n_TopBarHeight)))) {
_local2.b_EnteredField = true;
}
if ((_local2._name == o_FriendObject._name) && (_root.o_EffectsContainer.o_StartLevelAnim._name != undefined)) {
_root.o_EffectsContainer.o_StartLevelAnim._x = _local2._x;
_root.o_EffectsContainer.o_StartLevelAnim._y = _local2._y;
}
var _local27 = _root.o_Objects.length - 1;
while (_local27 >= 0) {
_local6 = _root.o_Objects[_local27];
if ((((((((_local6._name != _local2._name) && (_local6._name != undefined)) && (_local30._x <= _local2._x)) && (_local30._x2 >= _local2._x)) && (_local30._y <= _local2._y)) && (_local30._y2 >= _local2._y)) && (_local2._name != undefined)) && (_local6._name != undefined)) {
_local23 = _local6.n_Radius;
_local18 = _root.f_DistanceToObject(_local2, _local6, false);
_local58 = _root.f_AngleToObject(_local2, _local6);
if ((_root.o_FriendObject._name == _local2._name) && (_root.s_GameMode == "menu")) {
if (_local18 < ((_local2.n_Radius + _local6.n_Radius) + 30)) {
_local65 = _root.f_CalculateProjection(_local58, _local18 - ((_local2.n_Radius + _local6.n_Radius) * 0.33));
}
}
if (((_local18 <= (_local23 + _local9)) && (_local2._name != _root.o_FriendObject._name)) && (_local6._name != _root.o_FriendObject._name)) {
var _local24 = ((_local2.n_Type != _root.n_BallKiller) ? _local2 : _local6);
var _local35 = ((_local2.n_Type != _root.n_BallKiller) ? _local6 : _local2);
if (((_local35.n_Type == _root.n_BallKiller) && (_local24.n_Type != _root.n_BallKiller)) && (_local24.n_MaxHealth != -1)) {
_root.f_ActivateBall(_local24, _local35.n_ClickID);
}
if ((_local2._name != undefined) && (_local6._name != undefined)) {
_root.f_ManageBounce(_local2, _local6);
if (_local18 < (_local23 + _local9)) {
if (_local6._name == _root.o_FriendObject._name) {
_root.f_ProjectObject(_local2, _root.f_AngleToObject(_local6, _local2), (_local23 + _local9) - _local18);
} else {
_root.f_ProjectObject(_local6, _root.f_AngleToObject(_local2, _local6), (_local23 + _local9) - _local18);
}
}
}
}
}
_local27--;
}
if (_root.o_FriendObject._name != _local2._name) {
_local37 = _root.o_ShadowContainer[_local2._name];
_local66 = _root.f_AngleToObject(_local2, _root.o_FriendObject);
_local19 = _root.f_DistanceToObject(_root.o_FriendObject, _local2);
if (_local19 < _local64) {
_root.o_AINearestTarget = _local2;
_local64 = _local19;
}
if ((_local19 > 150) || (_local2.n_Size <= 30)) {
_local2.o_Light._visible = false;
} else {
_local2.o_Light._visible = true;
_local2.o_Light._alpha = 150 - _local19;
_local2.o_Light._rotation = _local66;
}
_local31 = _root.f_AngleToObject(_local2, _root.o_FriendObject);
_local34 = _root.f_DistanceToObject(_local2, _root.o_FriendObject);
if (_local37._name != undefined) {
_local37._x = _local2._x;
_local37._y = _local2._y;
_local37.o_Graphics._rotation = _local31;
_local37.o_Graphics._x = 0;
_local37.o_Graphics._y = 0;
}
}
if (((((_local2.n_Health <= 0) && (_local2.n_MaxHealth != -1)) && (_local2.n_Type != 1)) && (_local2.n_Type != 0)) && (_local2.n_InvulTimer <= 0)) {
if (_local2.b_ExplodeActivated) {
if (_local2.n_ExplodeDelay > 0) {
_local2.n_ExplodeDelay--;
} else {
_local44 = _root.f_PushObjectToArray(_local44, _local2);
}
} else {
_local2.b_ExplodeActivated = true;
_local2.n_ExplodeDelay = _root.n_ExplodeDelayLower + Math.floor(Math.random() * (_root.n_ExplodeDelayUpper - _root.n_ExplodeDelayLower));
}
}
}
if (_root.b_GameOut && (_local2._name != _root.o_FriendObject._name)) {
_local2._alpha = _local2._alpha - _root.n_FadeOutSpeed;
_root.o_ShadowContainer[_local2._name]._alpha = _local2._alpha;
if (_local2._alpha <= 0) {
_local33 = _root.f_PushObjectToArray(_local33, _local2);
}
}
}
_local54--;
}
var _local38 = _root.o_Vortexes.length - 1;
while (_local38 >= 0) {
_local15 = _root.o_Vortexes[_local38];
if (_local15._name != undefined) {
var _local42 = 0;
while (_local42 < _root.o_Objects.length) {
_local10 = _root.o_Objects[_local42];
if (((_local10.n_Type > _root.o_ObjectLowerEnd) && (_local10.n_InvulTimer <= 0)) && (_local10.n_MaxHealth != -1)) {
_local19 = _root.f_DistanceToObject(_local15, _local10) - _local10.n_Radius;
if (_local19 <= _local15.n_Radius) {
_local57 = (_root.n_VortexDamage / _local15.n_Radius) * (_local15.n_Radius - _local19);
_local10.n_Health = _local10.n_Health - _local57;
if (_local10.n_Health < 0) {
_local10.n_Health = 0;
}
}
}
_local42++;
}
_local15.n_Timer++;
if ((_local15.n_Timer >= (_root.n_VortexLength - 20)) && (_local15.n_Timer < _root.n_VortexLength)) {
_local15._alpha = _local15._alpha - 5;
} else if (_local15.n_Timer == _root.n_VortexLength) {
_local15.removeMovieClip();
_root.o_Vortexes.splice(_local38, 1);
}
} else {
_local15.removeMovieClip();
_root.o_Vortexes.splice(_local38, 1);
}
_local38--;
}
var _local41 = _root.o_Lightenings.length - 1;
while (_local41 >= 0) {
_local4 = _root.o_Lightenings[_local41];
if (_local4.o_Ball._name != undefined) {
_local4._x = _local4.o_Ball._x;
_local4._y = _local4.o_Ball._y;
_local56 = (_root.n_LighteningDamage / _root.n_LighteningLength) * (_root.n_LighteningLength - _local4.n_Timer);
if (_local4.n_Timer < _root.n_LighteningLength) {
var _local26 = 0;
while (_local26 < _local4.o_Items.length) {
switch (Math.floor(_local4.o_Items[_local26]._rotation)) {
case 0 :
_local11 = _local4.o_Ball._x - (_root.n_LighteningWidth / 2);
_local12 = 0;
_local13 = _local4.o_Ball._x + (_root.n_LighteningWidth / 2);
_local14 = _local4.o_Ball._y;
break;
case 90 :
_local11 = _local4.o_Ball._x;
_local12 = _local4.o_Ball._y - (_root.n_LighteningWidth / 2);
_local13 = _root.n_GameWidth;
_local14 = _local4.o_Ball._y + (_root.n_LighteningWidth / 2);
break;
case 180 :
_local11 = _local4.o_Ball._x - (_root.n_LighteningWidth / 2);
_local12 = _local4.o_Ball._y;
_local13 = _local4.o_Ball._x + (_root.n_LighteningWidth / 2);
_local14 = _root.n_GameHeight;
break;
case 270 :
case -90 :
_local11 = 0;
_local12 = _local4.o_Ball._y - (_root.n_LighteningWidth / 2);
_local13 = _local4.o_Ball._x;
_local14 = _local4.o_Ball._y + (_root.n_LighteningWidth / 2);
}
var _local17 = _root.o_Objects.length - 1;
while (_local17 >= 0) {
_local2 = _root.o_Objects[_local17];
if (((((_local2.n_Type > _root.o_ObjectLowerEnd) && (_local2.n_InvulTimer <= 0)) && (_local2.n_Health != -1)) && ((((_local2._x >= _local11) && (_local2._x <= _local13)) || ((_local11 >= (_local2._x - _local2.n_Radius)) && (_local11 <= (_local2._x + _local2.n_Radius)))) || ((_local13 >= (_local2._x - _local2.n_Radius)) && (_local13 <= (_local2._x + _local2.n_Radius))))) && ((((_local2._y >= _local12) && (_local2._y <= _local14)) || ((_local12 >= (_local2._y - _local2.n_Radius)) && (_local12 <= (_local2._y + _local2.n_Radius)))) || ((_local14 >= (_local2._y - _local2.n_Radius)) && (_local14 <= (_local2._y + _local2.n_Radius))))) {
if (Math.random() < _root.n_LighteningChance) {
var _local32 = _root.f_DistanceToObject(_local2, _local4.o_Ball);
var _local20 = 1 - ((1 / (_local4.o_Ball.n_Radius * _root.n_LighteningMultiplier)) * _local32);
if (_local20 > 0) {
_local2.n_Health = _local2.n_Health - (_local56 * _local20);
if (_local2.n_Health <= 0) {
_local2.n_Health = 0;
_root.f_ActivateBall(_local2, _local4.o_Ball.n_ClickID);
}
}
}
}
_local17--;
}
_local26++;
}
_local4.n_Timer++;
} else {
_local4.o_Ball.n_Health = (_local4.o_Ball.n_MaxHealth = 0);
_local4.removeMovieClip();
_root.o_Lightenings.splice(_local41, 1);
}
} else {
_local4.removeMovieClip();
_root.o_Lightenings.splice(_local41, 1);
}
_local41--;
}
var _local42 = _root.o_Beams.length - 1;
while (_local42 >= 0) {
_local7 = _root.o_Beams[_local42];
if (_local7.o_Ball._name != undefined) {
_local7._x = _local7.o_Ball._x;
_local7._y = _local7.o_Ball._y;
if ((_local7.n_Timer < _root.n_BeamLength) && (_local7.o_Items.length != 0)) {
var _local16 = _local7.o_Items.length - 1;
while (_local16 >= 0) {
_local2 = _local7.o_Items[_local16]._ball;
_local8 = _local7.o_Items[_local16]._beam;
if ((_local2._name != undefined) && (_local2.n_InvulTimer <= 0)) {
_local8._visible = true;
_local31 = _root.f_AngleToObject(_local7.o_Ball, _local2);
_local34 = _root.f_DistanceToObject(_local7.o_Ball, _local2);
_local8._x = (_local8._y = 0);
var _local21 = 1 - ((1 / ((_local2.n_Radius * _root.n_BeamMulti) + _root.n_BeamRange)) * _local34);
var _local49 = ((_local21 < 0) ? 0 : (_root.n_BeamDamage * _local21));
_root.f_ProjectObject(_local8, _local31, _local7.o_Ball.n_Radius);
_local8._rotation = _local31;
_local8.o_Main._height = (_local34 - _local2.n_Radius) - _local7.o_Ball.n_Radius;
_local8.o_Top._y = _local8.o_Main._height * -1;
_local8._alpha = ((_local21 < 0) ? 0 : (50 + (_local21 * 50)));
if (Math.random() < _root.n_BeamChance) {
_local2.n_Health = _local2.n_Health - _local49;
if (_local2.n_Health <= 0) {
_local8.removeMovieClip();
_root.f_ActivateBall(_local2, _local7.o_Ball.n_ClickID);
_local7.o_Items.splice(_local16, 1);
}
}
} else {
_local8.removeMovieClip();
o_Beams.o_Items.splice(_local16, 1);
}
_local16--;
}
_local7.n_Timer++;
} else {
_local7.o_Ball.n_Health = (_local7.o_Ball.n_MaxHealth = 0);
_local7.removeMovieClip();
_root.o_Beams.splice(_local42, 1);
}
} else {
_local7.removeMovieClip();
_root.o_Beams.splice(_local42, 1);
}
_local42--;
}
if (_root.s_GameStyle == "survival") {
if (_root.n_PlayerCollects >= _root.n_SurvivalBallsForClick) {
_root.n_ClicksAllowed++;
_root.n_PlayerCollects = _root.n_PlayerCollects - _root.n_SurvivalBallsForClick;
_root.f_PlaySound("o_Sounds", "clickup");
_root.f_ShowMessage("+1 Click Earned!", false);
if (_root.n_ClicksAllowed == 6) {
_root.f_MarkAchievement("Click_6");
}
if (_root.n_ClicksAllowed == 9) {
_root.f_MarkAchievement("Click_9");
}
if (_root.n_ClicksAllowed == 12) {
_root.f_MarkAchievement("Click_12");
}
}
}
var _local73 = 0;
var _local3;
_root.b_BallsActive = false;
_root.b_KillersActive = false;
var _local53 = _root.o_Objects.length - 1;
while (_local53 >= 0) {
_local51 = false;
_local45 = false;
_local3 = _root.o_Objects[_local53];
var _local28 = 0;
while (_local28 < _local44.length) {
if (_local44[_local28]._name == _local3._name) {
_local45 = true;
}
_local28++;
}
var _local25 = 0;
while (_local25 < _local33.length) {
if (_local33[_local25]._name == _local3._name) {
_local51 = true;
}
_local25++;
}
if (_local45) {
_root.f_CollectInArea(_local3.n_ClickID, _local3.n_BlastRange, false, _local3);
_local51 = true;
}
if (_local51) {
if (_local45) {
_root.n_Score = _root.n_Score + _root.o_BallTypes[_local3.n_Type]._score;
}
if ((((_local3.n_ClickID > 0) && (_local3.n_ClickID != undefined)) || (_root.s_GameStyle == "survival")) && (_local3.n_Type > _root.o_ObjectLowerEnd)) {
if (_root.s_GameMode != "menu") {
var _local55 = _root.o_BallTypes[_local3.n_Type]._mincollects;
var _local63 = _root.o_BallTypes[_local3.n_Type]._maxcollects;
var _local59 = ((_root.s_GameStyle == "survival") ? (_local55) : (_local55 + Math.floor((_local63 - _local55) * Math.random())));
var _local36 = 0;
while (_local36 < _local59) {
_root.f_CreateCollect(_local3.n_ClickID, _local3._x, _local3._y, 360 * Math.random());
_local36++;
}
}
if (_root.s_GameStyle == "survival") {
_root.n_SurvivalBallsPopped++;
} else {
_root.o_Clicks[_local3.n_ClickID - 1]._pops++;
var _local29 = 0;
while (_local29 < _root.o_Clicks[_local3.n_ClickID - 1]._counts.length) {
if (_root.o_Clicks[_local3.n_ClickID - 1]._counts[_local29]._name == _root.o_BallTypes[_local3.n_Type]._group) {
_root.o_Clicks[_local3.n_ClickID - 1]._counts[_local29]._count++;
}
_local29++;
}
}
if (_root.s_GameMode != "menu") {
if (_root.n_AchievementBalls == undefined) {
_root.n_AchievementBalls = 0;
}
if (_root.n_AchievementBalls < _root.n_AchievementCap) {
_root.n_AchievementBalls++;
}
}
}
if (_local45) {
var _local48;
var _local60;
var _local50 = 0;
var _local46 = -1;
var _local74;
if (_local3.b_Breeder) {
_local50 = _local3.n_OrigionalSize / 2;
_local46 = _local3.n_Type;
}
if ((_local50 >= 20) && (_local46 != -1)) {
_local48 = _root.f_CreateBall(_local46, _local3._x, _local3._y, _local50, true, _local3.n_VelocityMaximum);
_root.o_Objects.push(_local48);
_local48.n_InvulTimer = _Root.n_BallInvulFrames;
_local48.o_VelocityObject = _root.f_CalculateProjection(-45 + _root.f_AngleToObject({_x:0, _y:0}, {_x:_local3.o_VelocityObject.n_xvel, _y:_local3.o_VelocityObject.n_yvel}), _local3.n_VelocityMaximum / 2);
_root.n_ObjectsAtStart++;
_local60 = _root.f_CreateBall(_local46, _local3._x, _local3._y, _local50, true, _local3.n_VelocityMaximum);
_root.o_Objects.push(_local60);
_local48.n_InvulTimer = _Root.n_BallInvulFrames;
_local60.o_VelocityObject = _root.f_CalculateProjection(45 + _root.f_AngleToObject({_x:0, _y:0}, {_x:_local3.o_VelocityObject.n_xvel, _y:_local3.o_VelocityObject.n_yvel}), _local3.n_VelocityMaximum / 2);
_root.n_ObjectsAtStart++;
}
}
_root.f_RemoveBall(_local3);
} else {
if ((_local3.n_MaxHealth != -1) && (_local3.n_Health < _local3.n_MaxHealth)) {
_local3.o_Progress._visible = true;
_local3.o_Progress.gotoAndStop(Math.ceil((100 / _local3.n_MaxHealth) * _local3.n_Health));
}
if (_local3.n_Type > _root.o_ObjectLowerEnd) {
_local73++;
if (_local3.b_Activated) {
_root.b_BallsActive = true;
}
} else if (_local3.n_Type == _root.n_BallKiller) {
_root.b_KillersActive = true;
}
}
_local53--;
}
if (((!_root.b_GameOut) && (!_root.b_GameOver)) && (!_root.b_EndScreen)) {
_root.n_GamePercent = 100 - Math.floor((100 / _root.n_OrigionalBalls) * _local73);
}
if (((((!_root.b_BallsActive) && (!_root.b_KillersActive)) && (_root.s_GameStyle != "survival")) && (_root.s_GameMode != "menu")) && (_root.o_Clicks.length > 0)) {
var _local22 = 0;
while (_local22 < _root.o_Clicks.length) {
if (!_root.o_Clicks[_local22]._reported) {
var _local62 = 10 * Math.floor((10 / _root.n_ObjectsAtStart) * _root.o_Clicks[_local22]._pops);
var _local52 = _root.o_Levels[_root.n_Level]._group;
_root.o_Clicks[_local22]._reported = true;
var _local39 = 0;
var _local29 = 0;
while (_local29 < _root.o_Clicks[_local22]._counts.length) {
_local39 = _local39 + ((_root.o_Clicks[_local22]._counts[_local29]._count > 0) ? 1 : 0);
_local29++;
}
if ((_local39 >= 3) && (_local39 <= 5)) {
_root.f_MarkAchievement("Combo_" + _local39.toString());
}
if (_root.n_AchievementBalls >= 50) {
_root.f_MarkAchievement("Atoms_50");
}
if (_root.n_AchievementBalls >= 500) {
_root.f_MarkAchievement("Atoms_500");
}
if (_root.n_AchievementBalls >= 5000) {
_root.f_MarkAchievement("Atoms_5000");
}
switch (_local62) {
case 50 :
case 60 :
_root.f_MarkAchievement(_local52 + "_50Shot");
break;
case 70 :
case 80 :
_root.f_MarkAchievement(_local52 + "_70Shot");
break;
case 90 :
case 100 :
_root.f_MarkAchievement(_local52 + "_90Shot");
}
}
_local22++;
}
}
if ((((((_root.n_ClicksOnWin == -1) && (_root.n_GamePercent >= _root.n_GamePercentNeeded)) && (!_root.b_BallsActive)) && (!_root.b_KillersActive)) && (_root.s_GameStyle != "survival")) && (_root.s_GameMode != "menu")) {
_root.n_ClicksOnWin = _root.n_ClicksAllowed - _root.o_Clicks.length;
if (_root.n_ClicksOnWin > 0) {
_root.f_ShowMessage("Well Done!", false);
_root.f_ShowMessage(((_root.n_ClicksOnWin.toString() + " click") + ((_root.n_ClicksOnWin > 1) ? "s" : "")) + " left to clear up!", false);
}
_root.f_MarkAchievement(((_root.o_Levels[_root.n_Level]._group + "_") + _root.o_Clicks.length.toString()) + "CF");
}
if (_root.s_GameStyle == "survival") {
_root.n_SurvivalLast++;
}
if ((((((((_root.s_GameStyle == "survival") && (!_root.b_BallsActive)) && (!_root.b_KillersActive)) && (!_root.b_GameOver)) && (!_root.b_GameOut)) && (_root.n_SurvivalLast >= _root.n_SurvivalDelay)) && (_root.o_Vortexes.length == 0)) && ((_root.o_Objects.length - 1) < _root.n_SurvivalBallsStart)) {
n_BallType = _root.f_SurvivalType();
n_BallSize = _root.f_SurvivalSize(n_BallType);
o_EnemyBall = _root.f_CreateBall(n_BallType, _root.n_GameWidth / 2, _root.n_GameHeight / 2, n_BallSize, false, -1);
_root.o_Objects.push(o_EnemyBall);
_root.n_SurvivalLast = 0;
}
if (!_root.b_GameOver) {
if (_root.s_GameStyle == "survival") {
if (((((_root.o_Collects.length == 0) && (_root.n_ClicksAllowed <= 0)) && (!_root.b_BallsActive)) && (!_root.b_KillersActive)) && (_root.o_Vortexes.length == 0)) {
_root.b_GameOver = true;
_root.b_GameWin = false;
}
} else if (((_root.o_Objects.length == 1) || (((((_root.o_Clicks.length == _root.n_ClicksAllowed) && (_root.n_GamePercent >= _root.n_GamePercentNeeded)) && (!_root.b_BallsActive)) && (!_root.b_KillersActive)) && (_root.o_Vortexes.length == 0))) || ((_root.s_GameMode == "menu") && (_root.n_GamePercent >= 50))) {
_root.s_GameOverText = "Level Up!";
_root.b_GameOver = true;
_root.b_GameWin = true;
} else if (((((_root.o_Clicks.length == _root.n_ClicksAllowed) && (_root.o_Objects.length > 1)) && (!_root.b_BallsActive)) && (!_root.b_KillersActive)) && (_root.o_Vortexes.length == 0)) {
_root.s_GameOverText = "Ran Out Of Clicks!";
_root.b_GameOver = true;
_root.b_GameWin = false;
}
if (_root.b_GameOver) {
_root.b_GameOut = true;
}
} else if (_root.b_GameOver && (!_root.b_GameOut)) {
} else if (_root.b_GameOver && (_root.b_GameOut)) {
if (((_root.o_Objects.length == 1) && (_root.o_Objects[0]._name == _root.o_FriendObject._name)) || (_root.s_GameStyle == "survival")) {
if (_root.s_GameMode == "menu") {
_root.f_StartGame("menu", 1, "level");
} else if (_root.b_GameWin || (_root.s_GameStyle == "survival")) {
if (_root.s_GameStyle == "survival") {
} else {
if (((_root.n_ClicksAllowed - _root.n_ClicksOnWin) >= 1) && ((_root.n_ClicksAllowed - _root.n_ClicksOnWin) <= 3)) {
_root.f_MarkAchievement((_root.n_ClicksAllowed - _root.n_ClicksOnWin).toString() + "CF");
}
_root.o_Levels[_root.n_Level]._completed = true;
_root.n_LevelStars = 1;
if (_root.o_Levels[_root.n_Level]._stars < _root.n_LevelStars) {
_root.o_Levels[_root.n_Level]._stars = _root.n_LevelStars;
}
_root.f_StoreLevelData();
}
_root.f_CleanUp(false);
_root.b_EndScreen = true;
var _local75 = _root.o_EndScreen;
_local75._x = _root.n_GameWidth / 2;
_local75._y = _root.n_GameHeight / 2;
if ((_root.n_Level == (_root.o_Levels.length - 1)) && (_root.s_GameStyle != "survival")) {
_local75.gotoAndPlay("GameWin");
} else {
_local75.gotoAndPlay("Win" + ((_root.s_GameStyle == "survival") ? "Survival" : ""));
}
} else {
if (_root.s_GameMode != "menu") {
_root.f_ShowMessage(_root.s_GameOverText, true);
_root.f_ShowMessage("Let's Try Again!", false);
_root.f_StoreLevelData();
}
_root.f_StartGame(_root.s_GameMode, Number(_root.n_Level), _root.s_GameStyle);
}
}
}
if (_root.s_GameMode != "menu") {
_root.o_GameOverlay.o_Collected.text = _root.n_PlayerCollects.toString();
if (_root.s_GameStyle == "survival") {
_root.o_GameOverlay.o_Clicks.text = _root.n_ClicksAllowed;
} else {
_root.o_GameOverlay.o_Needed.text = _root.n_GamePercentNeeded.toString() + "%";
_root.o_GameOverlay.o_Percent.text = _root.n_GamePercent.toString() + "%";
_root.o_GameOverlay.o_Clicks.text = _root.n_ClicksAllowed - _root.o_Clicks.length;
}
}
}
_root.f_DoMessages();
_root.f_DoAchievements();
_root.gotoAndPlay("game");
};
_root.b_Setup = true;
}
function f_SetBallSize(o_Ball, n_NewSize) {
var _local4 = ((o_Ball.n_Type == 0) ? 100 : (100 * (n_NewSize / 40)));
var _local3 = _root.o_ShadowContainer[o_Ball._name];
o_Ball.n_Size = ((o_Ball.n_Type == 0) ? 5 : (n_NewSize));
o_Ball.n_OrigionalSize = o_Ball.n_Size;
o_Ball.n_Radius = n_NewSize / 2;
o_Ball.n_OrigionalRadius = o_Ball.n_Radius;
if (o_Ball.n_Type != 0) {
o_Ball._xscale = _local4;
o_Ball._yscale = _local4;
if (_local3._name != undefined) {
_local3.n_Size = o_Ball.n_Size;
_local3.n_Radius = o_Ball.n_Radius;
_local3._xscale = _local4;
_local3._yscale = _local4;
}
}
}
function f_RemoveBall(o_Ball) {
var _local2 = _root.o_Objects.length - 1;
while (_local2 >= 0) {
if (_root.o_Objects[_local2]._name == o_Ball._name) {
_root.o_Objects.splice(_local2, 1);
_root.o_ShadowContainer[o_Ball._name].removeMovieClip();
o_Ball.removeMovieClip();
}
_local2--;
}
}
function f_CreateNeeded(n_Perc, n_Clicks) {
if (_root.o_NeededAnim._name != undefined) {
_root.o_NeededAnim.removeMovieClip();
}
_root.o_NeededAnim = _root.attachMovie("NeededAnim", "o_NeededAnim_" + _root.getNextHighestDepth(), _root.getNextHighestDepth(), {_x:0, _y:_root.n_NeededY});
_root.o_NeededAnim.o_Show.o_Percent.text = _root.n_GamePercentNeeded.toString() + "%";
_root.o_NeededAnim.o_Show.o_Clicks.text = _root.n_ClicksAllowed.toString();
_root.o_NeededAnim.gotoAndPlay(1);
}
function f_CreateCollect(n_ClickID, n_X, n_Y, n_Angle) {
var _local2;
if (_root.o_Collects.length < _root.n_CollectsMax) {
_local2 = _root.o_CollectContainer.attachMovie("Collect", "o_Collect_" + _root.o_CollectContainer.getNextHighestDepth(), _root.o_CollectContainer.getNextHighestDepth(), {_x:n_X, _y:n_Y});
_local2.n_ClickID = n_ClickID;
_local2.o_VelocityObject = _root.f_CalculateProjection(n_Angle, 10);
_local2.n_Size = 18;
_local2.n_Radius = 9;
_local2.n_Timer = 0;
_local2.cacheAsBitmap = true;
_root.o_Collects.push(_local2);
}
}
function f_SurvivalType() {
var _local2 = (_root.o_ObjectLowerEnd + Math.floor(Math.random() * (_root.o_BallTypes.length - _root.o_ObjectLowerEnd))) + 1;
if (_local2 > (_root.o_BallTypes.length - 1)) {
_local2 = _root.o_ObjectLowerEnd + 1;
}
return(_local2);
}
function f_SurvivalSize(n_Type) {
var _local3 = -1;
var _local4 = _root.o_SurvivalBallSizes.length - 1;
var _local2 = 0;
while (_local2 < _root.o_SurvivalBallSizes.length) {
if ((_root.n_SurvivalBallsPopped >= _root.o_SurvivalBallSizes[_local2]._countlower) && (_root.n_SurvivalBallsPopped < _root.o_SurvivalBallSizes[_local2]._countupper)) {
_local3 = _root.o_SurvivalBallSizes[_local2]._sizelower + Math.floor(Math.random() * (_root.o_SurvivalBallSizes[_local2]._sizeupper - _root.o_SurvivalBallSizes[_local2]._sizelower));
}
_local2++;
}
if (_local3 == -1) {
_local3 = _root.o_SurvivalBallSizes[_local4]._sizelower + Math.floor(Math.random() * (_root.o_SurvivalBallSizes[_local4]._sizeupper - _root.o_SurvivalBallSizes[_local4]._sizelower));
}
return(_local3);
}
function f_MakeBallBreeder(o_Ball) {
o_Ball.b_Breeder = true;
o_Ball.o_Number._visible = true;
o_Ball.o_Number.text = "+";
}
function f_CreateBall(n_Type, n_X, n_Y, n_Size, b_EnteredField, n_MaxVel) {
var _local2;
var _local6;
var _local7 = 0;
var _local4 = 0;
_local2 = _root.o_ObjectContainer.attachMovie("Ball", "o_Ball_" + _root.o_ObjectContainer.getNextHighestDepth(), _root.o_ObjectContainer.getNextHighestDepth(), {_x:n_X, _y:n_Y});
_local2.n_Type = n_Type;
_local2.b_MinVelocitySet = true;
_local2.n_VelocityMaximum = ((n_MaxVel == -1) ? (_root.o_BallTypes[_local2.n_Type]._maxvel) : (n_MaxVel));
_local2.b_Activated = false;
_local2.n_ExplodeDelay = 0;
_local2.n_BlastRange = _root.o_BallTypes[_local2.n_Type]._explodeamp * (n_Size / 2);
_local2.b_Breeder = false;
_local2.n_InvulTimer = 0;
_local2.b_EnteredField = b_EnteredField;
if (!b_EnteredField) {
_local7 = 360 * Math.random();
_root.f_ProjectObject(_local2, _local7, 350);
}
_local2.n_EnterOffset = (b_EnteredField ? 0 : (45 - (Math.random() * 90)));
_local2.o_Graphics.gotoAndStop(_root.o_BallTypes[n_Type]._graphic);
_local2.o_Light.gotoAndStop((_root.b_Invulnerable ? "invulnerable" : "normal"));
if (n_Type != 0) {
_local2._xscale = n_Scale;
_local2._yscale = n_Scale;
_local2.n_MaxHealth = (_root.o_BallTypes[n_Type]._invulnerable ? -1 : 100);
_local2.o_Number._visible = (_root.s_GameStyle == "survival") && (_root.o_BallTypes[n_Type]._mincollects != 0);
if (_local2.o_Number._visible) {
_local2.o_Number.text = _root.o_BallTypes[n_Type]._mincollects.toString();
}
} else {
_local2.o_Number._visible = false;
_local2.n_MaxHealth = -1;
}
_local2.n_Health = _local2.n_MaxHealth;
if (n_Type != 0) {
_local6 = _root.o_ShadowContainer.attachMovie("Ball", _local2._name, _root.o_ShadowContainer.getNextHighestDepth(), {_x:_local2._x, _y:_local2._y});
_local6.o_Graphics.gotoAndStop("shadow");
_local6.o_Light._visible = false;
_local6.o_Progress._visible = false;
_local6.o_Progress.gotoAndStop(1);
_local2.swapDepths(_root.o_FriendObject);
}
_local2.o_Progress._visible = false;
_local2.o_Progress.gotoAndStop(1);
_local2.o_Progress._xscale = 66;
_local2.o_Progress._yscale = 66;
_local2.o_ShotAngles = new Array();
var _local3 = 0;
while (_local3 < _root.o_BallTypes[_local2.n_Type]._shots.length) {
_local4 = _root.o_BallTypes[_local2.n_Type]._shots[_local3];
if (_local4 == -1) {
_local4 = Math.random() * 360;
}
_local2.o_ShotAngles.push(_local4);
_local3++;
}
_local2.n_ShotTypeID = _root.o_BallTypes[_local2.n_Type]._shottype;
_root.f_SetBallSize(_local2, n_Size);
_local2.o_Light._visible = n_Type != 0;
switch (n_Type) {
case 0 :
_local2.o_Light.gotoAndStop("solid");
_local2.n_Velocity = 0;
_local2.n_Angle = 0;
break;
default :
_local2.o_Light._alpha = 0;
_local2.o_Light.gotoAndStop((_root.b_Invulnerable ? "invulnerable" : "normal"));
_local2.n_Velocity = _local2.n_VelocityMaximum * 0.75;
_local2.n_Angle = Math.random() * 360;
}
_local2.o_VelocityObject = _root.f_CalculateProjection(_local2.n_Angle, _local2.n_Velocity);
_local2.o_Graphics.cacheAsBitmap = true;
return(_local2);
}
function f_HideExpander() {
_root.o_Selector._visible = false;
_root.o_Selector._width = _root.o_FriendObject.o_Graphics._width;
_root.o_Selector._height = _root.o_Selector._width;
}
function f_DamageBomb(o_Ball, n_DamageAmount) {
if (o_Ball.n_InvulTimer <= 0) {
o_Ball.n_Health = o_Ball.n_Health - n_DamageAmount;
if (o_Ball.n_Health < 0) {
o_Ball.n_Health = 0;
}
}
}
function f_PushObjectToArray(o_List, o_NewObject) {
var _local3 = new Array();
var _local4 = false;
if (o_List != undefined) {
var _local1 = 0;
while (_local1 < o_List.length) {
_local3.push(o_List[_local1]);
if (o_List[_local1]._name == o_NewObject._name) {
_local4 = true;
}
_local1++;
}
if (!_local4) {
_local3.push(o_NewObject);
}
}
return(_local3);
}
function f_ActivateBall(o_Ball, n_ClickID) {
var _local6;
var _local5;
var _local15;
var _local21;
var _local24;
var _local9;
var _local10;
var _local13;
var _local12;
var _local20;
var _local14;
var _local25;
var _local26;
var _local19;
var _local3;
var _local11;
if (!o_Ball.b_Activated) {
o_Ball.b_Activated = true;
_local21 = _root.o_ShotTypes[o_Ball.n_ShotTypeID]._name;
if (_local21 == "beam") {
o_Ball.o_VelocityObject.n_xvel = (o_Ball.o_VelocityObject.n_yvel = 0);
_local11 = new Array();
var _local8 = _root.o_Objects.length - 1;
while (_local8 >= 0) {
_local3 = _root.o_Objects[_local8];
if (((((_local3._name != o_Ball._name) && (_local3.n_Type != 0)) && (_local3.n_Type != _root.n_BallKiller)) && (_local3.n_Health > 0)) && (!_local3.b_Activated)) {
_local20 = _root.f_AngleToObject(_local3, o_Ball);
_local14 = _root.f_DistanceToObject(_local3, o_Ball);
if (_local14 <= ((o_Ball.n_Radius * _root.n_BeamMulti) + _root.n_BeamRange)) {
_local11.push(_local3);
}
}
_local8--;
}
if (o_Ball.o_ShotAngles.length > 0) {
_local12 = _root.o_EffectsContainer.attachMovie("Beam_Holder", "o_Beam_" + _root.o_EffectsContainer.getNextHighestDepth(), _root.o_EffectsContainer.getNextHighestDepth(), {_x:o_Ball._x, _y:o_Ball._y});
_local12.n_Timer = 0;
_local12.o_Items = new Array();
_local12.o_Ball = o_Ball;
var _local4 = 0;
while (_local4 < o_Ball.o_ShotAngles.length) {
if (_local11.length > _local4) {
_local13 = _local12.attachMovie("Beam", "o_Beam_" + _local4.toString(), _local4, {_x:0, _y:0});
_local13._visible = false;
_local12.o_Items.push({_beam:_local13, _ball:_local11[_local4]});
}
_local4++;
}
if (_local12.o_Items.length > 0) {
_root.f_PlaySound("o_Sounds", "Beam2");
_root.o_Beams.push(_local12);
o_Ball.n_ClickID = n_ClickID;
o_Ball.n_Health = (o_Ball.n_MaxHealth = -1);
} else {
o_Ball.n_ClickID = 0;
o_Ball.n_Health = 0;
_local12.removeMovieClip();
}
}
} else if (_local21 == "lightening") {
o_Ball.o_VelocityObject.n_xvel = (o_Ball.o_VelocityObject.n_yvel = 0);
if (o_Ball.o_ShotAngles.length > 0) {
_local10 = _root.o_EffectsContainer.attachMovie("Lightening_Holder", "o_Lightening_" + _root.o_EffectsContainer.getNextHighestDepth(), _root.o_EffectsContainer.getNextHighestDepth(), {_x:o_Ball._x, _y:o_Ball._y});
_local10.n_Timer = 0;
_local10.o_Items = new Array();
_local10.o_Ball = o_Ball;
_local10.o_Glow._width = 2 * (o_Ball.n_Radius * _root.n_LighteningMultiplier);
_local10.o_Glow._height = _local10.o_Glow._width;
_root.f_PlaySound("o_Sounds", "Beam1");
var _local4 = 0;
while (_local4 < o_Ball.o_ShotAngles.length) {
_local9 = _local10.attachMovie("Lightening", "o_Lightening_" + _local4.toString(), _local4, {_x:0, _y:0});
_local5 = o_Ball.o_ShotAngles[_local4];
_local9._rotation = _local5;
_root.f_ProjectObject(_local9, _local5, o_Ball.n_Radius);
_local10.o_Items.push(_local9);
_local4++;
}
_root.o_Lightenings.push(_local10);
}
o_Ball.n_ClickID = n_ClickID;
o_Ball.n_Health = (o_Ball.n_MaxHealth = -1);
} else if (_local21 == "vortex") {
_local19 = _root.o_BackEffectsContainer.attachMovie("Vortex", "o_Vortex_" + _root.o_BackEffectsContainer.getNextHighestDepth(), _root.o_BackEffectsContainer.getNextHighestDepth(), {_x:o_Ball._x, _y:o_Ball._y});
_local19.n_Size = (o_Ball.n_Size * _root.n_VortexMultiplier) + _root.n_VortexExtra;
_local19.n_Radius = _local19.n_Size / 2;
_local19.n_Timer = 0;
_local19._width = (_local19._height = _local19.n_Size);
_root.o_Vortexes.push(_local19);
_root.f_PlaySound("o_Sounds", "vortex");
o_Ball.n_ClickID = n_ClickID;
o_Ball.n_Health = (o_Ball.n_MaxHealth = 0);
} else {
var _local7 = 0;
while (_local7 < o_Ball.o_ShotAngles.length) {
_local6 = _root.f_CreateBall(_root.n_BallKiller, o_Ball._x, o_Ball._y, o_Ball.n_Size * _root.n_PopReduction, true, -1);
_local6.n_ClickID = n_ClickID;
_local5 = o_Ball.o_ShotAngles[_local7];
_root.f_ProjectObject(_local6, _local5, o_Ball.n_Radius);
_local15 = _root.o_BallTypes[_root.n_BallKiller]._maxvel;
_local6.o_VelocityObject = _root.f_CalculateProjection(_local5, _local15);
_root.o_Objects.push(_local6);
_local7++;
}
o_Ball.n_Health = (o_Ball.n_MaxHealth = 0);
o_Ball.n_Size = 0;
if (o_Ball.o_ShotAngles.length > 0) {
o_Ball._width = (o_Ball._height = 1);
_root.o_ShadowContainer[o_Ball._name]._width = (_root.o_ShadowContainer[o_Ball._name]._height = 1);
o_Ball.b_ExplodeActivated = true;
o_Ball.n_ExplodeDelay = 0;
}
o_Ball.n_ClickID = n_ClickID;
}
}
}
function f_CollectInArea(n_ClickID, n_Range, b_Player, o_Object) {
var _local2;
var _local6;
var _local5;
var _local13;
var _local14;
var _local12 = o_Object._x;
var _local11 = o_Object._y;
o_Explosion = _root.o_EffectsContainer.attachMovie("Explosion_Item", "o_Explosion_" + _root.o_EffectsContainer.getNextHighestDepth(), _root.o_EffectsContainer.getNextHighestDepth(), {_x:o_Object._x, _y:o_Object._y});
o_Explosion.gotoAndStop("Type_" + ((o_Object._name == _root.o_FriendObject._name) ? "1" : "0").toString());
o_Explosion._width = n_Range * 2;
o_Explosion._height = o_Explosion._width;
_root.o_Explosions.push(o_Explosion);
_root.f_PlaySound("o_Sounds", "Explosion");
_root.f_ActivateBall(o_Object, n_ClickID);
var _local3 = _root.o_Objects.length - 1;
while (_local3 >= 0) {
_local2 = _root.o_Objects[_local3];
if (((_local2.n_Type != 0) && (_local2.n_Type != _root.n_BallKiller)) && (_local2.n_Health > 0)) {
_local6 = _root.f_AngleToObject(_local2, o_Object);
_local5 = (_root.f_DistanceToObject(_local2, o_Object) - _local2.n_Radius) - o_Object.n_Radius;
if (_local5 <= n_Range) {
_root.f_ActivateBall(_local2, n_ClickID);
}
}
_local3--;
}
}
function f_Invulnerable(b_On) {
var _local3;
_root.b_Invulnerable = b_On;
var _local2 = _root.o_Objects.length - 1;
while (_local2 >= 0) {
_local3 = _root.o_Objects[_local2];
if (_local3._name != _root.o_FriendObject._name) {
_local3.o_Light.gotoAndStop((b_On ? "invulnerable" : "normal"));
}
_local2--;
}
_root.o_FriendObject.o_Graphics.gotoAndStop((b_On ? "invulnerable" : "friend"));
}
function f_CalculateProjection(n_Angle, n_Movement) {
var _local1 = new Object({n_xvel:0, n_yvel:0});
var _local3 = 1;
var _local7 = -7.83205965360079E-15;
var _local2 = (n_Angle - 90) / 57.2957795130823;
_local1.n_xvel = n_Movement * Math.cos(_local2);
_local1.n_yvel = n_Movement * Math.sin(_local2);
return(_local1);
}
function f_ManageBounce(o_Object1, o_Object2) {
var _local7;
var _local6;
var _local5 = _root.n_MassMulti * o_Object1.n_Size;
var _local4 = _root.n_MassMulti * o_Object2.n_Size;
o_Object1.b_MinVelocitySet = false;
o_Object2.b_MinVelocitySet = false;
if ((o_Object1.o_VelocityObject != undefined) && (o_Object2.o_VelocityObject != undefined)) {
_local7 = o_Object1._x - o_Object2._x;
_local6 = o_Object1._y - o_Object2._y;
collision_angle = Math.atan2(_local6, _local7);
magnitude_1 = Math.sqrt((o_Object1.o_VelocityObject.n_xvel * o_Object1.o_VelocityObject.n_xvel) + (o_Object1.o_VelocityObject.n_yvel * o_Object1.o_VelocityObject.n_yvel));
magnitude_2 = Math.sqrt((o_Object2.o_VelocityObject.n_xvel * o_Object2.o_VelocityObject.n_xvel) + (o_Object2.o_VelocityObject.n_yvel * o_Object2.o_VelocityObject.n_yvel));
direction_1 = Math.atan2(o_Object1.o_VelocityObject.n_yvel, o_Object1.o_VelocityObject.n_xvel);
direction_2 = Math.atan2(o_Object2.o_VelocityObject.n_yvel, o_Object2.o_VelocityObject.n_xvel);
new_xspeed_1 = magnitude_1 * Math.cos(direction_1 - collision_angle);
new_yspeed_1 = magnitude_1 * Math.sin(direction_1 - collision_angle);
new_xspeed_2 = magnitude_2 * Math.cos(direction_2 - collision_angle);
new_yspeed_2 = magnitude_2 * Math.sin(direction_2 - collision_angle);
final_xspeed_1 = (((_local5 - _local4) * new_xspeed_1) + ((_local4 + _local4) * new_xspeed_2)) / (_local5 + _local4);
final_xspeed_2 = (((_local5 + _local5) * new_xspeed_1) + ((_local4 - _local5) * new_xspeed_2)) / (_local5 + _local4);
final_yspeed_1 = new_yspeed_1;
final_yspeed_2 = new_yspeed_2;
if (o_Object1._name != _root.o_FriendObject._name) {
o_Object1.o_VelocityObject.n_xvel = (Math.cos(collision_angle) * final_xspeed_1) + (Math.cos(collision_angle + (Math.PI/2)) * final_yspeed_1);
o_Object1.o_VelocityObject.n_yvel = (Math.sin(collision_angle) * final_xspeed_1) + (Math.sin(collision_angle + (Math.PI/2)) * final_yspeed_1);
if (_root.f_DistanceToObject({_x:0, _y:0}, {_x:o_Object1.o_VelocityObject.n_xvel, _y:o_Object1.o_VelocityObject.n_yvel}) > o_Ball.n_VelocityMaximum) {
o_Object1.o_VelocityObject = _root.f_CalculateProjection(_root.f_AngleToObject({_x:0, _y:0}, {_x:o_Object1.o_VelocityObject.n_xvel, _y:o_Object1.o_VelocityObject.n_yvel}), o_Ball.n_VelocityMaximum);
}
}
if (o_Object2._name != _root.o_FriendObject._name) {
o_Object2.o_VelocityObject.n_xvel = (Math.cos(collision_angle) * final_xspeed_2) + (Math.cos(collision_angle + (Math.PI/2)) * final_yspeed_2);
o_Object2.o_VelocityObject.n_yvel = (Math.sin(collision_angle) * final_xspeed_2) + (Math.sin(collision_angle + (Math.PI/2)) * final_yspeed_2);
if (_root.f_DistanceToObject({_x:0, _y:0}, {_x:o_Object2.o_VelocityObject.n_xvel, _y:o_Object2.o_VelocityObject.n_yvel}) > o_Ball.n_VelocityMaximum) {
o_Object2.o_VelocityObject = _root.f_CalculateProjection(_root.f_AngleToObject({_x:0, _y:0}, {_x:o_Object2.o_VelocityObject.n_xvel, _y:o_Object2.o_VelocityObject.n_yvel}), _root.n_VelocityMaximum);
}
}
}
}
function f_ProjectObject(o_Object, n_Angle, n_Movement) {
var _local4 = 1;
var _local7 = -7.83205965360079E-15;
var _local1 = (n_Angle - 90) / 57.2957795130823;
var _local3 = n_Movement * Math.cos(_local1);
var _local2 = n_Movement * Math.sin(_local1);
o_Object._x = o_Object._x + _local3;
o_Object._y = o_Object._y + _local2;
}
function f_DegreeTransform(n_CurrentPosition, n_ChangeVal) {
if ((n_CurrentPosition + n_ChangeVal) > 360) {
return((n_CurrentPosition + n_ChangeVal) - 360);
}
if ((n_CurrentPosition + n_ChangeVal) < 0) {
return((n_CurrentPosition + n_ChangeVal) + 360);
}
return(n_CurrentPosition + n_ChangeVal);
}
function f_DistanceToObject(o_Source, o_Destination) {
var _local3;
var _local2;
var _local1;
_local2 = o_Source._x - o_Destination._x;
_local1 = o_Source._y - o_Destination._y;
_local3 = Math.sqrt((_local2 * _local2) + (_local1 * _local1));
return(_local3);
}
function f_AngleToObject(o_Source, o_Destination) {
var _local2;
var _local4;
var _local3;
_local4 = o_Destination._x - o_Source._x;
_local3 = -1 * (o_Destination._y - o_Source._y);
_local2 = Math.atan2(_local3, _local4);
_local2 = Math.round((_local2 / Math.PI) * 180);
return(_root.f_DegreeTransform((_local2 - 90) * -1, 0));
}
function f_ShortestRoute(n_SourceAngle, n_DestAngle) {
var _local1;
if (n_DestAngle > n_SourceAngle) {
if ((n_DestAngle - n_SourceAngle) >= 180) {
_local1 = -1;
} else {
_local1 = 1;
}
} else if (n_DestAngle < n_SourceAngle) {
if ((n_SourceAngle - n_DestAngle) >= 180) {
_local1 = 1;
} else {
_local1 = -1;
}
} else {
_local1 = 0;
}
return(_local1);
}
function f_DistanceToAngle(n_SourceAngle, n_DestAngle) {
return(f_DegreeTransform(n_SourceAngle - n_DestAngle, 0));
}
function f_BarSetWidth(o_Object, n_NewWidth) {
o_Object.n_Width = n_NewWidth;
o_Object.o_Mask.o_Right._x = n_NewWidth - 20;
o_Object.o_Mask.o_Body._width = n_NewWidth - 30;
o_Object.o_Background.o_Right._x = o_Object.o_Mask.o_Right._x;
o_Object.o_Background.o_Body._width = o_Object.o_Mask.o_Body._width;
_root.f_BarDrawBar(o_Object);
}
function f_BarSetMaxValue(o_Object, n_NewValue) {
o_Object.n_MaxValue = n_NewValue;
_root.f_BarDrawBar(o_Object);
}
function f_BarSetValue(o_Object, n_NewValue) {
o_Object.n_Value = ((n_NewValue > o_Object.n_MaxValue) ? (o_Object.n_MaxValue) : (n_NewValue));
_root.f_BarDrawBar(o_Object);
}
function f_BarDrawBar(o_Object) {
if (o_Object.n_Value == undefined) {
o_Object.o_Bar._width = o_Object.n_Width;
} else {
o_Object.o_Bar._width = (o_Object.n_Width / o_Object.n_MaxValue) * o_Object.n_Value;
}
}
function f_ShowMessage(s_Text, b_Important) {
if (_root.s_GameMode != "menu") {
_root.a_MessageArray.push({_text:s_Text, _important:b_Important});
}
}
function f_DoMessages() {
var _local2;
var _local3;
var _local5;
var _local4;
if (_root.a_MessageArray.length > 0) {
if (_root.f_TimeDiff(_root.d_MessageLast, new Date()) >= _root.n_MessageDelay) {
_local3 = _root.a_MessageArray.shift();
_local5 = _local3._text;
_local4 = _local3._important;
_local2 = _root.o_MessagesContainer.attachMovie("Messages", "Messages", _root.o_MessagesContainer.getNextHighestDepth());
_local2.gotoAndPlay((_local4 ? "Important" : "Normal"));
_local2._x = 0;
_local2._y = -30;
_local2.o_InnerText.o_Text.text = _local5;
_root.d_MessageLast = new Date();
}
}
}
function f_ToggleSounds() {
var _local2 = new Date();
_root.f_MarkAchievement("Music");
if (d_SoundsToggle == undefined) {
d_SoundsToggle = new Date(1999, 12, 31, 23, 59, 59, 0);
}
if (_root.f_OverTimeDiff(_root.d_SoundsToggle, _local2, 100)) {
_root.b_SoundsOn = !_root.b_SoundsOn;
_root.o_Settings.data.b_SoundsOn = _root.b_SoundsOn;
if (_root.b_SoundsOn) {
_root.f_PlaySound("o_Sounds", "music");
} else {
stopAllSounds();
}
_root.d_SoundsToggle = _local2;
}
}
function f_PlaySound(s_Group, s_Sound) {
if (_root.b_SoundsOn) {
_root[s_Group].gotoAndPlay(s_Sound);
}
}
function f_OverTimeDiff(d_DateFrom, d_DateTo, n_MillisecondsDiff) {
var _local2 = d_DateFrom.getTime();
var _local1 = d_DateTo.getTime();
if (((_local2 + n_MillisecondsDiff) <= _local1) || (_local2 >= (_local1 + n_MillisecondsDiff))) {
return(true);
}
return(false);
}
function f_TimeDiff(d_DateFrom, d_DateTo) {
var _local2 = d_DateFrom.getTime();
var _local1 = d_DateTo.getTime();
return(_local1 - _local2);
}
function f_DoScores(b_ViewOnly) {
_root.f_CleanUp(true);
_root.s_ScoreMode = (b_ViewOnly ? "view" : "submit");
_root.gotoAndPlay("HiScores");
}
function f_CalculateScore() {
var _local3 = 0;
var _local2 = 1;
while (_local2 < _root.o_Levels.length) {
_local3 = _local3 + _root.o_Levels[_local2]._score;
_local2++;
}
return(Math.floor(_local3));
}
function f_StoreLevelData() {
var _local3 = "";
_root.o_Settings.data.n_AchievementCollects = _root.n_AchievementCollects;
_root.o_Settings.data.n_AchievementBalls = _root.n_AchievementBalls;
_root.o_Settings.data.n_AchievementGames = _root.n_AchievementGames;
var _local2 = 1;
while (_local2 < _root.o_Levels.length) {
_local3 = _local3 + ((((("|" + (_root.o_Levels[_local2]._completed ? "1" : "0")) + ":") + _root.o_Levels[_local2]._stars.toString()) + ":") + _root.o_Levels[_local2]._score.toString());
_local2++;
}
_root.o_Settings.data.s_LevelData = _local3;
_local3 = "";
_local2 = 0;
while (_local2 < _root.o_Achievements.length) {
_local3 = _local3 + (((_local3 == "") ? "" : "|") + (_root.o_Achievements[_local2]._achieved ? "1" : "0"));
_local2++;
}
_root.o_Settings.data.s_AchievementData = _local3;
}
function f_GetLevelData() {
var _local4 = "";
var _local3 = "";
n_AchievementCollects = ((_root.o_Settings.data.n_AchievementCollects != undefined) ? (_root.o_Settings.data.n_AchievementCollects) : 0);
n_AchievementBalls = ((_root.o_Settings.data.n_AchievementBalls != undefined) ? (_root.o_Settings.data.n_AchievementBalls) : 0);
n_AchievementGames = ((_root.o_Settings.data.n_AchievementGames != undefined) ? (_root.o_Settings.data.n_AchievementGames) : 0);
if (_root.o_Settings.data.s_LevelData != undefined) {
_local4 = _root.o_Settings.data.s_LevelData.split("|");
var _local2 = 1;
while (_local2 < _root.o_Levels.length) {
_local3 = _local4[_local2].split(":");
if (_local3.length == 3) {
_root.o_Levels[_local2]._completed = _local3[0] == "1";
_root.o_Levels[_local2]._stars = int(_local3[1]);
_root.o_Levels[_local2]._score = int(_local3[2]);
}
_local2++;
}
}
if (_root.o_Settings.data.s_AchievementData != undefined) {
_local4 = _root.o_Settings.data.s_AchievementData.split("|");
var _local2 = 0;
while (_local2 < _root.o_Achievements.length) {
_root.o_Achievements[_local2]._achieved = _local4[_local2] == "1";
_local2++;
}
}
}
function f_CalcLevels() {
var _local3 = _root.o_MenuOverlay.o_MenuScroller.o_LevelSelector;
var _local2 = 0;
_root.f_GetLevelData();
if (!_root.o_Levels[1]._completed) {
_root.n_NextPlayableID = 1;
} else {
_root.n_NextPlayableID = 0;
_local2 = 1;
while (_local2 < _root.o_Levels.length) {
if (_root.o_Levels[_local2]._completed) {
_root.n_NextPlayableID = _local2;
}
_local2++;
}
_root.n_NextPlayableID++;
}
_local2 = 1;
while (_local2 < (((_root.n_LevelFiller + 1) > _root.o_Levels.length) ? (n_LevelFiller + 1) : (_root.o_Levels.length))) {
_local3["o_Level_" + _local2.toString()].o_Text.text = _local2.toString();
if ((_local2 < _root.o_Levels.length) || (_root.b_Testing)) {
_local3["o_Level_" + _local2.toString()].o_Stars.gotoAndStop(_root.o_Levels[_local2]._stars + 1);
_local3["o_Level_" + _local2.toString()]._alpha = ((_root.o_Levels[_local2]._completed || (_root.n_NextPlayableID == _local2)) ? 100 : 50);
} else {
_local3["o_Level_" + _local2.toString()].o_Stars.gotoAndStop(1);
_local3["o_Level_" + _local2.toString()]._alpha = 50;
}
_local2++;
}
_root.n_OverallScore = _root.f_CalculateScore();
_root.o_MenuOverlay.o_MenuScroller.o_Score.text = "Score:" + _root.n_OverallScore.toString();
}
function f_AchievementGetMedalFromCode(s_Code) {
var _local3 = "";
var _local2 = 0;
while (_local2 < _root.o_Achievements.length) {
if (_root.o_Achievements[_local2]._code == s_Code) {
_local3 = _root.o_Achievements[_local2]._medal;
}
_local2++;
}
return(_local3);
}
function f_AchievementGetTitleFromCode(s_Code) {
var _local3 = "";
var _local2 = 0;
while (_local2 < _root.o_Achievements.length) {
if (_root.o_Achievements[_local2]._code == s_Code) {
_local3 = _root.o_Achievements[_local2]._name;
}
_local2++;
}
return(_local3);
}
function f_DoAchievements() {
var _local2;
var _local4;
var _local3;
if (_root.o_AchieveQueue.length > 0) {
if (_root.f_TimeDiff(_root.d_AchievementLast, new Date()) >= _root.n_AchievementDelay) {
s_Code = _root.o_AchieveQueue.shift();
_local2 = _root.o_AchievementsContainer.attachMovie("Achievement_Message", "o_AchievementMessage_" + _root.o_MessagesContainer.getNextHighestDepth(), _root.o_MessagesContainer.getNextHighestDepth());
_local2._x = 30;
_local2._y = 100;
_local2.o_InnerText.o_Graphics.gotoAndStop(_root.f_AchievementGetMedalFromCode(s_Code));
_local2.o_InnerText.o_Text.text = _root.f_AchievementGetTitleFromCode(s_Code);
_root.f_PlaySound("o_Sounds", "achievement");
_root.d_AchievementLast = new Date();
}
}
}
function f_MarkAchievement(s_Code) {
var _local2 = 0;
while (_local2 < _root.o_Achievements.length) {
if ((_root.o_Achievements[_local2]._code.toLowerCase() == s_Code.toLowerCase()) && (!_root.o_Achievements[_local2]._achieved)) {
_root.o_Achievements[_local2]._achieved = true;
if (_root.o_AchievementsNew == undefined) {
_root.o_AchievementsNew = new Array();
}
_root.o_AchievementsNew.push(s_Code);
_root.o_AchieveQueue.push(s_Code);
_root.f_StoreLevelData();
}
_local2++;
}
}
function f_SetAchievements(o_Clip, o_New) {
var _local5;
var _local4;
o_Clip.o_Hover._visible = false;
var _local2 = 0;
while (_local2 < _root.o_Achievements.length) {
_local5 = o_Clip.o_Items[_root.o_Achievements[_local2]._code];
_local4 = o_Clip.o_Mask[_root.o_Achievements[_local2]._code];
if ((_local5._name != undefined) && (_local4._name != undefined)) {
_local5.o_Label._visible = false;
_local5.o_Label.text = (_root.o_Achievements[_local2]._achieved ? (_root.o_Achievements[_local2]._name) : ((_root.o_Achievements[_local2]._hide ? "???" : (_root.o_Achievements[_local2]._name))));
_local5.o_Graphics.gotoAndStop(_root.o_Achievements[_local2]._medal);
_local5.o_Graphics._alpha = (_root.o_Achievements[_local2]._achieved ? 100 : 33);
_local4.o_Graphics.gotoAndStop(_root.o_Achievements[_local2]._medal);
_local4._visible = false;
_local4.o_Hover._visible = false;
var _local3 = 0;
while (_local3 < o_New.length) {
if (o_New[_local3].toString() == _root.o_Achievements[_local2]._code.toString()) {
_local4._visible = true;
_local4.o_Hover._visible = false;
}
_local3++;
}
}
_local2++;
}
}
_lockroot = true;
var s_SponsorGameTitle = "chaosreactor";
var s_SponsorLink1 = (("http://physicsgamesbox.com/?utm_source=" + s_SponsorGameTitle) + "&utm_medium=");
var s_SponsorLink2 = (("http://physicsgamesbox.com/download-free-games-for-your-site.html?utm_source=" + s_SponsorGameTitle) + "&utm_medium=add");
var o_Settings = SharedObject.getLocal("attractor");
var b_Debuging = false;
var b_FGL = false;
var b_Testing = false;
var s_TestURL = "";
var s_URL = (_root.b_Testing ? (_root.s_TestURL) : (_root._url));
var s_GameAds = "cpmstar";
var d_AdvertStartTime;
var s_SmileyID = "";
var CPMStarContentSpotID = "4277Q26D6F707";
var CPMStarContentInterlevelID = "4278Q806190AF";
var n_CPMWaitTime = 5000;
var n_GameWidth = 550;
var n_GameHeight = 500;
var n_TopBarHeight = 35;
_root.scrollRect = new flash.geom.Rectangle(0, 0, _root.n_GameWidth, _root.n_GameHeight);
_root._quality = "high";
var a_MessageArray;
var n_MessageDelay = 1000;
var d_MessageLast;
var o_MenuTarget;
var d_MenuGravityStart;
var n_MenuGravityLength = 5000;
var n_MenuGravityInterval = 15000;
var o_MenuPosition = new Object({_x:0, _y:300});
var n_Score = 0;
var n_OverallScore = 0;
var n_ScoreForLevel = 100000;
var n_ClicksAllowed = 100;
var o_Clicks;
var n_ClicksOnWin = -1;
var b_Setup = false;
var s_GameMode = "menu";
var s_GameStyle = "level";
var n_SurvivalRange = 40;
var n_SurvivalClicks = 3;
var n_SurvivalTotalClicks = 0;
var n_SurvivalTotalCollects = 0;
var n_SurvivalBallsStart = 20;
var n_SurvivalBallsForClick = 15;
var n_SurvivalBallsPopped = 0;
var n_SurvivalLast;
var n_SurvivalDelay = 12;
var o_SurvivalBallSizes = [{_countlower:0, _countupper:30, _sizelower:50, _sizeupper:70}, {_countlower:30, _countupper:60, _sizelower:45, _sizeupper:60}, {_countlower:60, _countupper:90, _sizelower:45, _sizeupper:55}, {_countlower:90, _countupper:120, _sizelower:45, _sizeupper:50}, {_countlower:120, _countupper:150, _sizelower:40, _sizeupper:50}, {_countlower:150, _countupper:180, _sizelower:35, _sizeupper:45}, {_countlower:180, _countupper:210, _sizelower:30, _sizeupper:40}, {_countlower:210, _countupper:240, _sizelower:25, _sizeupper:40}, {_countlower:240, _countupper:270, _sizelower:20, _sizeupper:35}, {_countlower:270, _countupper:10000000000, _sizelower:15, _sizeupper:35}];
var n_SurvivalModeUnlock = 10;
var b_EndScreen = false;
var b_GameOver = false;
var b_GameWin = false;
var s_GameOverText = false;
var n_GamePercent = 0;
var n_GamePercentNeeded = 0;
var n_OrigionalBalls = 0;
var b_Instructions;
var o_NeededAnim;
var n_NeededY = (_root.n_GameHeight - 80);
var o_Explosions;
var n_ExplosionFade = 8;
var n_ExplodeDelayLower = 2;
var n_ExplodeDelayUpper = 8;
var n_CollectScore = 10;
var o_Collects;
var n_CollectsMax = 50;
var n_CollectFrames = 120;
var n_PlayerCollects = 0;
var n_AchievementCollects = 0;
var n_AchievementBalls = 0;
var n_AchievementGames = 0;
var n_AchievementCap = 64000;
var o_AchieveQueue;
var n_AchievementDelay = 1250;
var o_Achievements = [{_medal:"GCGG", _code:"B_1CF", _name:"1 Click Finish (Beginner)", _achieved:false, _hide:false}, {_medal:"SCGG", _code:"B_2CF", _name:"2 Click Finish (Beginner)", _achieved:false, _hide:false}, {_medal:"BCGG", _code:"B_3CF", _name:"3 Click Finish (Beginner)", _achieved:false, _hide:false}, {_medal:"GCBB", _code:"S_1CF", _name:"1 Click Finish (Standard)", _achieved:false, _hide:false}, {_medal:"SCBB", _code:"S_2CF", _name:"2 Click Finish (Standard)", _achieved:false, _hide:false}, {_medal:"BCBB", _code:"S_3CF", _name:"3 Click Finish (Standard)", _achieved:false, _hide:false}, {_medal:"GCPP", _code:"A_1CF", _name:"1 Click Finish (Advanced)", _achieved:false, _hide:false}, {_medal:"SCPP", _code:"A_2CF", _name:"2 Click Finish (Advanced)", _achieved:false, _hide:false}, {_medal:"BCPP", _code:"A_3CF", _name:"3 Click Finish (Advanced)", _achieved:false, _hide:false}, {_medal:"GCRR", _code:"E_1CF", _name:"1 Click Finish (Expert)", _achieved:false, _hide:false}, {_medal:"SCRR", _code:"E_2CF", _name:"2 Click Finish (Expert)", _achieved:false, _hide:false}, {_medal:"BCRR", _code:"E_3CF", _name:"3 Click Finish (Expert)", _achieved:false, _hide:false}, {_medal:"BCGW", _code:"B_50Shot", _name:"50% shot (Beginner)", _achieved:false, _hide:false}, {_medal:"SCGW", _code:"B_70Shot", _name:"70% shot (Beginner)", _achieved:false, _hide:false}, {_medal:"GCGW", _code:"B_90Shot", _name:"90% shot (Beginner)", _achieved:false, _hide:false}, {_medal:"BCBW", _code:"S_50Shot", _name:"50% shot (Standard)", _achieved:false, _hide:false}, {_medal:"SCBW", _code:"S_70Shot", _name:"70% shot (Standard)", _achieved:false, _hide:false}, {_medal:"GCBW", _code:"S_90Shot", _name:"90% shot (Standard)", _achieved:false, _hide:false}, {_medal:"BCPW", _code:"A_50Shot", _name:"50% shot (Advanced)", _achieved:false, _hide:false}, {_medal:"SCPW", _code:"A_70Shot", _name:"70% shot (Advanced)", _achieved:false, _hide:false}, {_medal:"GCPW", _code:"A_90Shot", _name:"90% shot (Advanced)", _achieved:false, _hide:false}, {_medal:"BCRW", _code:"E_50Shot", _name:"50% shot (Expert)", _achieved:false, _hide:false}, {_medal:"SCRW", _code:"E_70Shot", _name:"70% shot (Expert)", _achieved:false, _hide:false}, {_medal:"GCRW", _code:"E_90Shot", _name:"90% shot (Expert)", _achieved:false, _hide:false}, {_medal:"BSGG", _code:"B_1Star", _name:"All Basic Levels To 1 Star", _achieved:false, _hide:false}, {_medal:"SSGG", _code:"B_2Star", _name:"All Basic Levels To 2 Star", _achieved:false, _hide:false}, {_medal:"GSGG", _code:"B_3Star", _name:"All Basic Levels To 3 Star", _achieved:false, _hide:false}, {_medal:"BSBB", _code:"S_1Star", _name:"All Standard Levels To 1 Star", _achieved:false, _hide:false}, {_medal:"SSBB", _code:"S_2Star", _name:"All Standard Levels To 2 Star", _achieved:false, _hide:false}, {_medal:"GSBB", _code:"S_3Star", _name:"All Standard Levels To 3 Star", _achieved:false, _hide:false}, {_medal:"BSPP", _code:"A_1Star", _name:"All Advanced Levels To 1 Star", _achieved:false, _hide:false}, {_medal:"SSPP", _code:"A_2Star", _name:"All Advanced Levels To 2 Star", _achieved:false, _hide:false}, {_medal:"GSPP", _code:"A_3Star", _name:"All Advanced Levels To 3 Star", _achieved:false, _hide:false}, {_medal:"BSRR", _code:"E_1Star", _name:"All Expert Levels To 1 Star", _achieved:false, _hide:false}, {_medal:"SSRR", _code:"E_2Star", _name:"All Expert Levels To 2 Star", _achieved:false, _hide:false}, {_medal:"GSRR", _code:"E_3Star", _name:"All Expert Levels To 3 Star", _achieved:false, _hide:false}, {_medal:"BSGW", _code:"X_1Star", _name:"Every Level To 1 Star", _achieved:false, _hide:false}, {_medal:"SSGW", _code:"X_2Star", _name:"Every Level To 2 Star", _achieved:false, _hide:false}, {_medal:"GSGW", _code:"X_3Star", _name:"Every Level To 3 Star", _achieved:false, _hide:false}, {_medal:"BSBW", _code:"Games_5", _name:"5 Games Played", _achieved:false, _hide:false}, {_medal:"SSBW", _code:"Games_25", _name:"25 Games Played", _achieved:false, _hide:false}, {_medal:"GSBW", _code:"Games_100", _name:"100 Games Played", _achieved:false, _hide:false}, {_medal:"BSPW", _code:"Atoms_50", _name:"50 Atoms Destroyed", _achieved:false, _hide:false}, {_medal:"SSPW", _code:"Atoms_500", _name:"250 Atoms Destroyed", _achieved:false, _hide:false}, {_medal:"GSPW", _code:"Atoms_5000", _name:"1000 Atoms Destroyed", _achieved:false, _hide:false}, {_medal:"BSRW", _code:"Part_50", _name:"50 Particles Collected", _achieved:false, _hide:false}, {_medal:"SSRW", _code:"Part_500", _name:"250 Particles Collected", _achieved:false, _hide:false}, {_medal:"GSRW", _code:"Part_5000", _name:"1000 Particles Collected", _achieved:false, _hide:false}, {_medal:"BXGG", _code:"Combo_3", _name:"3 Type Combo", _achieved:false, _hide:false}, {_medal:"SXBB", _code:"Combo_4", _name:"4 Type Combo", _achieved:false, _hide:false}, {_medal:"GXPP", _code:"Combo_5", _name:"5 Type Combo", _achieved:false, _hide:false}, {_medal:"BXGW", _code:"Click_6", _name:"5 Survival Clicks", _achieved:false, _hide:false}, {_medal:"SXBW", _code:"Click_9", _name:"9 Survival Clicks", _achieved:false, _hide:false}, {_medal:"GXPW", _code:"Click_12", _name:"12 Survival Clicks", _achieved:false, _hide:false}, {_medal:"BCXX", _code:"Sponsor", _name:"Sponsor Link Clicked", _achieved:false, _hide:true}, {_medal:"BCXW", _code:"Music", _name:"Music Toggled", _achieved:false, _hide:true}, {_medal:"GCXX", _code:"Credits", _name:"Credits Viewed", _achieved:false, _hide:true}, {_medal:"SCXW", _code:"High_Level", _name:"Leveled Game Highscores Viewed", _achieved:false, _hide:true}, {_medal:"SCXX", _code:"High_Survival", _name:"Survival Game Highscores Viewed", _achieved:false, _hide:true}, {_medal:"GCXW", _code:"Survival", _name:"Survival Mode Activated", _achieved:false, _hide:true}];
var o_AchievementsNew;
var o_Lightenings;
var n_LighteningLength = 43;
var n_LighteningChance = 1;
var n_LighteningWidth = 30;
var n_LighteningDamage = 70;
var n_LighteningMultiplier = 4;
var o_Beams;
var n_BeamLength = 40;
var n_BeamChance = 1;
var n_BeamDamage = 10;
var n_BeamRange = 50;
var n_BeamMulti = 4;
var o_Vortexes;
var n_VortexMultiplier = 1.25;
var n_VortexExtra = 50;
var n_VortexLength = 75;
var n_VortexDamage = 5;
var o_Objects;
var n_ObjectsAtStart;
var o_FriendObject;
var o_ObjectLowerEnd = 3;
var o_BallTypes = [{_maxvel:0, _group:"", _name:"friend", _score:0, _killeraction:"none", _graphic:"friend", _invulnerable:true, _shottype:0, _shots:[], _explodeamp:0, _mincollects:0, _maxcollects:0}, {_maxvel:3, _group:"", _name:"killer", _score:0, _killeraction:"none", _graphic:"red", _invulnerable:true, _shottype:0, _shots:[], _explodeamp:0, _mincollects:0, _maxcollects:0}, {_maxvel:0, _group:"", _name:"[Reserved for future use]", _score:0, _killeraction:"none", _graphic:"pickup", _invulnerable:true, _shottype:0, _shots:[], _explodeamp:0, _mincollects:0, _maxcollects:0}, {_maxvel:0, _group:"", _name:"[Reserved for future use]", _score:0, _killeraction:"none", _graphic:"pickup", _invulnerable:true, _shottype:0, _shots:[], _explodeamp:0, _mincollects:0, _maxcollects:0}, {_maxvel:15, _group:"s", _name:"standard", _score:50, _killeraction:"collect", _graphic:"white", _invulnerable:false, _shottype:0, _shots:[], _explodeamp:2, _mincollects:1, _maxcollects:1}, {_maxvel:8, _group:"b", _name:"bomb", _score:75, _killeraction:"collect", _graphic:"black", _invulnerable:false, _shottype:0, _shots:[], _explodeamp:3, _mincollects:2, _maxcollects:2}, {_maxvel:10, _group:"e", _name:"horizontal", _score:75, _killeraction:"collect", _graphic:"bluewhite_hori", _invulnerable:false, _shottype:0, _shots:[90, 270], _explodeamp:1.5, _mincollects:1, _maxcollects:2}, {_maxvel:10, _group:"e", _name:"vertical", _score:75, _killeraction:"collect", _graphic:"bluewhite_vert", _invulnerable:false, _shottype:0, _shots:[0, 180], _explodeamp:1.5, _mincollects:1, _maxcollects:2}, {_maxvel:5, _group:"e", _name:"quad", _score:100, _killeraction:"collect", _graphic:"bluewhite_quad", _invulnerable:false, _shottype:0, _shots:[0, 90, 180, 270], _explodeamp:1.5, _mincollects:2, _maxcollects:2}, {_maxvel:10, _group:"l", _name:"lightening x", _score:75, _killeraction:"collect", _graphic:"redwhite_hori", _invulnerable:false, _shottype:1, _shots:[90, 270], _explodeamp:1.5, _mincollects:1, _maxcollects:3}, {_maxvel:10, _group:"l", _name:"lightening y", _score:75, _killeraction:"collect", _graphic:"redwhite_vert", _invulnerable:false, _shottype:1, _shots:[0, 180], _explodeamp:1.5, _mincollects:1, _maxcollects:3}, {_maxvel:5, _group:"l", _name:"lightening quad", _score:100, _killeraction:"collect", _graphic:"redwhite_quad", _invulnerable:false, _shottype:1, _shots:[0, 90, 180, 270], _explodeamp:1.5, _mincollects:2, _maxcollects:3}, {_maxvel:5, _group:"c", _name:"chain", _score:100, _killeraction:"collect", _graphic:"green", _invulnerable:false, _shottype:2, _shots:[-1, -1, -1], _explodeamp:1.5, _mincollects:3, _maxcollects:4}, {_maxvel:5, _group:"v", _name:"vortex", _score:100, _killeraction:"collect", _graphic:"purple", _invulnerable:false, _shottype:3, _shots:[], _explodeamp:1, _mincollects:2, _maxcollects:3}];
var n_SelectorRange = 60;
var n_BallKiller = 1;
var n_BallKillerFade = 10;
var n_PopReduction = 0.5;
var n_BallInvulFrames = 10;
var o_ShotTypes = [{_name:"ball"}, {_name:"lightening"}, {_name:"beam"}, {_name:"vortex"}];
var b_Invulnerable = false;
var b_BallsActive = false;
var b_KillersActive = false;
var b_GameOut = false;
var n_FadeOutSpeed = 2;
var n_FadeOutShadowStart = 20;
var n_FadeOutShadowSpeed = ((100 / _root.n_FadeOutShadowStart) * _root.n_FadeOutSpeed);
var d_AIIntervalLast;
var n_AIInterval = 3000;
var o_AINearestTarget;
var n_ViscocityMulti = 0.85;
var n_VelocityMinimum = 1;
var n_VelocityMaximum = 10;
var n_MassMulti = 0.75;
var b_SoundsOn = true;
var b_SoundsStarted = false;
var d_SoundsToggle = new Date();
var b_SoundsSetup = false;
var n_ExpandPullSpeedBad = 0.1;
var n_ExpandPullSpeedGood = 0;
var n_ExpandPullBadMulti = 1.5;
var n_ExpandBy = 5;
var n_MaxObjects = 25;
var n_Level;
var n_LevelFiller = 32;
var o_Levels = [{}, {_name:"Level 1", _group:"B", _sel:120, _perc:50, _clicks:2, _instr:1, _balls:[{_t:4, _s:40, _q:6, _b:false, _maxvel:10}, {_t:4, _s:50, _q:6, _b:false, _maxvel:10}, {_t:5, _s:50, _q:6, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 2", _group:"B", _sel:60, _perc:60, _clicks:2, _instr:2, _balls:[{_t:4, _s:50, _q:6, _b:false, _maxvel:10}, {_t:5, _s:50, _q:6, _b:false, _maxvel:10}, {_t:6, _s:50, _q:3, _b:false, _maxvel:10}, {_t:7, _s:50, _q:3, _b:false, _maxvel:10}, {_t:8, _s:50, _q:3, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 3", _group:"B", _sel:90, _perc:70, _clicks:2, _instr:3, _balls:[{_t:4, _s:40, _q:6, _b:false, _maxvel:10}, {_t:5, _s:40, _q:6, _b:false, _maxvel:10}, {_t:9, _s:40, _q:3, _b:false, _maxvel:10}, {_t:10, _s:50, _q:3, _b:false, _maxvel:10}, {_t:11, _s:60, _q:3, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 4", _group:"B", _sel:90, _perc:70, _clicks:3, _instr:4, _balls:[{_t:4, _s:50, _q:10, _b:false, _maxvel:10}, {_t:12, _s:50, _q:3, _b:false, _maxvel:10}, {_t:12, _s:60, _q:5, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 5", _group:"B", _sel:90, _perc:70, _clicks:2, _instr:5, _balls:[{_t:4, _s:40, _q:7, _b:false, _maxvel:10}, {_t:4, _s:50, _q:7, _b:false, _maxvel:10}, {_t:13, _s:50, _q:5, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 6", _group:"B", _sel:80, _perc:70, _clicks:2, _instr:0, _balls:[{_t:4, _s:30, _q:8, _b:false, _maxvel:10}, {_t:5, _s:30, _q:8, _b:false, _maxvel:10}, {_t:5, _s:80, _q:4, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 7", _group:"B", _sel:80, _perc:65, _clicks:3, _instr:0, _balls:[{_t:4, _s:20, _q:9, _b:false, _maxvel:10}, {_t:5, _s:20, _q:9, _b:false, _maxvel:10}, {_t:6, _s:50, _q:4, _b:false, _maxvel:10}, {_t:10, _s:50, _q:4, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 8", _group:"B", _sel:70, _perc:65, _clicks:3, _instr:0, _balls:[{_t:4, _s:20, _q:4, _b:false, _maxvel:10}, {_t:4, _s:30, _q:4, _b:false, _maxvel:10}, {_t:4, _s:40, _q:4, _b:false, _maxvel:10}, {_t:4, _s:50, _q:4, _b:false, _maxvel:10}, {_t:12, _s:40, _q:2, _b:false, _maxvel:10}, {_t:12, _s:60, _q:2, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 9", _group:"S", _sel:80, _perc:65, _clicks:3, _instr:0, _balls:[{_t:4, _s:30, _q:10, _b:false, _maxvel:10}, {_t:5, _s:30, _q:5, _b:false, _maxvel:10}, {_t:11, _s:50, _q:3, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 10", _group:"S", _sel:70, _perc:60, _clicks:3, _instr:0, _balls:[{_t:4, _s:30, _q:15, _b:false, _maxvel:10}, {_t:4, _s:40, _q:5, _b:false, _maxvel:10}, {_t:12, _s:60, _q:4, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 11", _group:"S", _sel:90, _perc:75, _clicks:3, _instr:0, _balls:[{_t:12, _s:20, _q:6, _b:false, _maxvel:10}, {_t:12, _s:30, _q:6, _b:false, _maxvel:10}, {_t:12, _s:50, _q:6, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 12", _group:"S", _sel:70, _perc:85, _clicks:2, _instr:0, _balls:[{_t:4, _s:40, _q:5, _b:false, _maxvel:10}, {_t:4, _s:50, _q:5, _b:false, _maxvel:10}, {_t:11, _s:40, _q:5, _b:false, _maxvel:10}, {_t:13, _s:40, _q:5, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 13", _group:"S", _sel:30, _perc:90, _clicks:2, _instr:0, _balls:[{_t:5, _s:20, _q:16, _b:false, _maxvel:10}, {_t:5, _s:100, _q:2, _b:false, _maxvel:10}, {_t:8, _s:100, _q:1, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 14", _group:"S", _sel:70, _perc:65, _clicks:2, _instr:0, _balls:[{_t:13, _s:120, _q:2, _b:false, _maxvel:10}, {_t:4, _s:20, _q:15, _b:false, _maxvel:10}, {_t:12, _s:50, _q:3, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 15", _group:"S", _sel:30, _perc:50, _clicks:2, _instr:0, _balls:[{_t:7, _s:40, _q:5, _b:false, _maxvel:10}, {_t:10, _s:40, _q:5, _b:false, _maxvel:10}, {_t:5, _s:30, _q:10, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 16", _group:"S", _sel:100, _perc:65, _clicks:2, _instr:0, _balls:[{_t:4, _s:30, _q:10, _b:false, _maxvel:10}, {_t:5, _s:30, _q:10, _b:false, _maxvel:10}, {_t:11, _s:50, _q:3, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 17", _group:"A", _sel:70, _perc:70, _clicks:3, _instr:0, _balls:[{_t:4, _s:30, _q:10, _b:false, _maxvel:10}, {_t:5, _s:30, _q:5, _b:false, _maxvel:10}, {_t:8, _s:50, _q:3, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 18", _group:"A", _sel:40, _perc:70, _clicks:3, _instr:0, _balls:[{_t:4, _s:20, _q:5, _b:false, _maxvel:10}, {_t:5, _s:30, _q:5, _b:false, _maxvel:10}, {_t:13, _s:100, _q:5, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 19", _group:"A", _sel:90, _perc:70, _clicks:3, _instr:0, _balls:[{_t:13, _s:30, _q:10, _b:false, _maxvel:10}, {_t:6, _s:30, _q:7, _b:false, _maxvel:10}, {_t:7, _s:30, _q:7, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 20", _group:"A", _sel:80, _perc:70, _clicks:3, _instr:0, _balls:[{_t:12, _s:30, _q:10, _b:false, _maxvel:10}, {_t:11, _s:50, _q:3, _b:false, _maxvel:10}, {_t:4, _s:20, _q:15, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 21", _group:"A", _sel:30, _perc:50, _clicks:3, _instr:6, _balls:[{_t:5, _s:50, _q:5, _b:false, _maxvel:10}, {_t:4, _s:20, _q:10, _b:false, _maxvel:10}, {_t:4, _s:40, _q:4, _b:true, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 22", _group:"A", _sel:60, _perc:70, _clicks:3, _instr:0, _balls:[{_t:4, _s:20, _q:10, _b:false, _maxvel:20}, {_t:8, _s:60, _q:7, _b:false, _maxvel:5}, {_t:4, _s:60, _q:3, _b:true, _maxvel:2}], _completed:false, _stars:0, _score:0}, {_name:"Level 23", _group:"A", _sel:70, _perc:50, _clicks:4, _instr:0, _balls:[{_t:5, _s:40, _q:6, _b:true, _maxvel:15}, {_t:13, _s:50, _q:4, _b:false, _maxvel:10}, {_t:4, _s:20, _q:10, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 24", _group:"A", _sel:40, _perc:60, _clicks:3, _instr:0, _balls:[{_t:4, _s:40, _q:10, _b:false, _maxvel:20}, {_t:12, _s:60, _q:6, _b:true, _maxvel:6}], _completed:false, _stars:0, _score:0}, {_name:"Level 25", _group:"E", _sel:50, _perc:50, _clicks:3, _instr:0, _balls:[{_t:4, _s:20, _q:15, _b:false, _maxvel:15}, {_t:13, _s:60, _q:5, _b:false, _maxvel:5}], _completed:false, _stars:0, _score:0}, {_name:"Level 26", _group:"E", _sel:60, _perc:50, _clicks:3, _instr:0, _balls:[{_t:5, _s:10, _q:20, _b:false, _maxvel:10}, {_t:5, _s:40, _q:5, _b:true, _maxvel:5}], _completed:false, _stars:0, _score:0}, {_name:"Level 27", _group:"E", _sel:60, _perc:50, _clicks:3, _instr:0, _balls:[{_t:6, _s:25, _q:10, _b:false, _maxvel:20}, {_t:9, _s:25, _q:10, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 28", _group:"E", _sel:30, _perc:80, _clicks:2, _instr:0, _balls:[{_t:4, _s:30, _q:9, _b:false, _maxvel:10}, {_t:5, _s:30, _q:3, _b:false, _maxvel:10}, {_t:11, _s:70, _q:2, _b:false, _maxvel:10}, {_t:12, _s:70, _q:4, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}, {_name:"Level 29", _group:"E", _sel:20, _perc:65, _clicks:2, _instr:0, _balls:[{_t:5, _s:100, _q:1, _b:false, _maxvel:10}, {_t:4, _s:20, _q:15, _b:false, _maxvel:20}, {_t:5, _s:20, _q:5, _b:false, _maxvel:20}], _completed:false, _stars:0, _score:0}, {_name:"Level 30", _group:"E", _sel:20, _perc:50, _clicks:3, _instr:0, _balls:[{_t:13, _s:100, _q:3, _b:false, _maxvel:5}, {_t:5, _s:20, _q:5, _b:false, _maxvel:15}, {_t:4, _s:20, _q:15, _b:false, _maxvel:15}], _completed:false, _stars:0, _score:0}, {_name:"Level 31", _group:"E", _sel:40, _perc:60, _clicks:3, _instr:0, _balls:[{_t:9, _s:30, _q:1, _b:false, _maxvel:5}, {_t:10, _s:30, _q:1, _b:false, _maxvel:5}, {_t:11, _s:50, _q:3, _b:false, _maxvel:5}, {_t:4, _s:20, _q:20, _b:false, _maxvel:20}], _completed:false, _stars:0, _score:0}, {_name:"Level 32", _group:"E", _sel:30, _perc:60, _clicks:2, _instr:0, _balls:[{_t:4, _s:25, _q:3, _b:false, _maxvel:15}, {_t:4, _s:45, _q:3, _b:false, _maxvel:10}], _completed:false, _stars:0, _score:0}];
var o_MList;
var o_KeyList;
var b_MouseDown;
function customContext() {
getURL (_root.s_SponsorLink1 + "context", "_blank");
}
function lowQuality() {
_root._quality = "low";
}
function mediumQuality() {
_root._quality = "medium";
}
function highQuality() {
_root._quality = "high";
}
function __com_mochibot__(swfid, mc, lv, trk) {
var x;
var g;
var s;
var fv;
var sb;
var u;
var res;
var mb;
var mbc;
var pv;
mb = "__mochibot__";
mbc = "mochibot.com";
g = (_global ? (_global) : (_level0._root));
if (g[mb + swfid]) {
return(g[mb + swfid]);
}
s = System.security;
x = mc._root.getSWFVersion;
fv = (x ? (mc.getSWFVersion()) : ((_global ? 6 : 5)));
if (!s) {
s = {};
}
sb = s.sandboxType;
if (sb == "localWithFile") {
return(null);
}
x = s.allowDomain;
if (x) {
s.allowDomain(mbc);
}
x = s.allowInsecureDomain;
if (x) {
s.allowInsecureDomain(mbc);
}
pv = ((fv == 5) ? (getVersion()) : (System.capabilities.version));
u = (((((((((((("http://" + mbc) + "/my/core.swf?mv=8&fv=") + fv) + "&v=") + escape(pv)) + "&swfid=") + escape(swfid)) + "&l=") + lv) + "&f=") + mc) + (sb ? ("&sb=" + sb) : "")) + (trk ? "&t=1" : "");
lv = ((fv > 6) ? (mc.getNextHighestDepth()) : ((g[mb + "level"] ? (g[mb + "level"] + 1) : (lv))));
g[mb + "level"] = lv;
if (fv == 5) {
res = "_level" + lv;
if (!eval (res)) {
loadMovieNum (u, lv);
}
} else {
res = mc.createEmptyMovieClip(mb + swfid, lv);
res.loadMovie(u);
}
return(res);
}
var myContextMenu = new ContextMenu();
myContextMenu.hideBuiltInItems();
var contextItem = new ContextMenuItem("PHYSICS Games Box", customContext);
myContextMenu.customItems.push(contextItem);
var contextItem = new ContextMenuItem("Quality: High", highQuality);
myContextMenu.customItems.push(contextItem);
var contextItem = new ContextMenuItem("Quality: Medium", mediumQuality);
myContextMenu.customItems.push(contextItem);
var contextItem = new ContextMenuItem("Quality: Slow", lowQuality);
myContextMenu.customItems.push(contextItem);
_root.menu = myContextMenu;
__com_mochibot__("99224580", this, 10301, true);
mochi.as2.MochiServices.connect("c6b330c05e6ddff7");
var kongregate = _global.kongregate;
kongregate.services.connect();
if (!_root.b_Debuging) {
if (((((((((((((_root.s_URL.toLowerCase().indexOf("addictinggames", 0) > 0) || (_root.s_URL.toLowerCase().indexOf("smileygamer", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("static.kaisergames.de", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("cdn.kaisergames.de", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("kongregate", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("gamesclub.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("armorgames.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("media.jaludo.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("agame.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("freeonlinegames.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("juegosdiarios.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("dailygames.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("jogosdodia.com", 0) > 0)) {
} else if (_root.s_GameAds == "cpmstar") {
_root.d_AdvertStartTime = new Date();
System.security.allowDomain("server.cpmstar.com");
this.adBox.loadMovie("http://server.cpmstar.com/adviewas2.swf?contentspotid=" + _root.CPMStarContentSpotID);
}
this.o_Loader.gotoAndPlay(2);
stop();
}
Frame 3
this.stop();
Frame 4
if (!_root.b_Setup) {
if (!_root.b_SoundsStarted) {
_root._quality = "medium";
stopAllSounds();
_root.f_PlaySound("o_Sounds", "music");
_root.b_SoundsStarted = true;
}
_root.f_StartGame("menu", 0, "level");
}
Frame 6
if (_root.s_GameStyle == "level") {
_root.f_MarkAchievement("High_Level");
var o = {n:[3, 11, 6, 8, 5, 9, 12, 10, 4, 14, 11, 5, 1, 4, 7, 0], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
} else if (_root.s_GameStyle == "survival") {
_root.f_MarkAchievement("High_Survival");
var o = {n:[14, 11, 0, 15, 7, 3, 9, 4, 13, 13, 11, 12, 3, 6, 13, 8], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
}
var boardID = o.f(0, "");
_root.onEnterFrame = undefined;
if (_root.s_ScoreMode == "submit") {
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.n_OverallScore});
} else {
mochi.as2.MochiScores.showLeaderboard({boardID:boardID});
}
Frame 7
_root.s_GameMode = "menu";
_root.s_GameStyle = "level";
_root.b_Setup = false;
_root.gotoAndPlay("Game");
Symbol 42 MovieClip [Ball] Frame 1
var n_ClickID;
var n_Angle;
var n_Velocity;
var o_VelocityObject;
var n_VelocityMaximum;
var o_ExternalForce;
var b_MinVelocitySet;
var n_Size;
var n_OrigionalSize;
var n_Radius;
var n_OrigionalRadius;
var n_Type;
var b_Breeder;
var n_Health;
var n_MaxHealth;
var b_EnteringField;
var n_EnterOffset;
var b_Activated;
var b_ExplodeActivated;
var n_ExplodeDelay;
var n_ShotTypeID;
var o_ShotAngles;
var n_InvulTimer;
Symbol 53 MovieClip [Vortex] Frame 1
var n_Radius;
var n_Size;
var n_Counter;
Symbol 59 Button
on (release) {
_root.play();
}
Symbol 60 MovieClip [Loader] Frame 2
var siteLoaded = _root.getBytesLoaded();
var siteTotal = _root.getBytesTotal();
var percentage = Math.floor((siteLoaded / siteTotal) * 100);
this.o_Progress.gotoAndStop(percentage.toString());
this.o_Percent.text = percentage + "%";
if (siteLoaded >= siteTotal) {
this.gotoAndPlay("End");
}
Symbol 60 MovieClip [Loader] Frame 3
if (siteLoaded >= siteTotal) {
this.gotoAndPlay("End");
} else {
gotoAndPlay ("Looper");
}
Symbol 60 MovieClip [Loader] Frame 4
if ((_root.s_URL.toLowerCase().indexOf("flashgamelicense.com", 0) <= 0) && (_root.b_FGL)) {
this.stop();
} else if (_root.s_GameAds == "") {
_root.play();
} else if (((((((((((((_root.s_URL.toLowerCase().indexOf("addictinggames", 0) > 0) || (_root.s_URL.toLowerCase().indexOf("smileygamer", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("static.kaisergames.de", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("cdn.kaisergames.de", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("kongregate", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("gamesclub.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("armorgames.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("media.jaludo.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("agame.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("freeonlinegames.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("juegosdiarios.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("dailygames.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("jogosdodia.com", 0) > 0)) {
_root.play();
} else if ((_root.f_TimeDiff(_root.d_AdvertStartTime, new Date()) >= _root.n_CPMWaitTime) || (_root.b_Debugging)) {
this.gotoAndPlay("PlayGame");
}
Symbol 60 MovieClip [Loader] Frame 5
this.gotoAndPlay("End");
Symbol 60 MovieClip [Loader] Frame 6
if (((((((((((((_root.s_URL.toLowerCase().indexOf("addictinggames", 0) > 0) || (_root.s_URL.toLowerCase().indexOf("smileygamer", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("static.kaisergames.de", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("cdn.kaisergames.de", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("kongregate", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("gamesclub.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("armorgames.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("media.jaludo.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("agame.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("freeonlinegames.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("juegosdiarios.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("dailygames.com", 0) > 0)) || (_root.s_URL.toLowerCase().indexOf("jogosdodia.com", 0) > 0)) {
_root.play();
} else {
this.stop();
}
Symbol 110 Button
on (release) {
getURL (_root.s_SponsorLink1 + "preloader", "_blank");
}
Symbol 646 MovieClip [__Packages.mochi.as2.MochiEventDispatcher] Frame 0
class mochi.as2.MochiEventDispatcher
{
var eventTable;
function MochiEventDispatcher () {
eventTable = {};
}
function buildDelegate(thisObject, thatObject) {
var _local2 = {thisObject:thisObject, thatObject:thatObject};
if (thatObject != undefined) {
var funct = ((typeof(thatObject) == "string") ? (thisObject[thatObject]) : (thatObject));
_local2.delegate = function (args) {
funct.call(thisObject, args);
};
} else {
_local2.delegate = thisObject;
}
return(_local2);
}
function compareDelegate(d_A, d_B) {
if ((d_A.thisObject != d_B.thisObject) || (d_A.thatObject != d_B.thatObject)) {
return(false);
}
return(true);
}
function addEventListener(event, thisObject, thatObject) {
removeEventListener(event, thisObject, thatObject);
eventTable[event].push(buildDelegate(thisObject, thatObject));
}
function removeEventListener(event, thisObject, thatObject) {
var _local3 = buildDelegate(thisObject, thatObject);
if (eventTable[event] == undefined) {
eventTable[event] = [];
return(undefined);
}
for (var _local4 in eventTable[event]) {
if (!compareDelegate(eventTable[event][_local4], _local3)) {
continue;
}
eventTable[event].splice(Number(_local4), 1);
}
}
function triggerEvent(event, args) {
if (eventTable[event] == undefined) {
return(undefined);
}
for (var _local4 in eventTable[event]) {
eventTable[event][_local4].delegate(args);
}
}
}
Symbol 647 MovieClip [__Packages.mochi.as2.MochiServices] Frame 0
class mochi.as2.MochiServices
{
static var _id, _container, _clip, _sendChannelName, __get__comChannelName, onError, _listenChannel, _sendChannel;
function MochiServices () {
}
static function get id() {
return(_id);
}
static function get clip() {
return(_container);
}
static function get childClip() {
return(_clip);
}
static function getVersion() {
return("3.9.1 as2");
}
static function allowDomains(server) {
var _local1 = server.split("/")[2].split(":")[0];
if (System.security) {
if (System.security.allowDomain) {
System.security.allowDomain("*");
System.security.allowDomain(_local1);
}
if (System.security.allowInsecureDomain) {
System.security.allowInsecureDomain("*");
System.security.allowInsecureDomain(_local1);
}
}
return(_local1);
}
static function get isNetworkAvailable() {
if (System.security) {
var _local1 = System.security;
if (_local1.sandboxType == "localWithFile") {
return(false);
}
}
return(true);
}
static function set comChannelName(val) {
if (val != undefined) {
if (val.length > 3) {
_sendChannelName = val + "_fromgame";
initComChannels();
}
}
//return(__get__comChannelName());
}
static function get connected() {
return(_connected);
}
static function connect(id, clip, onError) {
warnID(id, false);
if ((!_connected) && (_clip == undefined)) {
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
}
if (onError != undefined) {
mochi.as2.MochiServices.onError = onError;
} else if (mochi.as2.MochiServices.onError == undefined) {
mochi.as2.MochiServices.onError = function (errorCode) {
trace(errorCode);
};
}
}
static function disconnect() {
if (_connected || (_connecting)) {
_connecting = (_connected = false);
flush(true);
if (_clip != undefined) {
_clip.removeMovieClip();
delete _clip;
}
_listenChannel.close();
}
}
static function init(id, clip) {
_id = id;
if (clip != undefined) {
_container = clip;
} else {
_container = _root;
}
loadCommunicator(id, _container);
}
static function loadCommunicator(id, clip) {
var _local6 = "_mochiservices_com_" + id;
var _local5 = new MovieClipLoader();
var _local3 = {};
if (_clip != null) {
return(_clip);
}
if (!isNetworkAvailable) {
return(null);
}
if (urlOptions().servURL) {
_servURL = urlOptions().servURL;
}
var _local4 = _servURL + _services;
if (urlOptions().servicesURL) {
_local4 = urlOptions().servicesURL;
}
allowDomains(_local4);
_clip = clip.createEmptyMovieClip(_local6, 10336, false);
_listenChannelName = _listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor(Math.random() * 99999));
listen();
if (_local3.waitInterval != null) {
clearInterval(_local3.waitInterval);
}
_local3.onLoadError = loadError;
_local3.onLoadStart = function (target_mc) {
this.isLoading = true;
};
_local3.onLoadComplete = function (target_mc) {
target_mc.MochiServices = mochi.as2.MochiServices;
};
_local3.startTime = getTimer();
_local3.wait = function () {
if ((getTimer() - this.startTime) > 10000) {
if (!this.isLoading) {
mochi.as2.MochiServices.disconnect();
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
}
clearInterval(this.waitInterval);
}
};
_local3.waitInterval = setInterval(_local3, "wait", 1000);
_local5.addListener(_local3);
_local5.loadClip((((((_local4 + "?listenLC=") + _listenChannelName) + "&mochiad_options=") + escape(_root.mochiad_options)) + "&api_version=") + getVersion(), _clip);
_sendChannel = new LocalConnection();
_sendChannel._queue = [];
return(_clip);
}
static function loadError(target_mc, errorCode, httpStatus) {
trace("MochiServices could not load.");
disconnect();
onError.apply(null, [errorCode]);
}
static function onStatus(infoObject) {
if (!(infoObject.level === "error")) {
} else {
_connected = false;
_listenChannel.connect(_listenChannelName);
}
}
static function listen() {
_listenChannel = new LocalConnection();
_listenChannel.handshake = function (args) {
mochi.as2.MochiServices.__set__comChannelName(args.newChannel);
};
_listenChannel.allowDomain = function (d) {
return(true);
};
_listenChannel.allowInsecureDomain = _listenChannel.allowDomain;
_listenChannel._nextcallbackID = 0;
_listenChannel._callbacks = {};
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
static function initComChannels() {
if (!_connected) {
_sendChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, version:getVersion()});
_listenChannel.onStatus = function (infoObject) {
mochi.as2.MochiServices.onStatus(infoObject);
};
_listenChannel.onReceive = function (pkg) {
var _local5 = pkg.callbackID;
var _local4 = this._callbacks[_local5];
if (!_local4) {
return(undefined);
}
var _local2 = _local4.callbackMethod;
var _local3 = _local4.callbackObject;
if (_local3 && (typeof(_local2) == "string")) {
_local2 = _local3[_local2];
}
if (_local2 != undefined) {
_local2.apply(_local3, pkg.args);
}
delete this._callbacks[_local5];
};
_listenChannel.onEvent = function (pkg) {
switch (pkg.target) {
case "services" :
mochi.as2.MochiServices.triggerEvent(pkg.event, pkg.args);
break;
case "events" :
mochi.as2.MochiEvents.triggerEvent(pkg.event, pkg.args);
break;
case "coins" :
mochi.as2.MochiCoins.triggerEvent(pkg.event, pkg.args);
break;
case "social" :
mochi.as2.MochiSocial.triggerEvent(pkg.event, pkg.args);
}
};
_listenChannel.onError = function () {
mochi.as2.MochiServices.onError.apply(null, ["IOError"]);
};
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
while (_sendChannel._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _sendChannel._queue.shift());
}
}
}
static function flush(error) {
var _local1;
var _local2;
while (_sendChannel._queue.length > 0) {
_local1 = _sendChannel._queue.shift();
if (_local1.callbackID != null) {
_local2 = _listenChannel._callbacks[_local1.callbackID];
}
delete _listenChannel._callbacks[_local1.callbackID];
if (error) {
handleError(_local1.args, _local2.callbackObject, _local2.callbackMethod);
}
}
}
static function handleError(args, callbackObject, callbackMethod) {
if (args != null) {
if (args.onError != null) {
args.onError.apply(null, ["NotConnected"]);
}
if ((args.options != null) && (args.options.onError != null)) {
args.options.onError.apply(null, ["NotConnected"]);
}
}
if (callbackMethod != null) {
args = {};
args.error = true;
args.errorCode = "NotConnected";
if ((callbackObject != null) && (typeof(callbackMethod) == "string")) {
callbackObject[callbackMethod](args);
} else if (callbackMethod != null) {
callbackMethod.apply(args);
}
}
}
static function send(methodName, args, callbackObject, callbackMethod) {
if (_connected) {
_sendChannel.send(_sendChannelName, "onReceive", {methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
} else {
if ((_clip == undefined) || (!_connecting)) {
trace("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + methodName);
handleError(args, callbackObject, callbackMethod);
flush(true);
return(undefined);
}
_sendChannel._queue.push({methodName:methodName, args:args, callbackID:_listenChannel._nextcallbackID});
}
_listenChannel._callbacks[_listenChannel._nextcallbackID] = {callbackObject:callbackObject, callbackMethod:callbackMethod};
_listenChannel._nextcallbackID++;
}
static function urlOptions() {
var _local5 = {};
var _local6;
if (_root._url.indexOf("mochiad_options") != -1) {
var _local2 = (_root._url.indexOf("mochiad_options") + "mochiad_options".length) + 1;
_local6 = _root._url.substr(_local2, _root._url.length);
} else if (_root.mochiad_options) {
_local6 = _root.mochiad_options;
}
if (_local6) {
var _local4 = _root.mochiad_options.split("&");
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = _local4[_local2].split("=");
_local5[unescape(_local3[0])] = unescape(_local3[1]);
_local2++;
}
}
return(_local5);
}
static function warnID(bid, leaderboard) {
bid = bid.toLowerCase();
if (bid.length != 16) {
trace(("WARNING: " + (leaderboard ? "board" : "game")) + " ID is not the appropriate length");
return(undefined);
}
if (bid == "1e113c7239048b3f") {
if (leaderboard) {
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
}
return(undefined);
}
if (bid == "84993a1de4031cd8") {
if (leaderboard) {
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
}
return(undefined);
}
var _local1 = 0;
while (_local1 < bid.length) {
switch (bid.charAt(_local1)) {
case "0" :
case "1" :
case "2" :
case "3" :
case "4" :
case "5" :
case "6" :
case "7" :
case "8" :
case "9" :
case "a" :
case "b" :
case "c" :
case "d" :
case "e" :
case "f" :
break;
default :
trace("WARNING: Board ID contains illegal characters: " + bid);
return(undefined);
}
_local1++;
}
}
static function addLinkEvent(url, burl, btn, onClick) {
var timeout = 1500;
var t0 = getTimer();
var _local2 = new Object();
_local2.mav = getVersion();
_local2.swfv = btn.getSWFVersion() || 6;
_local2.swfurl = btn._url;
_local2.fv = System.capabilities.version;
_local2.os = System.capabilities.os;
_local2.lang = System.capabilities.language;
_local2.scres = (System.capabilities.screenResolutionX + "x") + System.capabilities.screenResolutionY;
var s = "?";
var _local3 = 0;
for (var _local6 in _local2) {
if (_local3 != 0) {
s = s + "&";
}
_local3++;
s = ((s + _local6) + "=") + escape(_local2[_local6]);
}
if (!(netupAttempted || (_connected))) {
var ping = btn.createEmptyMovieClip("ping", 777);
var _local7 = btn.createEmptyMovieClip("nettest", 778);
netupAttempted = true;
ping.loadMovie("http://link.mochiads.com/linkping.swf?t=" + getTimer());
_local7.onEnterFrame = function () {
if ((ping._totalframes > 0) && (ping._totalframes == ping._framesloaded)) {
delete this.onEnterFrame;
} else if ((getTimer() - t0) > timeout) {
delete this.onEnterFrame;
mochi.as2.MochiServices.netup = false;
}
};
}
var _local4 = btn.createEmptyMovieClip("clk", 1001);
_local4._alpha = 0;
_local4.beginFill(1044735);
_local4.moveTo(0, 0);
_local4.lineTo(0, btn._height);
_local4.lineTo(btn._width, btn._height);
_local4.lineTo(btn._width, 0);
_local4.lineTo(0, 0);
_local4.endFill();
_local4.onRelease = function () {
if (mochi.as2.MochiServices.netup) {
getURL (url + s, "_blank");
} else {
getURL (burl, "_blank");
}
if (onClick != undefined) {
onClick();
}
};
}
static function setContainer(clip) {
}
static function stayOnTop(clip) {
}
static function addEventListener(eventType, thisObject, thatObject) {
_dispatcher.addEventListener(eventType, thisObject, thatObject);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, thisObject, thatObject) {
_dispatcher.removeEventListener(eventType, thisObject, thatObject);
}
static var CONNECTED = "onConnected";
static var _servURL = "http://www.mochiads.com/static/lib/services/";
static var _services = "services.swf";
static var _mochiLC = "MochiLC.swf";
static var _listenChannelName = "__ms_";
static var _connecting = false;
static var _connected = false;
static var netup = true;
static var netupAttempted = false;
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 648 MovieClip [__Packages.mochi.as2.MochiEvents] Frame 0
class mochi.as2.MochiEvents
{
function MochiEvents () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function startSession(achievementID) {
mochi.as2.MochiServices.send("events_beginSession", {achievementID:achievementID}, null, null);
}
static function setNotifications(clip, style) {
var _local2 = {};
for (var _local3 in style) {
_local2[_local3] = style[_local3];
}
_local2.clip = clip;
mochi.as2.MochiServices.send("events_setNotifications", _local2, null, null);
}
static function addEventListener(eventType, thisObject, thatObject) {
_dispatcher.addEventListener(eventType, thisObject, thatObject);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, thisObject, thatObject) {
_dispatcher.removeEventListener(eventType, thisObject, thatObject);
}
static function startPlay(tag) {
if (tag == undefined) {
tag = "gameplay";
}
mochi.as2.MochiServices.send("events_setRoundID", {tag:String(tag)}, null, null);
}
static function endPlay() {
mochi.as2.MochiServices.send("events_clearRoundID", null, null, null);
}
static function trackEvent(tag, value) {
mochi.as2.MochiServices.send("events_trackEvent", {tag:tag, value:value}, null, null);
}
static var ACHIEVEMENT_RECEIVED = "AchievementReceived";
static var ALIGN_TOP_LEFT = "ALIGN_TL";
static var ALIGN_TOP = "ALIGN_T";
static var ALIGN_TOP_RIGHT = "ALIGN_TR";
static var ALIGN_LEFT = "ALIGN_L";
static var ALIGN_CENTER = "ALIGN_C";
static var ALIGN_RIGHT = "ALIGN_R";
static var ALIGN_BOTTOM_LEFT = "ALIGN_BL";
static var ALIGN_BOTTOM = "ALIGN_B";
static var ALIGN_BOTTOM_RIGHT = "ALIGN_BR";
static var FORMAT_SHORT = "ShortForm";
static var FORMAT_LONG = "LongForm";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 649 MovieClip [__Packages.mochi.as2.MochiCoins] Frame 0
class mochi.as2.MochiCoins
{
function MochiCoins () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function showStore(options) {
mochi.as2.MochiServices.send("coins_showStore", {options:options}, null, null);
}
static function showItem(options) {
if ((options == undefined) || (typeof(options.item) != "string")) {
trace("ERROR: showItem call must pass an Object with an item key");
return(undefined);
}
mochi.as2.MochiServices.send("coins_showItem", {options:options}, null, null);
}
static function showVideo(options) {
if ((options == undefined) || (typeof(options.item) != "string")) {
trace("ERROR: showVideo call must pass an Object with an item key");
return(undefined);
}
mochi.as2.MochiServices.send("coins_showVideo", {options:options}, null, null);
}
static function getStoreItems() {
mochi.as2.MochiServices.send("coins_getStoreItems");
}
static function requestFunding(properties) {
mochi.as2.MochiServices.send("social_requestFunding", properties);
}
static function addEventListener(eventType, delegate) {
_dispatcher.addEventListener(eventType, delegate);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, delegate) {
_dispatcher.removeEventListener(eventType, delegate);
}
static var STORE_SHOW = "StoreShow";
static var STORE_HIDE = "StoreHide";
static var ITEM_OWNED = "ItemOwned";
static var ITEM_NEW = "ItemNew";
static var STORE_ITEMS = "StoreItems";
static var ERROR = "Error";
static var IO_ERROR = "IOError";
static var NO_USER = "NoUser";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 650 MovieClip [__Packages.mochi.as2.MochiSocial] Frame 0
class mochi.as2.MochiSocial
{
function MochiSocial () {
}
static function getVersion() {
return(mochi.as2.MochiServices.getVersion());
}
static function showLoginWidget(options) {
mochi.as2.MochiServices.setContainer();
mochi.as2.MochiServices.stayOnTop();
mochi.as2.MochiServices.send("social_showLoginWidget", {options:options});
}
static function hideLoginWidget() {
mochi.as2.MochiServices.send("social_hideLoginWidget");
}
static function requestLogin(properties) {
mochi.as2.MochiServices.send("social_requestLogin", properties);
}
static function getFriendsList(properties) {
mochi.as2.MochiServices.send("social_getFriendsList", properties);
}
static function postToStream(properties) {
mochi.as2.MochiServices.send("social_postToStream", properties);
}
static function inviteFriends(properties) {
mochi.as2.MochiServices.send("social_inviteFriends", properties);
}
static function requestFan(properties) {
mochi.as2.MochiServices.send("social_requestFan", properties);
}
static function saveUserProperties(properties) {
mochi.as2.MochiServices.send("social_saveUserProperties", properties);
}
static function addEventListener(eventType, delegate) {
_dispatcher.addEventListener(eventType, delegate);
}
static function triggerEvent(eventType, args) {
_dispatcher.triggerEvent(eventType, args);
}
static function removeEventListener(eventType, delegate) {
_dispatcher.removeEventListener(eventType, delegate);
}
static var LOGGED_IN = "LoggedIn";
static var LOGGED_OUT = "LoggedOut";
static var LOGIN_SHOW = "LoginShow";
static var LOGIN_HIDE = "LoginHide";
static var LOGIN_SHOWN = "LoginShown";
static var PROFILE_SHOW = "ProfileShow";
static var PROFILE_HIDE = "ProfileHide";
static var PROPERTIES_SAVED = "PropertySaved";
static var WIDGET_LOADED = "WidgetLoaded";
static var FRIEND_LIST = "FriendsList";
static var PROFILE_DATA = "ProfileData";
static var GAMEPLAY_DATA = "GameplayData";
static var ACTION_CANCELED = "onCancel";
static var ACTION_COMPLETE = "onComplete";
static var USER_INFO = "UserInfo";
static var ERROR = "Error";
static var IO_ERROR = "IOError";
static var NO_USER = "NoUser";
static var PROPERTIES_SIZE = "PropertiesSize";
static var _dispatcher = new mochi.as2.MochiEventDispatcher();
}
Symbol 651 MovieClip [__Packages.mochi.as2.MochiScores] Frame 0
class mochi.as2.MochiScores
{
static var boardID, onClose, onError;
function MochiScores () {
}
static function setBoardID(boardID) {
mochi.as2.MochiServices.warnID(boardID, true);
mochi.as2.MochiScores.boardID = boardID;
mochi.as2.MochiServices.send("scores_setBoardID", {boardID:boardID});
}
static function showLeaderboard(options) {
options.clip = mochi.as2.MochiServices.clip;
if ((options.clip != mochi.as2.MochiServices.__get__clip()) || (mochi.as2.MochiServices.__get__childClip()._target == undefined)) {
mochi.as2.MochiServices.disconnect();
trace("WARNING! This application is attempting to connect to MochiServices inside a showLeaderboard call!");
trace("make sure MochiServices.connect is called as early in the application runtime as possible.");
mochi.as2.MochiServices.connect(mochi.as2.MochiServices.__get__id(), options.clip);
}
delete options.clip;
if (options.name != null) {
if (typeof(options.name) == "object") {
if (options.name.text != undefined) {
options.name = options.name.text;
}
}
}
if (options.score != null) {
if (options.score instanceof TextField) {
if (options.score.text != undefined) {
options.score = options.score.text;
}
} else if (options.score instanceof mochi.as2.MochiDigits) {
options.score = options.score.value;
}
var _local1 = Number(options.score);
if (isNaN(_local1)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'");
} else if ((_local1 == Number.NEGATIVE_INFINITY) || (_local1 == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(_local1) != _local1) {
trace(("WARNING: Submitted score '" + options.score) + "' will be truncated");
}
options.score = _local1;
}
}
if (options.onDisplay != null) {
options.onDisplay();
} else {
mochi.as2.MochiServices.__get__clip().stop();
}
if (options.onClose != null) {
onClose = options.onClose;
} else {
onClose = function () {
mochi.as2.MochiServices.__get__clip().play();
};
}
if (options.onError != null) {
onError = options.onError;
} else {
onError = onClose;
}
if (options.boardID == null) {
if (boardID != null) {
options.boardID = boardID;
}
}
mochi.as2.MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
mochi.as2.MochiServices.send("scores_showLeaderboard", {options:options}, null, doClose);
}
static function closeLeaderboard() {
mochi.as2.MochiServices.send("scores_closeLeaderboard");
}
static function getPlayerInfo(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_getPlayerInfo", null, callbackObj, callbackMethod);
}
static function submit(score, name, callbackObj, callbackMethod) {
score = Number(score);
if (isNaN(score)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is 'Not a Number'");
} else if ((score == Number.NEGATIVE_INFINITY) || (score == Number.POSITIVE_INFINITY)) {
trace(("ERROR: Submitted score '" + String(score)) + "' will be rejected, score is an infinite");
} else {
if (Math.floor(score) != score) {
trace(("WARNING: Submitted score '" + String(score)) + "' will be truncated");
}
score = Number(score);
}
mochi.as2.MochiServices.send("scores_submit", {score:score, name:name}, callbackObj, callbackMethod);
}
static function requestList(callbackObj, callbackMethod) {
mochi.as2.MochiServices.send("scores_requestList", null, callbackObj, callbackMethod);
}
static function scoresArrayToObjects(scores) {
var _local5 = {};
var _local1;
var _local4;
var _local2;
var _local6;
for (var _local8 in scores) {
if (typeof(scores[_local8]) == "object") {
if ((scores[_local8].cols != null) && (scores[_local8].rows != null)) {
_local5[_local8] = [];
_local2 = scores[_local8];
_local4 = 0;
while (_local4 < _local2.rows.length) {
_local6 = {};
_local1 = 0;
while (_local1 < _local2.cols.length) {
_local6[_local2.cols[_local1]] = _local2.rows[_local4][_local1];
_local1++;
}
_local5[_local8].push(_local6);
_local4++;
}
} else {
_local5[_local8] = {};
for (var _local7 in scores[_local8]) {
_local5[_local8][_local7] = scores[_local8][_local7];
}
}
} else {
_local5[_local8] = scores[_local8];
}
}
return(_local5);
}
static function doClose(args) {
if (args.error == true) {
if (args.errorCode == undefined) {
args.errorCode = "IOError";
}
onError.apply(null, [args.errorCode]);
} else {
onClose.apply();
}
}
}
Symbol 652 MovieClip [__Packages.mochi.as2.MochiDigits] Frame 0
class mochi.as2.MochiDigits
{
var Encoder, Fragment, Sibling;
function MochiDigits (digit, index) {
Encoder = 0;
setValue(digit, index);
}
function get value() {
return(Number(toString()));
}
function set value(v) {
setValue(v);
//return(value);
}
function addValue(v) {
value = value + v;
}
function setValue(digit, index) {
var _local3 = digit.toString();
if ((index == undefined) || (isNaN(index))) {
index = 0;
}
Fragment = _local3.charCodeAt(index++) ^ Encoder;
if (index < _local3.length) {
Sibling = new mochi.as2.MochiDigits(digit, index);
} else {
Sibling = null;
}
reencode();
}
function reencode() {
var _local2 = int(2147483647 * Math.random());
Fragment = Fragment ^ (_local2 ^ Encoder);
Encoder = _local2;
}
function toString() {
var _local2 = String.fromCharCode(Fragment ^ Encoder);
return(((Sibling != null) ? (_local2.concat(Sibling.toString())) : (_local2)));
}
}
Symbol 117 MovieClip [StartLevelAnim] Frame 49
_root.f_Invulnerable(false);
if (_root.s_GameMode != "menu") {
if (_root.n_AchievementGames == undefined) {
_root.n_AchievementGames = 0;
}
if (_root.n_AchievementGames < _root.n_AchievementCap) {
_root.n_AchievementGames++;
if (_root.n_AchievementGames >= 5) {
_root.f_MarkAchievement("Games_5");
}
if (_root.n_AchievementGames >= 25) {
_root.f_MarkAchievement("Games_25");
}
if (_root.n_AchievementGames >= 100) {
_root.f_MarkAchievement("Games_100");
}
}
}
this.removeMovieClip();
Symbol 131 MovieClip [Messages] Frame 51
this.removeMovieClip();
Symbol 131 MovieClip [Messages] Frame 102
this.removeMovieClip();
Symbol 149 MovieClip [Lightening_Holder] Frame 1
var n_Timer;
var o_Items;
var o_Ball;
Symbol 155 MovieClip [Beam_Holder] Frame 1
var n_Timer;
var o_Items;
var o_Ball;
Symbol 158 MovieClip [Collect] Frame 1
var n_ClickID;
var o_VelocityObject;
var n_Size;
var n_Radius;
var n_Timer;
Symbol 166 MovieClip [Needed_Show] Frame 1
Symbol 167 MovieClip [NeededAnim] Frame 59
this.removeMovieClip();
Symbol 170 MovieClip [Collect_Anim] Frame 16
this.removeMovieClip();
Symbol 177 Button
on (release) {
this.s_NextMode = "continue";
this.b_Finished = true;
}
Symbol 220 Button
on (release) {
getURL (_root.s_SponsorLink1 + "instructions", "_blank");
}
Symbol 233 MovieClip [Instructions] Frame 1
var b_Done = false;
var b_Finished = false;
var s_NextMode = "";
Symbol 233 MovieClip [Instructions] Frame 15
if (!this.b_Done) {
this.b_Done = true;
this.b_Finished = false;
this.o_Inner.gotoAndStop("Instruction_" + _root.o_Levels[_root.n_Level]._instr.toString());
}
Symbol 233 MovieClip [Instructions] Frame 16
if (!this.b_Finished) {
this.gotoAndPlay("Hold");
}
Symbol 233 MovieClip [Instructions] Frame 31
_root.b_Instructions = false;
_root.o_EffectsContainer.attachMovie("StartLevelAnim", "o_StartLevelAnim", _root.o_EffectsContainer.getNextDepth(), {_x:_root.o_FriendObject._x, _y:_root.o_FriendObject._y});
this.removeMovieClip();
Symbol 233 MovieClip [Instructions] Frame 45
if (!this.b_Done) {
this.b_Done = true;
this.b_Finished = false;
}
Symbol 233 MovieClip [Instructions] Frame 46
if (!this.b_Finished) {
this.gotoAndPlay("Hold2");
}
Symbol 233 MovieClip [Instructions] Frame 61
_root.b_Instructions = false;
_root.o_EffectsContainer.attachMovie("StartLevelAnim", "o_StartLevelAnim", _root.o_EffectsContainer.getNextDepth(), {_x:_root.o_FriendObject._x, _y:_root.o_FriendObject._y});
this.removeMovieClip();
Symbol 417 MovieClip [Achievement_Message] Frame 65
this.removeMovieClip();
Symbol 419 Button
on (release) {
getURL (_root.s_SponsorLink1 + "splash", "_blank");
}
Symbol 429 MovieClip Frame 65
stop();
Symbol 436 MovieClip Frame 67
stopAllSounds();
stop();
Symbol 459 MovieClip Frame 56
stopAllSounds();
stop();
Symbol 462 MovieClip Frame 1
stop();
Symbol 462 MovieClip Frame 46
this.stop();
Symbol 463 MovieClip [Splash_Graphics] Frame 2
o_Logo.gotoAndPlay(2);
Symbol 463 MovieClip [Splash_Graphics] Frame 181
_root.stopAllSounds();
_root.play();
Symbol 478 MovieClip [Sounds] Frame 2
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 4
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 6
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 8
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 10
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 12
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 14
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 16
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 18
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 20
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 22
gotoAndStop (1);
Symbol 478 MovieClip [Sounds] Frame 24
gotoAndStop (1);
Symbol 512 Button
on (release) {
getURL (_root.s_SponsorLink1 + "menu", "_blank");
}
Symbol 516 Button
on (release) {
_root.f_CalcLevels();
_root.o_MenuPosition._x = 600;
}
Symbol 520 Button
on (release) {
_root.o_MenuPosition._x = -600;
_root.f_MarkAchievement("Credits");
_root.f_SetAchievements(_root.o_MenuOverlay.o_MenuScroller.o_Main.o_HomeAchievements, []);
}
Symbol 524 Button
on (release) {
_root.f_ToggleSounds();
_root.f_SetAchievements(_root.o_MenuOverlay.o_MenuScroller.o_Main.o_HomeAchievements, []);
}
Symbol 528 Button
on (release) {
_root.f_ToggleSounds();
_root.f_SetAchievements(_root.o_MenuOverlay.o_MenuScroller.o_Main.o_HomeAchievements, []);
}
Symbol 529 MovieClip [SoundsOnOff_SansKey] Frame 1
if (_root.b_SoundsOn == false) {
this.gotoAndPlay("Off");
} else {
this.gotoAndPlay("On");
}
Symbol 529 MovieClip [SoundsOnOff_SansKey] Frame 3
if (_root.b_SoundsOn) {
this.gotoAndPlay("On");
} else {
this.gotoAndPlay("Off");
}
Symbol 529 MovieClip [SoundsOnOff_SansKey] Frame 5
if (_root.b_SoundsOn) {
this.gotoAndPlay("On");
} else {
this.gotoAndPlay("Off");
}
Symbol 535 Button
on (release) {
_root.s_GameStyle = "level";
_root.f_DoScores(true);
}
Symbol 539 Button
on (release) {
_root.f_StartGame("game", 1, "survival");
}
Symbol 540 Button
on (release) {
_root.s_GameStyle = "survival";
_root.f_DoScores(true);
}
Symbol 545 Button
on (release) {
_root.f_MarkAchievement("Sponsor");
_root.f_SetAchievements(_root.o_MenuOverlay.o_MenuScroller.o_Main.o_HomeAchievements, []);
getURL (_root.s_SponsorLink2, "_blank");
}
Symbol 546 Button
on (rollOver) {
if (this.o_Label.text != " ") {
_parent._parent.o_Hover._visible = true;
_parent._parent.o_Hover.o_Label.text = this.o_Label.text;
_parent._parent.o_Hover._x = _parent._x + this._x;
_parent._parent.o_Hover._y = _parent._y + this._y;
}
}
on (rollOut) {
_parent._parent.o_Hover._visible = false;
}
Symbol 561 Button
on (release) {
var n_NewLevelID = int(_name.split("_")[2]);
if (((_root.n_NextPlayableID == n_NewLevelID) || (_root.o_Levels[n_NewLevelID]._completed)) || (_root.b_Testing)) {
_root.f_StartGame("game", n_NewLevelID, "level");
}
}
Symbol 577 Button
on (release) {
_root.o_MenuPosition = new Object({_x:0, _y:300});
}
Symbol 586 Button
on (release) {
getURL ("http://www.facebook.com/pages/The-Naked-Developer/161906737175219", "_blank");
}
Symbol 592 Button
on (release) {
_root.n_OverallScore = _root.f_CalculateScore();
_root.f_DoScores(false);
}
Symbol 611 MovieClip [Star_Animation] Frame 20
this.stop();
Symbol 614 Button
on (release) {
_root.f_MarkAchievement("High_Level");
var o = {n:[3, 11, 6, 8, 5, 9, 12, 10, 4, 14, 11, 5, 1, 4, 7, 0], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.n_OverallScore});
}
Symbol 620 Button
on (release) {
getURL (_root.s_SponsorLink1 + "endlevel", "_blank");
}
Symbol 622 Button
on (release) {
_root.f_MarkAchievement("High_Survival");
var o = {n:[14, 11, 0, 15, 7, 3, 9, 4, 13, 13, 11, 12, 3, 6, 13, 8], f:function (i, s) {
if (s.length == 16) {
return(s);
}
return(this.f(i + 1, s + this.n[i].toString(16)));
}};
var boardID = o.f(0, "");
mochi.as2.MochiScores.showLeaderboard({boardID:boardID, score:_root.n_OverallScore});
}
Symbol 623 Button
on (release) {
this.s_NextMode = "menu";
this.b_Finished = true;
}
Symbol 626 Button
on (release) {
this.s_NextMode = "tryagain";
this.b_Finished = true;
}
Symbol 642 Button
on (release) {
this.s_NextMode = "scores";
this.b_Finished = true;
_root.f_DoScores(false);
}
Symbol 645 MovieClip [EndScreen] Frame 1
var b_Done = false;
var b_Finished = false;
var s_NextMode = "";
this.stop();
Symbol 645 MovieClip [EndScreen] Frame 15
var n_Stars;
var n_3StarPerc;
var s_Text = "";
if (!this.b_Done) {
if (_root.n_Score > _root.o_Levels[_root.n_Level]._score) {
_root.o_Levels[_root.n_Level]._score = _root.n_Score;
}
_root.n_OverallScore = _root.f_CalculateScore();
this.o_Score.text = _root.n_Score;
this.o_OverallScore.text = _root.n_OverallScore.toString();
this.o_Title.text = ("You Completed Level " + _root.n_Level.toString()) + "!";
this.n_Stars = 1;
this.o_Star1.gotoAndPlay("Star");
this.s_Text = this.s_Text + "Level Complete (+1)";
if (_root.n_ClicksOnWin > 0) {
this.n_Stars++;
if (this.s_Text.length > 0) {
this.s_Text = this.s_Text + ", ";
}
this.s_Text = this.s_Text + "Clicks Left (+1)";
}
if (_root.n_ClicksOnWin == _root.n_ClicksAllowed) {
_root.f_MarkAchievement(((_root.o_Levels[_root.n_Level]._group + "_") + _root.n_ClicksOnWin.toString()) + "CF");
}
this.n_3StarPerc = Math.floor(_root.n_GamePercentNeeded + 10);
if (this.n_3StarPerc > 100) {
this.n_3StarPerc = 100;
}
if (this.n_3StarPerc <= Math.floor(_root.n_GamePercent)) {
this.n_Stars++;
if (this.s_Text.length > 0) {
this.s_Text = this.s_Text + ", ";
}
if (this.n_Stars == 3) {
this.s_Text = this.s_Text + newline;
}
this.s_Text = this.s_Text + "10% Extra Collected (+1)";
}
this.s_Text = this.s_Text + ".";
if (this.n_Stars >= 2) {
this.o_Star2.gotoAndPlay("Star");
} else {
this.o_Star2.gotoAndStop("NoStar");
}
if (this.n_Stars == 3) {
this.o_Star3.gotoAndPlay("Star");
} else {
this.o_Star3.gotoAndStop("NoStar");
}
this.o_StarReason.text = this.s_Text;
if (_root.o_Levels[_root.n_Level]._stars < this.n_Stars) {
_root.o_Levels[_root.n_Level]._stars = this.n_Stars;
}
var o_CheckAchieve = [{_group:"B", _smallest:3}, {_group:"S", _smallest:3}, {_group:"A", _smallest:3}, {_group:"E", _smallest:3}];
var n_j = 0;
while (n_j < o_CheckAchieve.length) {
var n_k = 1;
while (n_k < _root.o_Levels.length) {
if ((o_CheckAchieve[n_j]._group == _root.o_Levels[n_k]._group) && (o_CheckAchieve[n_j]._smallest > _root.o_Levels[n_k]._stars)) {
o_CheckAchieve[n_j]._smallest = _root.o_Levels[n_k]._stars;
}
n_k++;
}
if (o_CheckAchieve[n_j]._smallest >= 1) {
_root.f_MarkAchievement(o_CheckAchieve[n_j]._group + "_1Star");
if (o_CheckAchieve[n_j]._group == "B") {
_root.f_MarkAchievement("Survival");
}
}
if (o_CheckAchieve[n_j]._smallest >= 2) {
_root.f_MarkAchievement(o_CheckAchieve[n_j]._group + "_2Star");
}
if (o_CheckAchieve[n_j]._smallest == 3) {
_root.f_MarkAchievement(o_CheckAchieve[n_j]._group + "_3Star");
}
n_j++;
}
if ((((o_CheckAchieve[0]._smallest >= 1) && (o_CheckAchieve[1]._smallest >= 1)) && (o_CheckAchieve[2]._smallest >= 1)) && (o_CheckAchieve[3]._smallest >= 1)) {
_root.f_MarkAchievement("X_1Star");
}
if ((((o_CheckAchieve[0]._smallest >= 2) && (o_CheckAchieve[1]._smallest >= 2)) && (o_CheckAchieve[2]._smallest >= 2)) && (o_CheckAchieve[3]._smallest >= 2)) {
_root.f_MarkAchievement("X_2Star");
}
if ((((o_CheckAchieve[0]._smallest == 3) && (o_CheckAchieve[1]._smallest == 3)) && (o_CheckAchieve[2]._smallest == 3)) && (o_CheckAchieve[3]._smallest == 3)) {
_root.f_MarkAchievement("X_3Star");
}
_root.f_SetAchievements(this.o_AchievementDisplay, _root.o_AchievementsNew);
if (_root.n_AchievementCollects >= 50) {
_root.f_MarkAchievement("Part_50");
}
if (_root.n_AchievementCollects >= 500) {
_root.f_MarkAchievement("Part_500");
}
if (_root.n_AchievementCollects >= 5000) {
_root.f_MarkAchievement("Part_5000");
}
_root.f_StoreLevelData();
this.b_Done = true;
this.b_Finished = false;
}
Symbol 645 MovieClip [EndScreen] Frame 16
if (!this.b_Finished) {
this.gotoAndPlay("Hold");
}
Symbol 645 MovieClip [EndScreen] Frame 31
if (this.s_NextMode == "continue") {
_root.b_EndScreen = false;
_root.f_StartGame(_root.s_GameMode, Number(_root.n_Level) + 1, _root.s_GameStyle);
}
this._x = 2000;
this.gotoAndStop(1);
Symbol 645 MovieClip [EndScreen] Frame 45
if (!this.b_Done) {
_root.n_OverallScore = _root.n_Score;
this.o_Score.text = _root.n_Score.toString();
this.o_Clicks.text = _root.n_SurvivalTotalClicks.toString();
this.o_Atoms.text = _root.n_SurvivalBallsPopped.toString();
this.o_Particles.text = _root.n_SurvivalTotalCollects.toString();
this.b_Done = true;
this.b_Finished = false;
}
Symbol 645 MovieClip [EndScreen] Frame 46
if (!this.b_Finished) {
this.gotoAndPlay("Hold2");
}
Symbol 645 MovieClip [EndScreen] Frame 61
if (this.s_NextMode == "tryagain") {
_root.b_EndScreen = false;
_root.f_StartGame(_root.s_GameMode, 1, _root.s_GameStyle);
} else if (this.s_NextMode == "menu") {
_root.s_GameMode = "menu";
_root.s_GameStyle = "level";
_root.b_Setup = false;
_root.gotoAndPlay("Game");
}
this._x = 2000;
this.gotoAndStop(1);
Symbol 645 MovieClip [EndScreen] Frame 75
var n_Stars;
var n_3StarPerc;
var s_Text = "";
if (!this.b_Done) {
if (_root.n_Score > _root.o_Levels[_root.n_Level]._score) {
_root.o_Levels[_root.n_Level]._score = _root.n_Score;
}
_root.n_OverallScore = _root.f_CalculateScore();
this.o_Score.text = _root.n_Score;
this.o_OverallScore.text = _root.n_OverallScore.toString();
this.o_Title.text = ("You Completed Level " + _root.n_Level.toString()) + "!";
this.n_Stars = 1;
this.o_Star1.gotoAndPlay("Star");
this.s_Text = this.s_Text + "Level Complete (+1)";
if (_root.n_ClicksOnWin > 0) {
this.n_Stars++;
if (this.s_Text.length > 0) {
this.s_Text = this.s_Text + ", ";
}
this.s_Text = this.s_Text + "Clicks Left (+1)";
}
if (_root.n_ClicksOnWin == _root.n_ClicksAllowed) {
_root.f_MarkAchievement(((_root.o_Levels[_root.n_Level]._group + "_") + _root.n_ClicksOnWin.toString()) + "CF");
}
this.n_3StarPerc = Math.floor(_root.n_GamePercentNeeded + 10);
if (this.n_3StarPerc > 100) {
this.n_3StarPerc = 100;
}
if (this.n_3StarPerc <= Math.floor(_root.n_GamePercent)) {
this.n_Stars++;
if (this.s_Text.length > 0) {
this.s_Text = this.s_Text + ", ";
}
if (this.n_Stars == 3) {
this.s_Text = this.s_Text + newline;
}
this.s_Text = this.s_Text + "10% Extra Collected (+1)";
}
this.s_Text = this.s_Text + ".";
if (this.n_Stars >= 2) {
this.o_Star2.gotoAndPlay("Star");
} else {
this.o_Star2.gotoAndStop("NoStar");
}
if (this.n_Stars == 3) {
this.o_Star3.gotoAndPlay("Star");
} else {
this.o_Star3.gotoAndStop("NoStar");
}
this.o_StarReason.text = this.s_Text;
if (_root.o_Levels[_root.n_Level]._stars < this.n_Stars) {
_root.o_Levels[_root.n_Level]._stars = this.n_Stars;
}
var o_CheckAchieve = [{_group:"B", _smallest:3}, {_group:"S", _smallest:3}, {_group:"A", _smallest:3}, {_group:"E", _smallest:3}];
var n_j = 0;
while (n_j < o_CheckAchieve.length) {
var n_k = 1;
while (n_k < _root.o_Levels.length) {
if ((o_CheckAchieve[n_j]._group == _root.o_Levels[n_k]._group) && (o_CheckAchieve[n_j]._smallest > _root.o_Levels[n_k]._stars)) {
o_CheckAchieve[n_j]._smallest = _root.o_Levels[n_k]._stars;
}
n_k++;
}
if (o_CheckAchieve[n_j]._smallest >= 1) {
_root.f_MarkAchievement(o_CheckAchieve[n_j]._group + "_1Star");
if (o_CheckAchieve[n_j]._group == "B") {
_root.f_MarkAchievement("Survival");
}
}
if (o_CheckAchieve[n_j]._smallest >= 2) {
_root.f_MarkAchievement(o_CheckAchieve[n_j]._group + "_2Star");
}
if (o_CheckAchieve[n_j]._smallest == 3) {
_root.f_MarkAchievement(o_CheckAchieve[n_j]._group + "_3Star");
}
n_j++;
}
if ((((o_CheckAchieve[0]._smallest >= 1) && (o_CheckAchieve[1]._smallest >= 1)) && (o_CheckAchieve[2]._smallest >= 1)) && (o_CheckAchieve[3]._smallest >= 1)) {
_root.f_MarkAchievement("X_1Star");
}
if ((((o_CheckAchieve[0]._smallest >= 2) && (o_CheckAchieve[1]._smallest >= 2)) && (o_CheckAchieve[2]._smallest >= 2)) && (o_CheckAchieve[3]._smallest >= 2)) {
_root.f_MarkAchievement("X_2Star");
}
if ((((o_CheckAchieve[0]._smallest == 3) && (o_CheckAchieve[1]._smallest == 3)) && (o_CheckAchieve[2]._smallest == 3)) && (o_CheckAchieve[3]._smallest == 3)) {
_root.f_MarkAchievement("X_3Star");
}
_root.f_SetAchievements(this.o_AchievementDisplay, _root.o_AchievementsNew);
if (_root.n_AchievementCollects >= 50) {
_root.f_MarkAchievement("Part_50");
}
if (_root.n_AchievementCollects >= 500) {
_root.f_MarkAchievement("Part_500");
}
if (_root.n_AchievementCollects >= 5000) {
_root.f_MarkAchievement("Part_5000");
}
_root.f_StoreLevelData();
this.b_Done = true;
this.b_Finished = false;
}
Symbol 645 MovieClip [EndScreen] Frame 76
if (!this.b_Finished) {
this.gotoAndPlay("GameHold");
}
Symbol 645 MovieClip [EndScreen] Frame 91
if (this.s_NextMode == "continue") {
_root.b_EndScreen = false;
_root.f_StartGame(_root.s_GameMode, Number(_root.n_Level) + 1, _root.s_GameStyle);
} else if (this.s_NextMode == "menu") {
_root.s_GameMode = "menu";
_root.s_GameStyle = "level";
_root.b_Setup = false;
_root.gotoAndPlay("Game");
}
this._x = 2000;
this.gotoAndStop(1);