Frame 3
stot = this.getBytesTotal();
sloa = this.getBytesLoaded();
if (stot != 0) {
per = Math.floor((sloa / stot) * 100);
} else {
per = 0;
}
mc_bar.mc._x = mc_bar.mc._width * (-1 + (sloa / stot));
mc_bar.mc1._x = mc_bar.mc._width * (-1 + (sloa / stot));
txtPer = String(per) + "%";
if (((sloa >= 1) && (stot >= 1)) && (sloa == stot)) {
gotoAndPlay ("att");
inMenuFirst();
} else {
gotoAndPlay (2);
}
Frame 4
var soundss = 1;
var btn = new Sound();
btn.attachSound("snd_GunFire");
var btn = new Sound();
btn.attachSound("snd_BubbleLevelUp");
var btn = new Sound();
btn.attachSound("snd_BubbleCollisionR");
var btn = new Sound();
btn.attachSound("snd_BubbleCollision");
var btn = new Sound();
btn.attachSound("title animation");
var btn = new Sound();
btn.attachSound("button1");
var btn = new Sound();
btn.attachSound("boing");
btn.onSoundComplete = function () {
btn.start();
};
Frame 5
stop();
var btn = new Sound();
btn.attachSound("menusound");
btn.start(0, 2000);
Frame 6
stop();
var r = 1;
Instance of Symbol 166 MovieClip "mc_sloop" in Frame 6
onClipEvent (load) {
var soundControl = new Sound(this);
}
Frame 8
stop();
Frame 11
this.stop();
var btn = new Sound();
btn.attachSound("BG");
btn.start(0, 2000);
if (soundss == 1) {
btn_sound.gotoAndStop(1);
} else {
btn_sound.gotoAndStop(2);
}
var mouseListener = new Object();
mouseListener.onMouseDown = function () {
if (_root.morebtnactive == false) {
myMouseDown();
}
};
mouseListener.onMouseUp = function () {
};
Mouse.addListener(mouseListener);
Instance of Symbol 200 MovieClip "mc_Bigsmile" in Frame 11
onClipEvent (enterFrame) {
this._y = _global.rr;
}
Instance of Symbol 214 MovieClip [lib_ind] "mc_ind" in Frame 11
onClipEvent (enterFrame) {
if (_root.r == 0) {
this.gotoAndStop(2);
}
}
Instance of Symbol 202 MovieClip "mc_control" in Frame 11
onClipEvent (load) {
this._parent.initLevel();
}
onClipEvent (enterFrame) {
this._parent.processGame();
}
onClipEvent (mouseMove) {
this._parent.myMouseMove();
updateAfterEvent();
}
onClipEvent (mouseDown) {
with (this._parent) {
if ((_xmouse < (btn_sound._x + (btn_sound._width / 2))) && (_ymouse > (btn_sound._y - (btn_sound._height / 2)))) {
return(undefined);
}
}
this._parent.myMouseDown();
updateAfterEvent();
}
onClipEvent (keyDown) {
this._parent.myKeyDown();
updateAfterEvent();
}
Instance of Symbol 242 MovieClip "btn_sound" in Frame 11
/* no clip actions */
Symbol 1 MovieClip Frame 1
#initclip 8
function new_game_pressed() {
this.gotoAndStop("menu");
}
function how_to_play_pressed() {
this.gotoAndStop("rules");
}
function rest_pressed() {
scores = 0;
this.gotoAndStop("reset");
this.gotoAndStop("game");
}
function more_pressed() {
getURL ("http://www.gamesjolly.com", "_blank");
}
function back_pressed() {
this.gotoAndStop("menu animaton");
}
function arcade_mode_pressed() {
arcadeGame = true;
gameStart();
}
function classic_mode_pressed() {
arcadeGame = false;
gameStart();
}
function inMenuFirst() {
mc_sloop.gotoAndStop(2);
}
function gameStart() {
level = 0;
scores = 0;
nextLevel();
}
function nextLevel() {
level++;
this.gotoAndStop("reset");
this.gotoAndStop("game");
}
function newGame() {
this.gotoAndStop("menu animaton");
}
function playSnd(lib_snd) {
s = new Sound(this);
s.attachSound(lib_snd);
s.start();
}
function initLevel() {
txtLevel = level;
txtScores = scores;
lastTimer = getTimer();
if (arcadeGame) {
mc_grid.init(levARowCount[level - 1], levColorCount[level - 1], levBonusCount[level - 1], mc_fall, mc_pusher, mc_trace);
mc_ind.init(levAScores[level - 1]);
levelSpeed = 2.6 + (0.03 * (level - 1));
} else {
mc_grid.init(levCRowCount[level - 1], levColorCount[level - 1], levBonusCount[level - 1], mc_fall, mc_pusher, mc_trace);
mc_ind.init(1);
levelSpeed = 2.65;
increaseK = levIncreaseK[level - 1];
}
prevBonusNum = -1;
shotBonusCount = _root.myRandom(maxShotBonusNum) + 1;
generateNextBall();
generateNextBall();
mc_move_ball.mc_grid = mc_grid;
var _local2;
var _local3;
_local2 = 0;
while (_local2 < sightBallCount) {
_local3 = mc_trace.attachMovie("lib_trace", "" + _local2, _local2);
_local3._xscale = (_local3._yscale = 85);
_local3._alpha = 75;
_local3._visible = false;
_local2++;
}
_local3 = mc_trace.attachMovie("lib_trace2", "" + sightBallCount, sightBallCount);
_local3._xscale = (_local3._yscale = 115);
_local3._alpha = 75;
_local3._visible = false;
drawSight();
redrawSight = true;
winFlag = false;
overFlag = false;
if (timeCounter == null) {
timeCounter = new CTimeCounter();
back1 = new CBackground();
back2 = new CBackground();
back3 = new CBackground();
}
mc_msg.gotoAndStop("stEmpty");
resetSounds();
gameState = 0;
}
function processGame() {
var _local14;
var _local6;
var _local5;
var _local4;
_local14 = getTimer();
_local6 = _local14 - lastTimer;
txtFps = 1 / (_local6 / 1000);
lastTimer = _local14;
back1.process(_local6);
back2.process(_local6);
back3.process(_local6);
mc_pinguin.process(_local6);
mc_yeti.process(_local6);
mc_gun.processKeys(_local6);
if (gameState == 1) {
if (mc_msg.a1._visible == false) {
_local4 = levColorCount[level];
_local5 = 1;
while (_local5 <= _local4) {
mc_msg["a" + _local5].setColor(_local5);
mc_msg["a" + _local5]._visible = true;
_local5++;
}
_local4 = levBonusCount[level];
_local5 = 1;
while (_local5 <= _local4) {
mc_msg["b" + _local5].setColor(_local5);
mc_msg["b" + _local5].setBonus(_local5, 2);
mc_msg["b" + _local5]._visible = true;
_local5++;
}
}
}
if (gameState != 0) {
return(undefined);
}
processFallBalls(_local6);
if (mc_grid.fillBallsCount > 0) {
var _local12 = scrBall * mc_grid.fillBallsCount;
if (mc_grid.doubleScores > 0) {
sndScoreX2orX4 = true;
_local12 = _local12 * (2 * mc_grid.doubleScores);
}
scores = scores + _local12;
txtScores = scores;
if (mc_grid.bonusJumpUp > 0) {
_local5 = 0;
while (_local5 < mc_grid.bonusJumpUp) {
if (arcadeGame) {
mc_grid.jumpUpWithoutPusher();
} else {
mc_grid.jumpUp();
}
_local5++;
}
}
if (arcadeGame) {
mc_ind.addValue(mc_grid.fillBallsCount);
if (mc_ind.isFull()) {
mc_grid.fallAllBalls();
win();
}
}
correctAllColors();
}
if ((mc_grid.fallBallsCount + mc_grid.fillBallsCount) > 4) {
mc_yeti.toCool();
}
mc_grid.fillBallsCount = 0;
mc_grid.fallBallsCount = 0;
mc_grid.doubleScores = 0;
mc_grid.bonusJumpUp = 0;
if (overFlag) {
if (!timeCounter.process(_local6)) {
mc_msg.btn._visible = true;
var _local7 = false;
var _local11;
for (_local11 in mc_fall) {
_local7 = true;
break;
}
if (!_local7) {
gameState = 2;
}
}
}
if (winFlag) {
if (!timeCounter.process(_local6)) {
var _local7 = false;
for (var _local11 in mc_fall) {
_local7 = true;
break;
}
if (!_local7) {
mc_gun.disable();
mc_pusher._visible = false;
if (level < 10) {
mc_msg.gotoAndStop("stWin");
mc_msg.txtLevel = level + 1;
mc_msg.txtScores = scores;
_local5 = 1;
while (_local5 <= 8) {
mc_msg["a" + _local5]._visible = false;
_local5++;
}
_local5 = 1;
while (_local5 <= 8) {
mc_msg["b" + _local5]._visible = false;
_local5++;
}
gameState = 1;
} else {
mc_msg.gotoAndStop("stCompleted");
mc_msg.txtScores = scores;
gameState = 3;
}
}
}
return(undefined);
}
if (mc_move_ball._visible == false) {
mc_gun.processTime(_local6);
}
if (mc_gun.autoShot()) {
myMouseDown();
}
mc_grid.process(_local6);
var _local13 = (shotSpeed * _local6) / 1000;
_local4 = Math.ceil(_local13 / (CGrid.BALL_RAD / 2));
var _local9 = _local13 / _local4;
var _local15;
var _local10;
var _local8 = ((levelSpeed * _local6) / 1000) / _local4;
_local5 = 0;
while (_local5 < _local4) {
if (arcadeGame) {
if (!mc_grid.bonusFreeze) {
mc_grid.moveDown(_local8);
}
}
if (mc_move_ball._visible) {
mc_move_ball.doStep(_local9);
_local10 = mc_grid.checkForEnd(mc_move_ball);
if (_local10 != null) {
if (mc_grid.fillBallsCount > 0) {
sndBubbleCollisionR = true;
} else {
sndBubbleCollision = true;
}
mc_move_ball.hide();
if (!arcadeGame) {
if (!mc_grid.bonusFreeze) {
mc_ind.addValue(increaseK);
if (mc_ind.isFull()) {
mc_grid.jumpDown();
mc_ind.reset();
}
}
var _local3 = true;
var _local2;
_local2 = 0;
while (_local2 < mc_grid.maxColorNum) {
if (mc_grid.colorCountArr[_local2] > 0) {
_local3 = false;
break;
}
_local2++;
}
if (_local3) {
win();
}
}
}
}
_local5++;
}
if (overFlag) {
return(undefined);
}
if (arcadeGame && (!winFlag)) {
mc_grid.checkAddRow();
}
if (redrawSight) {
drawSight();
}
redrawSight = true;
_root.kk = mc_grid.getDownY();
if (mc_grid.getDownY() >= 480) {
overFlag = true;
mc_gun.disable();
mc_trace._visible = false;
mc_grid.fallAllBalls();
mc_msg.gotoAndStop("stOver");
mc_msg.txtScores = scores;
mc_msg.btn._visible = false;
timeCounter.setTime(1000);
mc_gun.resetNumber();
}
playSounds();
}
function myMouseMove() {
mc_gun.myMouseMove();
mc_gun.process(this._xmouse);
drawSight();
redrawSight = false;
}
function myMouseDown() {
if ((winFlag || (overFlag)) || (gameState != 0)) {
return(undefined);
}
if (mc_move_ball._visible == false) {
startBall();
sndGunFire = true;
}
}
function myKeyDown() {
if (Key.isDown(32)) {
if (gameState == 1) {
nextLevel();
} else if (gameState == 2) {
newGame();
} else {
myMouseDown();
}
}
}
function win() {
winFlag = true;
timeCounter.setTime(relaxTime);
mc_gun.resetNumber();
mc_trace._visible = false;
}
function processFallBalls(dTime) {
var _local2 = dTime;
var _local1;
var _local3;
for (_local3 in mc_fall) {
_local1 = mc_fall[_local3];
_local1.process(_local2);
if (_local1._y > 400) {
_local1.removeMovieClip();
}
}
}
function generateNextBall() {
var _local4;
var _local2 = 0;
var _local3 = 0;
mc_gun.setColor(mc_next.colorNum);
mc_gun.setBonus(mc_next.bonusNum, mc_next.bonusColorNum);
_local4 = _root.myRandom(mc_grid.maxColorNum) + 1;
_local4 = correctColor(_local4);
if (mc_grid.maxBonusNum > 0) {
shotBonusCount--;
if (shotBonusCount <= 0) {
_local2 = _root.myRandom(mc_grid.maxBonusNum) + 1;
if ((_local2 == prevBonusNum) && (_local2 != CBall.BONUS_COLOR)) {
if (Math.random() > 0.5) {
_local2++;
if (_local2 > mc_grid.maxBonusNum) {
_local2 = 1;
}
} else {
_local2--;
if (_local2 < 1) {
_local2 = mc_grid.maxBonusNum;
}
}
}
if (_local2 == CBall.BONUS_COLOR) {
_local3 = _root.myRandom(mc_grid.maxColorNum) + 1;
if (_local4 == _local3) {
if (Math.random() > 0.5) {
_local3++;
if (_local3 > mc_grid.maxColorNum) {
_local3 = 1;
}
} else {
_local3--;
if (_local3 < 1) {
_local3 = mc_grid.maxColorNum;
}
}
}
}
prevBonusNum = _local2;
shotBonusCount = _root.myRandom(maxShotBonusNum) + 1;
}
}
mc_next.setColor(_local4);
mc_next.setBonus(_local2, _local3);
}
function correctAllColors() {
var _local1;
mc_gun.setColor(correctColor(mc_gun.colorNum));
mc_next.setColor(correctColor(mc_next.colorNum));
}
function correctColor(c) {
var _local2 = c;
if (arcadeGame == false) {
var _local3;
var _local4 = _root.myRandom(2);
_local3 = 0;
while (_local3 < mc_grid.maxColorNum) {
if (mc_grid.colorCountArr[_local2 - 1] > 0) {
break;
}
if (_local4 == 1) {
_local2++;
if (_local2 > mc_grid.maxColorNum) {
_local2 = 1;
}
} else {
_local2--;
if (_local2 < 1) {
_local2 = mc_grid.maxColorNum;
}
}
_local3++;
}
}
return(_local2);
}
function startBall() {
var _local1 = (mc_gun._rotation / 180) * 3.141593;
mc_move_ball.startMove(mc_gun._x, mc_gun._y, Math.sin(_local1), -Math.cos(_local1));
mc_move_ball.setColor(mc_gun.colorNum);
mc_move_ball.setBonus(mc_gun.bonusNum, mc_gun.bonusColorNum);
generateNextBall();
mc_gun.doShot();
}
function drawSight() {
var _local15 = (mc_gun._rotation / 180) * 3.141593;
mc_grid.getFirstBall(mc_gun._x, mc_gun._y, Math.sin(_local15), -Math.cos(_local15));
mc_trace._x = mc_grid._x;
mc_trace._y = mc_grid._y;
var _local9;
var _local14 = mc_grid.points.length - 1;
var _local6;
var _local5;
var _local8;
var _local12;
var _local11;
var _local4 = 28;
var _local1;
var _local10;
var _local13 = 0;
var _local2 = _local4;
var _local3;
var _local7 = 0;
_local9 = 1;
while (_local9 < _local14) {
_local12 = mc_grid.points[_local9 - 1].x;
_local6 = mc_grid.points[_local9].x - _local12;
_local11 = mc_grid.points[_local9 - 1].y;
_local5 = mc_grid.points[_local9].y - _local11;
_local8 = Math.sqrt((_local6 * _local6) + (_local5 * _local5));
_local6 = _local6 / _local8;
_local5 = _local5 / _local8;
_local10 = Math.floor((_local8 - _local2) / _local4);
_local1 = 0;
while (_local1 <= _local10) {
_local3 = mc_trace["" + _local7];
_local3._visible = true;
_local7++;
_local13++;
_local3._x = _local12 + (_local6 * (_local2 + (_local4 * _local1)));
_local3._y = _local11 + (_local5 * (_local2 + (_local4 * _local1)));
_local1++;
}
_local2 = (_local8 - (_local10 * _local4)) - _local2;
_local2 = _local4 - _local2;
_local9++;
}
_local9 = _local7;
while (_local9 < sightBallCount) {
mc_trace["" + _local9]._visible = false;
_local9++;
}
_local3 = mc_trace["" + sightBallCount];
_local3._visible = true;
_local3._x = mc_grid.points[_local14].x;
_local3._y = mc_grid.points[_local14].y;
}
function playSounds() {
if (sndBubbleLevelUp) {
playSnd("snd_BubbleLevelUp");
resetSounds();
} else if (snd8bonus) {
playSnd("snd_8bonus");
resetSounds();
} else if (sndExplosionTNT) {
playSnd("snd_ExplosionTNT");
resetSounds();
} else if (sndFreeze) {
playSnd("snd_Freeze");
resetSounds();
} else if (sndScoreX2orX4) {
playSnd("snd_ScoreX2orX4");
resetSounds();
} else if (sndAutoFire) {
playSnd("snd_AutoFire");
resetSounds();
} else if (sndBubbleCollision) {
playSnd("snd_BubbleCollision");
resetSounds();
} else if (sndBubbleCollisionR) {
playSnd("snd_BubbleCollisionR");
resetSounds();
} else if (sndPingvin) {
playSnd("snd_Pingvin");
resetSounds();
} else if (sndGunFire) {
playSnd("snd_GunFire");
resetSounds();
}
}
function resetSounds() {
snd8bonus = (sndAutoFire = (sndBubbleCollision = (sndBubbleCollisionR = (sndBubbleLevelUp = (sndExplosionTNT = (sndFreeze = (sndGunFire = (sndPingvin = (sndScoreX2orX4 = false)))))))));
}
_root.morebtnactive = false;
fscommand ("showmenu", "false");
fscommand ("trapallkeys", "true");
var lastTimer;
var level;
_root.myRandom = function (n) {
return(Math.floor((n - 1E-6) * Math.random()));
};
var scores;
var scrBall = 10;
var gameState;
var shotSpeed = 700;
var levCRowCount = [7, 7, 7, 7, 8, 8, 8, 9, 9, 9];
var levARowCount = [6, 6, 7, 6, 7, 7, 6, 7, 7, 7];
var levAScores = [70, 80, 90, 100, 110, 120, 130, 140, 150, 160];
var levIncreaseK = [0.1001, 0.12001, 0.125001, 0.143001, 0.143001, 0.143001, 0.143001, 0.143001, 0.143001, 0.143001];
var levColorCount = [4, 4, 4, 5, 5, 5, 6, 7, 7, 8];
var levBonusCount = [0, 1, 2, 3, 4, 5, 6, 7, 8, 8];
var arcadeGame = false;
var increaseK;
var levelSpeed;
var prevBonusNum;
var shotBonusCount;
var maxShotBonusNum = 10;
var redrawSight = true;
var sightBallCount = 70;
var timeCounter = null;
var winFlag;
var overFlag;
var relaxTime = 1500;
var back1;
var back2;
var back3;
var snd8bonus;
var sndAutoFire;
var sndBubbleCollision;
var sndBubbleCollisionR;
var sndBubbleLevelUp;
var sndExplosionTNT;
var sndFreeze;
var sndGunFire;
var sndPingvin;
var sndScoreX2orX4;
#endinitclip
Symbol 302 MovieClip [__Packages.CTimeCounter] Frame 0
class CTimeCounter
{
var curTime;
function CTimeCounter () {
}
function setTime(time) {
curTime = time;
}
function process(dTime) {
curTime = curTime - dTime;
return(curTime > 0);
}
function endTime() {
curTime = 0;
}
}
Symbol 303 MovieClip [__Packages.CBall] Frame 0
class CBall extends MovieClip
{
var mc;
function CBall () {
var _local3 = this;
super();
_local3.marked = false;
_local3.bonusNum = 0;
_local3.stop();
_local3.mc.mc_freeze._visible = false;
}
function setColor(num) {
var _local2 = this;
_local2.colorNum = num;
_local2.mc.gotoAndStop(_local2.colorNum);
}
function setBonus(bonusNum_, bonusColorNum_) {
var _local2 = this;
_local2.bonusNum = bonusNum_;
_local2.bonusColorNum = bonusColorNum_;
_local2.mc.mc_bonus.gotoAndStop(1 + _local2.bonusNum);
if (_local2.bonusNum == BONUS_COLOR) {
_local2.mc.mc_bonus.mc.gotoAndStop(_local2.bonusColorNum);
}
}
function isMyColor(c) {
var _local2 = this;
return((c == _local2.colorNum) || ((_local2.bonusNum == BONUS_COLOR) && (c == _local2.bonusColorNum)));
}
function freeze() {
mc.mc_freeze._visible = true;
}
function unFreeze() {
mc.mc_freeze._visible = false;
}
static var BONUS_COLOR = 1;
}
Symbol 304 MovieClip [__Packages.CGrid] Frame 0
class CGrid extends MovieClip
{
var ball_array, _x, _y, fillBallsCount, fallBallsCount, doubleScores, bonusJumpUp, attachMovie, bonusFreeze, colorCountArr, fieldWidth;
function CGrid () {
super();
ball_array = new Array();
}
function init(rowCount, maxColorNum_, maxBonusNum_, mc_fall_, mc_pusher_, mc_trace_) {
var _local3 = this;
_local3.maxColorNum = maxColorNum_;
_local3.maxBonusNum = maxBonusNum_;
_local3.mc_fall = mc_fall_;
_local3.fallDepth = 0;
_local3.mc_pusher = mc_pusher_;
_local3.pusherDY = _local3._y - _local3.mc_pusher._y;
_local3.mc_trace = mc_trace_;
_local3.mc_trace._visible = false;
_local3.traceTime = 0;
_local3.bonusFreeze = false;
_local3.beginY = (_local3.floatY = _local3._y);
_local3.colorCountArr = new Array(_local3.maxColorNum);
var _local6;
var _local5;
var _local7;
var _local4;
_local6 = 0;
while (_local6 < _local3.maxColorNum) {
_local3.colorCountArr[_local6] = 0;
_local6++;
}
_local3.ballDepth = 0;
_local6 = 0;
while (_local6 < rowCount) {
_local7 = new Array();
_local5 = 0;
while (_local5 < COLS) {
_local4 = _local3.attachMovie("lib_ball", "" + _local3.ballDepth, _local3.ballDepth);
_local3.ballDepth++;
_local4._x = ((_local6 % 2) * BALL_RAD) + (_local5 * BALL_DIAM);
_local4._y = _local6 * BALL_DY;
_local4.setColor(_root.myRandom(_local3.maxColorNum) + 1);
_local7.push(_local4);
_local3.colorCountArr[_local4.colorNum - 1]++;
_local5++;
}
_local3.ball_array.push(_local7);
_local6++;
}
_local3.addRowCount = 0;
_local3.fieldWidth = ((COLS - 1) * BALL_DIAM) + BALL_RAD;
_local3.calcNeighboursXY();
}
function moveDown(step) {
var _local2 = this;
if (_local2.ball_array.length < 6) {
step = step * (7 - _local2.ball_array.length);
}
_local2.floatY = _local2.floatY + step;
_local2._y = _local2.floatY;
}
function jumpDown() {
var _local2 = this;
_local2.floatY = _local2.floatY + BALL_DY;
_local2._y = _local2.floatY;
_local2.mc_pusher._y = _local2.floatY - _local2.pusherDY;
}
function jumpUp() {
var _local3 = this;
if (Math.abs(_local3._y - _local3.beginY) > 2) {
_local3.floatY = _local3.floatY - BALL_DY;
if (_local3.floatY < _local3.beginY) {
_local3.floatY = _local3.beginY;
}
_local3._y = _local3.floatY;
_local3.mc_pusher._y = _local3.floatY - _local3.pusherDY;
}
_root.sndBubbleLevelUp = true;
}
function jumpUpWithoutPusher() {
var _local3 = this;
_local3.floatY = _local3.floatY - BALL_DY;
_local3._y = _local3.floatY;
_root.sndBubbleLevelUp = true;
}
function jumpToStartPos() {
var _local2 = this;
_local2._y = (_local2.floatY = _local2.beginY);
_local2.mc_pusher._y = _local2.floatY - _local2.pusherDY;
}
function addRow() {
var _local3 = this;
var _local6 = new Array();
var _local5;
var _local4;
_local3.addRowCount++;
_local5 = 0;
while (_local5 < COLS) {
_local4 = _local3.attachMovie("lib_ball", "" + _local3.ballDepth, _local3.ballDepth);
_local3.ballDepth++;
_local4._x = (Math.abs(_local3.addRowCount % 2) * BALL_RAD) + (_local5 * BALL_DIAM);
_local4._y = (-_local3.addRowCount) * BALL_DY;
trace(_local4._y);
_local4.setColor(_root.myRandom(_local3.maxColorNum) + 1);
_local6.push(_local4);
_local3.colorCountArr[_local4.colorNum - 1]++;
_local5++;
}
_local3.ball_array.splice(0, 0, _local6);
}
function getDownY() {
var _local3 = this;
_global.rr = _local3._y;
return((_local3._y + ((((-_local3.addRowCount) + _local3.ball_array.length) - 1) * BALL_DY)) + BALL_RAD);
}
function calcNeighboursXY() {
var _local1;
var _local7;
var _local6;
var _local9;
var _local8;
var _local4;
var _local2;
var _local3;
var _local5;
_local7 = 2;
_local6 = 2;
_local9 = ((_local6 % 2) * BALL_RAD) + (_local7 * BALL_DIAM);
_local8 = _local6 * BALL_DY;
_local1 = 0;
while (_local1 < 6) {
_local4 = _local7 + neighbours[_local1][0];
_local2 = _local6 + neighbours[_local1][1];
_local3 = ((_local2 % 2) * BALL_RAD) + (_local4 * BALL_DIAM);
_local5 = _local2 * BALL_DY;
neighboursXY[_local1][0] = _local3 - _local9;
neighboursXY[_local1][1] = _local5 - _local8;
_local1++;
}
_local7 = 1;
_local6 = 1;
_local9 = ((_local6 % 2) * BALL_RAD) + (_local7 * BALL_DIAM);
_local8 = _local6 * BALL_DY;
_local1 = 0;
while (_local1 < 6) {
_local4 = _local7 + neighbours2[_local1][0];
_local2 = _local6 + neighbours2[_local1][1];
_local3 = ((_local2 % 2) * BALL_RAD) + (_local4 * BALL_DIAM);
_local5 = _local2 * BALL_DY;
neighboursXY2[_local1][0] = _local3 - _local9;
neighboursXY2[_local1][1] = _local5 - _local8;
_local1++;
}
}
function getFirstBall(x0, y0, dx, dy) {
var _local4 = y0;
var _local17 = ball_array.length;
var _local18 = (-addRowCount) * BALL_DY;
x0 = x0 - _x;
_local4 = _local4 - _y;
var _local11;
var _local10;
_local11 = x0 + (1000 * dx);
_local10 = _local4 + (1000 * dy);
var _local2;
var _local3;
var _local6;
var _local9;
_local2 = _local4 - _local10;
_local3 = _local11 - x0;
_local6 = (x0 * (_local10 - _local4)) - (_local4 * (_local11 - x0));
_local9 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
_local2 = _local2 / _local9;
_local3 = _local3 / _local9;
_local6 = _local6 / _local9;
while (points.pop() != undefined) {
}
points.push({x:x0, y:_local4});
var _local8;
var _local13;
var _local7;
while (true) {
_local8 = getBoundsIntersection(dx, dy, _local2, _local3, _local6);
_local13 = getBallIntersection(_local8.x, _local8.y, x0, _local4, _local2, _local3, _local6);
if (_local13 != null) {
_local7 = getFirstEmptyNeighbour(_local13.col, _local13.row, x0, _local4, _local11, _local10, _local2, _local3, _local6);
if (_local2 > Math.abs(_local3)) {
points.push({x:(-((_local3 * _local7.y) + _local6)) / _local2, y:_local7.y});
} else {
points.push({x:_local7.x, y:(-((_local2 * _local7.x) + _local6)) / _local3});
}
points.push({x:_local7.x, y:_local7.y});
return(undefined);
}
x0 = _local8.x;
_local4 = _local8.y;
dx = -dx;
_local11 = x0 + (1000 * dx);
_local10 = _local4 + (1000 * dy);
_local2 = _local4 - _local10;
_local3 = _local11 - x0;
_local6 = (x0 * (_local10 - _local4)) - (_local4 * (_local11 - x0));
_local9 = Math.sqrt((_local2 * _local2) + (_local3 * _local3));
_local2 = _local2 / _local9;
_local3 = _local3 / _local9;
_local6 = _local6 / _local9;
points.push({x:x0, y:_local4});
if (_local4 < (((-addRowCount) * BALL_DY) + 2)) {
points.push({x:x0, y:_local4});
return(undefined);
}
}
}
function checkForEnd(mc_move_ball) {
fillBallsCount = 0;
fallBallsCount = 0;
doubleScores = 0;
bonusJumpUp = 0;
var _local9;
var _local8;
_local9 = (mc_move_ball.sX + (mc_move_ball.curR * mc_move_ball.vx)) - _x;
_local8 = (mc_move_ball.sY + (mc_move_ball.curR * mc_move_ball.vy)) - _y;
var _local18;
var _local16;
_local18 = Math.round((_local8 + (addRowCount * BALL_DY)) / BALL_DY);
_local16 = Math.round((_local9 - ((Math.abs(_local18 + addRowCount) % 2) * BALL_RAD)) / BALL_DIAM);
if (_local16 < 0) {
_local16 = 0;
} else if (_local16 >= COLS) {
_local16 = COLS - 1;
}
var _local7;
var _local2;
var _local20;
var _local19;
var _local14;
var _local13;
var _local10;
var _local11;
var _local12 = 500000 /* 0x07A120 */;
var _local5;
var _local4;
var _local6;
var _local3;
if (_local18 <= ball_array.length) {
_local20 = _local18 - 1;
_local19 = _local18 + 1;
_local14 = _local16 - 1;
_local13 = _local16 + 1;
if (_local20 < 0) {
_local20 = 0;
}
if (_local19 > (ball_array.length - 1)) {
_local19 = ball_array.length - 1;
}
_local7 = _local19;
while (_local7 >= _local20) {
_local2 = _local14;
while (_local2 <= _local13) {
_local3 = ball_array[_local7][_local2];
if (_local3 != null) {
_local5 = _local3._x - _local9;
_local4 = _local3._y - _local8;
_local6 = Math.sqrt((_local5 * _local5) + (_local4 * _local4));
if (_local6 <= BALL_DIAM_I) {
_local12 = _local6;
_local10 = _local2;
_local11 = _local7;
}
}
_local2++;
}
_local7--;
}
if (_local12 < 500000) {
var _local15;
var _local25 = _local9 - ((mc_move_ball.curR * mc_move_ball.vx) * 100);
var _local24 = _local8 - ((mc_move_ball.curR * mc_move_ball.vy) * 100);
var _local23;
var _local22;
var _local26;
var _local27;
_local23 = _local24 - _local8;
_local22 = _local9 - _local25;
_local26 = (_local25 * (_local8 - _local24)) - (_local24 * (_local9 - _local25));
_local27 = Math.sqrt((_local23 * _local23) + (_local22 * _local22));
_local23 = _local23 / _local27;
_local22 = _local22 / _local27;
_local26 = _local26 / _local27;
_local15 = getFirstEmptyNeighbour(_local10, _local11, _local25, _local24, _local9, _local8, _local23, _local22, _local26);
if (_local15.col == -1) {
_local15 = getFirstEmptyNeighbourForPoint(_local10, _local11, _local9, _local8);
}
if (_local15.row == ball_array.length) {
var _local21 = new Array(COLS);
_local7 = 0;
while (_local7 < COLS) {
_local21[_local7] = null;
_local7++;
}
ball_array.push(_local21);
}
_local3 = attachMovie("lib_ball", "" + ballDepth, ballDepth);
ballDepth++;
_local3._x = ((Math.abs(_local15.row + addRowCount) % 2) * BALL_RAD) + (_local15.col * BALL_DIAM);
_local3._y = (_local15.row * BALL_DY) - (addRowCount * BALL_DY);
_local3.setColor(mc_move_ball.colorNum);
if (bonusFreeze) {
_local3.freeze();
}
ball_array[_local15.row][_local15.col] = _local3;
colorCountArr[_local3.colorNum - 1]++;
if (ball_array[_local15.row][_local15.col] != null) {
checkMovingOff(_local3, _local15.col, _local15.row);
}
return(_local3);
}
}
var _local28 = ((-addRowCount) * BALL_DY) + (BALL_DY / 2);
if (_local8 <= _local28) {
_local3 = attachMovie("lib_ball", "" + ballDepth, ballDepth);
ballDepth++;
_local3._x = ((Math.abs(_local18 + addRowCount) % 2) * BALL_RAD) + (_local16 * BALL_DIAM);
_local3._y = (_local18 * BALL_DY) - (addRowCount * BALL_DY);
_local3.setColor(mc_move_ball.colorNum);
if (bonusFreeze) {
_local3.freeze();
}
ball_array[_local18][_local16] = _local3;
colorCountArr[_local3.colorNum - 1]++;
if (ball_array[_local18][_local16] != null) {
checkMovingOff(_local3, _local16, _local18);
}
return(_local3);
}
return(null);
}
function colorize(col, row, mc) {
var _local2 = mc;
var _local12 = new Array();
var _local14;
var _local9;
var _local8;
var _local7;
var _local4;
var _local3;
var _local13 = ball_array.length;
var _local6;
var _local5;
var _local15 = _local2.colorNum;
if ((Math.abs(row + addRowCount) % 2) == 0) {
_local14 = neighbours;
} else {
_local14 = neighbours2;
}
_local2.setBonus(0, 0);
_local2.marked = true;
_local12.push({col:col, row:row});
_local6 = 5;
while (_local6 >= 0) {
_local8 = col + _local14[_local6][0];
_local7 = row + _local14[_local6][1];
_local2 = ball_array[_local7][_local8];
if ((((((_local8 >= 0) && (_local8 < COLS)) && (_local7 >= 0)) && (_local7 < _local13)) && (ball_array[_local7][_local8] != null)) && (_local2.marked == false)) {
_local2.marked = true;
_local12.push({col:_local8, row:_local7});
if ((Math.abs(_local7 + addRowCount) % 2) == 0) {
_local9 = neighbours;
} else {
_local9 = neighbours2;
}
_local5 = 5;
while (_local5 >= 0) {
_local4 = _local8 + _local9[_local5][0];
_local3 = _local7 + _local9[_local5][1];
_local2 = ball_array[_local3][_local4];
if ((((((_local4 >= 0) && (_local4 < COLS)) && (_local3 >= 0)) && (_local3 < _local13)) && (ball_array[_local3][_local4] != null)) && (_local2.marked == false)) {
_local2.marked = true;
_local12.push({col:_local4, row:_local3});
break;
}
_local5--;
}
break;
}
_local6--;
}
var _local17 = 0;
var _local16 = _local12.length;
_local6 = 0;
while (_local6 < _local16) {
col = _local12[_local6].col;
row = _local12[_local6].row;
_local2 = ball_array[row][col];
if (_local2 != null) {
_local2.marked = false;
colorCountArr[_local2.colorNum - 1]--;
_local2.setColor(_local15);
colorCountArr[_local15 - 1]++;
}
_local6++;
}
}
function checkLongBonus(mc) {
var _local3 = this;
if (mc.bonusNum > 0) {
switch (mc.bonusNum) {
case 2 :
_local3.enableTrace();
_root.sndBubbleLevelUp = true;
return(undefined);
case 3 :
_local3.doubleScores = _local3.doubleScores + 1;
return(undefined);
case 4 :
_local3.bonusJumpUp = _local3.bonusJumpUp + 1;
return(undefined);
case 5 :
_local3.enableFreeze();
return(undefined);
case 6 :
_local3.doubleScores = _local3.doubleScores + 2;
return(undefined);
}
}
}
function getBoundsIntersection(dx, dy, A, B, C) {
var _local2 = 0;
var _local4 = -30000;
var _local5 = 0;
var _local3 = -30000;
if (Math.abs(dx) > 0.15) {
if (dx > 0) {
_local2 = fieldWidth;
} else {
_local2 = 0;
}
_local4 = (-((A * _local2) + C)) / B;
}
_local3 = (-addRowCount) * BALL_DY;
_local5 = (-((B * _local3) + C)) / A;
if (_local3 > _local4) {
return({x:_local5, y:_local3});
}
return({x:_local2, y:_local4});
}
function getBallIntersection(x1, y1, x0, y0, A, B, C) {
var _local23 = (-addRowCount) * BALL_DY;
var _local24 = y1 - BALL_DIAM;
var _local22 = Math.round((_local24 - _local23) / BALL_DY) - 1;
var _local21 = Math.round((y0 - _local23) / BALL_DY) + 1;
if (_local22 < 0) {
_local22 = 0;
}
if (_local21 > (ball_array.length - 1)) {
_local21 = ball_array.length - 1;
}
var _local8 = 500000 /* 0x07A120 */;
var _local10 = -1;
var _local11 = -1;
var _local7;
var _local5;
var _local2;
var _local3;
var _local4;
var _local6;
var _local12;
var _local13;
var _local9;
_local3 = x1 - x0;
_local4 = y1 - y0;
_local12 = (_local3 * _local3) + (_local4 * _local4);
_local7 = _local21;
while (_local7 >= _local22) {
_local5 = 0;
while (_local5 < COLS) {
_local2 = ball_array[_local7][_local5];
if ((_local2 != null) && ((_local13 = Math.abs(((A * _local2._x) + (B * _local2._y)) + C)) <= BALL_DIAM_I)) {
_local3 = _local2._x - x0;
_local4 = _local2._y - y0;
_local6 = (_local3 * _local3) + (_local4 * _local4);
_local9 = Math.sqrt(_local6) + _local13;
if (_local9 < _local8) {
if (_local6 > _local12) {
_local3 = _local2._x - x1;
_local4 = _local2._y - y1;
_local6 = (_local3 * _local3) + (_local4 * _local4);
if (_local6 <= (BALL_DIAM_I * BALL_DIAM_I)) {
_local8 = Math.sqrt(_local6) + Math.sqrt(_local12);
_local10 = _local5;
_local11 = _local7;
}
} else {
_local8 = _local9;
_local10 = _local5;
_local11 = _local7;
}
}
}
_local5++;
}
_local7--;
}
if (_local10 != -1) {
return({col:_local10, row:_local11});
}
return(null);
}
function getFirstEmptyNeighbour(col, row, x0, y0, x1, y1, A, B, C) {
var _local2;
var _local10 = 500000 /* 0x07A120 */;
var _local11 = -1;
var _local14;
var _local13;
var _local12;
var _local26;
var _local25;
var _local9;
var _local8;
var _local4;
var _local7;
var _local5;
var _local3;
var _local28;
var _local27;
var _local29;
var _local6 = {x:0, y:0, R:0};
if ((Math.abs(row + addRowCount) % 2) == 0) {
_local9 = neighbours;
_local8 = neighboursXY;
} else {
_local9 = neighbours2;
_local8 = neighboursXY2;
}
_local26 = ((Math.abs(addRowCount + row) % 2) * BALL_RAD) + (col * BALL_DIAM);
_local25 = (row * BALL_DY) - (addRowCount * BALL_DY);
_local2 = 0;
while (_local2 < 6) {
_local4 = col + _local9[_local2][0];
_local7 = row + _local9[_local2][1];
if (((_local4 >= 0) && (_local7 >= 0)) && (_local4 < COLS)) {
_local5 = _local26 + _local8[_local2][0];
_local3 = _local25 + _local8[_local2][1];
if (Math.abs(((A * _local5) + (B * _local3)) + C) <= BALL_RAD_B) {
getCircleIntersection(x0, y0, x1, y1, _local5, _local3, BALL_RAD_B, BALL_RAD_B * BALL_RAD_B, _local6);
if (_local6.R < _local10) {
_local10 = _local6.R;
_local11 = _local4;
_local14 = _local7;
_local13 = _local5;
_local12 = _local3;
}
}
}
_local2++;
}
return({x:_local13, y:_local12, col:_local11, row:_local14});
}
function getFirstEmptyNeighbourForPoint(col, row, x0, y0) {
var _local2;
var _local12 = 500000 /* 0x07A120 */;
var _local13;
var _local16;
var _local15;
var _local14;
var _local22;
var _local21;
var _local11;
var _local10;
var _local3;
var _local9;
var _local7;
var _local5;
var _local4;
var _local6;
var _local8;
if ((Math.abs(row + addRowCount) % 2) == 0) {
_local11 = neighbours;
_local10 = neighboursXY;
} else {
_local11 = neighbours2;
_local10 = neighboursXY2;
}
_local22 = ((Math.abs(addRowCount + row) % 2) * BALL_RAD) + (col * BALL_DIAM);
_local21 = (row * BALL_DY) - (addRowCount * BALL_DY);
_local2 = 0;
while (_local2 < 6) {
_local3 = col + _local11[_local2][0];
_local9 = row + _local11[_local2][1];
if (((_local3 >= 0) && (_local9 >= 0)) && (_local3 < COLS)) {
_local7 = _local22 + _local10[_local2][0];
_local5 = _local21 + _local10[_local2][1];
_local4 = _local7 - x0;
_local6 = _local5 - y0;
_local8 = (_local4 * _local4) + (_local6 * _local6);
if (_local8 < _local12) {
_local12 = _local8;
_local13 = _local3;
_local16 = _local9;
_local15 = _local7;
_local14 = _local5;
}
}
_local2++;
}
return({x:_local15, y:_local14, col:_local13, row:_local16});
}
function getCircleIntersection(x1, y1, x2, y2, x0, y0, R, R2, iP) {
var _local1 = x1;
var _local3 = y1;
var _local4;
var _local2;
var _local12;
var _local13;
var _local8;
var _local19;
var _local17;
var _local18;
var _local25;
var _local24;
var _local9;
var _local10;
var _local6;
var _local7;
var _local16;
var _local15;
var _local14 = 500000 /* 0x07A120 */;
var _local11 = 500000 /* 0x07A120 */;
if (Math.abs(x2 - _local1) < 1) {
_local4 = _local1 - x2;
_local2 = y2 - _local3;
_local12 = (_local1 * (_local3 - y2)) - (_local3 * (_local1 - x2));
_local13 = 1 + ((_local4 * _local4) / (_local2 * _local2));
_local25 = (_local12 / _local2) + x0;
_local8 = (-2 * y0) + (((2 * _local4) / _local2) * _local25);
_local19 = ((y0 * y0) + (_local25 * _local25)) - R2;
_local17 = (_local8 * _local8) - ((4 * _local13) * _local19);
if (_local17 >= 0) {
_local18 = Math.sqrt(_local17);
_local10 = ((-_local8) + _local18) / (2 * _local13);
_local16 = (_local10 - _local3) / _local2;
if ((_local16 >= -0.05) && (_local16 <= 1.05)) {
_local9 = (-((_local4 * _local10) + _local12)) / _local2;
_local14 = ((_local9 - _local1) * (_local9 - _local1)) + ((_local10 - _local3) * (_local10 - _local3));
}
_local7 = ((-_local8) - _local18) / (2 * _local13);
_local15 = (_local7 - _local3) / _local2;
if ((_local15 >= -0.05) && (_local15 <= 1.05)) {
_local6 = (-((_local4 * _local7) + _local12)) / _local2;
_local11 = ((_local6 - _local1) * (_local6 - _local1)) + ((_local7 - _local3) * (_local7 - _local3));
}
if (_local14 < _local11) {
(iP.x = _local9);
(iP.y = _local10);
(iP.R = Math.sqrt(_local14));
} else {
if (_local11 == 500000) {
return(false);
}
(iP.x = _local6);
(iP.y = _local7);
(iP.R = Math.sqrt(_local11));
}
return(true);
}
} else {
_local4 = _local3 - y2;
_local2 = x2 - _local1;
_local12 = (_local3 * (_local1 - x2)) - (_local1 * (_local3 - y2));
_local13 = 1 + ((_local4 * _local4) / (_local2 * _local2));
_local24 = (_local12 / _local2) + y0;
_local8 = (-2 * x0) + (((2 * _local4) / _local2) * _local24);
_local19 = ((x0 * x0) + (_local24 * _local24)) - R2;
_local17 = (_local8 * _local8) - ((4 * _local13) * _local19);
if (_local17 >= 0) {
_local18 = Math.sqrt(_local17);
_local9 = ((-_local8) + _local18) / (2 * _local13);
_local16 = (_local9 - _local1) / _local2;
if ((_local16 >= -0.05) && (_local16 <= 1.05)) {
_local10 = (-((_local4 * _local9) + _local12)) / _local2;
_local14 = ((_local9 - _local1) * (_local9 - _local1)) + ((_local10 - _local3) * (_local10 - _local3));
}
_local6 = ((-_local8) - _local18) / (2 * _local13);
_local15 = (_local6 - _local1) / _local2;
if ((_local15 >= -0.05) && (_local15 <= 1.05)) {
_local7 = (-((_local4 * _local6) + _local12)) / _local2;
_local11 = ((_local6 - _local1) * (_local6 - _local1)) + ((_local7 - _local3) * (_local7 - _local3));
}
if (_local14 < _local11) {
(iP.x = _local9);
(iP.y = _local10);
(iP.R = Math.sqrt(_local14));
} else {
if (_local11 == 500000) {
return(false);
}
(iP.x = _local6);
(iP.y = _local7);
(iP.R = Math.sqrt(_local11));
}
return(true);
}
}
return(false);
}
function checkMovingOff(mc_ball, col, row) {
var _local4 = this;
var _local6 = null;
var _local12 = null;
mc_ball.marked = true;
_local6 = _local4.tryRemoveColor(col, row, mc_ball.colorNum);
if (mc_ball.bonusNum == CBall.BONUS_COLOR) {
_local12 = _local4.tryRemoveColor(col, row, mc_ball.bonusColorNum);
if (_local6 == null) {
_local6 = _local12;
} else if (_local12 != null) {
_local6 = _local6.concat(_local12);
}
}
mc_ball.marked = false;
if (_local6 != null) {
if (mc_ball.bonusColorNum > 0) {
_root.sndBubbleLevelUp = true;
}
_local6.push({col:col, row:row, mc:mc_ball});
var _local9 = 0;
var _local10 = _local6.length;
var _local3;
var _local5;
_local3 = 0;
while (_local3 < _local10) {
col = _local6[_local3].col;
row = _local6[_local3].row;
_local5 = _local4.ball_array[row][col];
if (_local5 != null) {
_local4.colorCountArr[_local5.colorNum - 1]--;
_local4.checkLongBonus(_local5);
_local5.gotoAndPlay(2);
_local9++;
_local4.ball_array[row][col] = null;
}
_local3++;
}
_local4.checkPendingBalls();
_local4.checkOddRows();
_local4.fillBallsCount = _local9;
return(_local9);
}
return(0);
}
function fallAllBalls() {
var _local4 = this;
var _local5;
var _local6;
var _local3;
var _local2;
var _local9 = _local4.ball_array.length;
var _local7 = 0;
var _local8;
_local8 = _local4.mc_fall.attachMovie("lib_fall", "" + _local4.fallDepth, _local4.fallDepth);
_local4.fallDepth++;
_local6 = 0;
while (_local6 < _local9) {
_local5 = 0;
while (_local5 < COLS) {
_local3 = _local4.ball_array[_local6][_local5];
if (_local3 != null) {
_local4.ball_array[_local6][_local5] = null;
_local2 = _local3;
_local3 = _local8.attachMovie("lib_ball", "" + _local7, _local7);
_local7++;
_local3.setColor(_local2.colorNum);
_local3.setBonus(_local2.bonusNum, _local2.bonusColorNum);
_local3._x = ((_local4._x + _local2._x) + random(8)) - 4;
_local3._y = ((_local4._y + _local2._y) + random(8)) - 4;
_local4.colorCountArr[_local2.colorNum - 1]--;
_local2.removeMovieClip();
}
_local5++;
}
_local6++;
}
if (_local7 == 0) {
_local8.removeMovieClip();
}
}
function checkPendingBalls() {
var _local3 = this;
var _local15 = new Array();
var _local4 = 0;
var _local10;
var _local12;
var _local9;
var _local7;
var _local8;
var _local5;
var _local6;
var _local2;
var _local13 = _local3.ball_array.length;
var _local14;
while (true) {
_local14 = false;
_local9 = 0;
while (_local9 < COLS) {
_local2 = _local3.ball_array[0][_local9];
if ((_local3.ball_array[0][_local9] != null) && (_local2.marked == false)) {
_local3.stack_arr[_local4] = {col:_local9, row:0};
_local4++;
_local2.marked = true;
_local14 = true;
break;
}
_local9++;
}
if (_local14 == false) {
break;
}
while (_local4 > 0) {
_local4--;
_local7 = _local3.stack_arr[_local4].col;
_local8 = _local3.stack_arr[_local4].row;
if ((Math.abs(_local8 + _local3.addRowCount) % 2) == 0) {
_local10 = neighbours;
} else {
_local10 = neighbours2;
}
_local12 = 0;
while (_local12 < 6) {
_local5 = _local7 + _local10[_local12][0];
_local6 = _local8 + _local10[_local12][1];
_local2 = _local3.ball_array[_local6][_local5];
if ((((((_local5 >= 0) && (_local5 < COLS)) && (_local6 >= 0)) && (_local6 < _local13)) && (_local3.ball_array[_local6][_local5] != null)) && (_local2.marked == false)) {
_local2.marked = true;
_local3.stack_arr[_local4] = {col:_local5, row:_local6};
_local4++;
}
_local12++;
}
}
}
_local8 = 0;
while (_local8 < _local13) {
_local7 = 0;
while (_local7 < COLS) {
_local2 = _local3.ball_array[_local8][_local7];
if (_local2 != null) {
if (_local2.marked) {
_local2.marked = false;
} else {
_local15.push(_local2);
_local3.ball_array[_local8][_local7] = null;
}
}
_local7++;
}
_local8++;
}
if (_local15.length > 0) {
var _local17;
var _local16 = _local15.length;
var _local11;
_local3.fallBallsCount = _local16;
_local17 = _local3.mc_fall.attachMovie("lib_fall", "" + _local3.fallDepth, _local3.fallDepth);
_local3.fallDepth++;
_local12 = 0;
while (_local12 < _local16) {
_local2 = _local17.attachMovie("lib_ball", "" + _local12, _local12);
_local11 = _local15[_local12];
_local2.setColor(_local11.colorNum);
_local2.setBonus(_local11.bonusNum, _local11.bonusColorNum);
_local2._x = ((_local3._x + _local11._x) + random(8)) - 4;
_local2._y = ((_local3._y + _local11._y) + random(8)) - 4;
_local3.colorCountArr[_local11.colorNum - 1]--;
_local11.removeMovieClip();
_local12++;
}
}
}
function checkOddRows() {
var _local3 = this;
var _local2;
var _local4;
while (true) {
if (_local3.ball_array.length == 1) {
return(undefined);
}
_local4 = _local3.ball_array.length - 1;
_local2 = 0;
while (_local2 < COLS) {
if (_local3.ball_array[_local4][_local2] != null) {
return(undefined);
}
_local2++;
}
_local3.ball_array.pop();
}
}
function tryRemoveColor(col, row, colorNum) {
var _local10 = new Array();
var _local4 = 0;
var _local5;
var _local6;
var _local3;
var _local2;
var _local7;
var _local11 = ball_array.length;
stack_arr[_local4] = {col:col, row:row};
_local4++;
while (_local4 > 0) {
_local4--;
col = stack_arr[_local4].col;
row = stack_arr[_local4].row;
if ((Math.abs(row + addRowCount) % 2) == 0) {
_local5 = neighbours;
} else {
_local5 = neighbours2;
}
_local6 = 0;
while (_local6 < 6) {
_local3 = col + _local5[_local6][0];
_local2 = row + _local5[_local6][1];
if (((((((_local3 >= 0) && (_local3 < COLS)) && (_local2 >= 0)) && (_local2 < _local11)) && ((_local7 = ball_array[_local2][_local3]) != null)) && (_local7.marked == false)) && (_local7.isMyColor(colorNum))) {
_local7.marked = true;
_local10.push({col:_local3, row:_local2, mc:_local7});
stack_arr[_local4] = {col:_local3, row:_local2};
_local4++;
}
_local6++;
}
}
var _local13 = _local10.length;
_local6 = 0;
while (_local6 < _local13) {
_local10[_local6].mc.marked = false;
_local6++;
}
if (_local13 < 2) {
return(null);
}
return(_local10);
}
static var COLS = 11;
static var BALL_RAD = 14;
static var BALL_RAD_I = BALL_RAD - 1;
static var BALL_RAD_B = BALL_RAD + 1.5;
static var BALL_DIAM = 28;
static var BALL_DIAM_I = BALL_DIAM - 8.5;
static var BALL_DY = 25;
var addRowCount = 0;
var ballDepth = 0;
var maxColorNum = 8;
var maxBonusNum = 8;
var points = new Array();
var stack_arr = new Array(200);
static var neighbours = [[-1, 1], [0, 1], [-1, 0], [1, 0], [-1, -1], [0, -1]];
static var neighbours2 = [[0, 1], [1, 1], [-1, 0], [1, 0], [1, -1], [0, -1]];
static var neighboursXY = [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]];
static var neighboursXY2 = [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]];
var TRACE_TIME = 30000;
var FREEZE_TIME = 10000;
}
Symbol 305 MovieClip [__Packages.CFallMovie] Frame 0
class CFallMovie extends MovieClip
{
var time, state;
function CFallMovie () {
super();
time = 0;
state = 0;
}
function process(dTime) {
var _local2 = this;
var _local3 = dTime;
if (_local2.state == 0) {
_local2.time = _local2.time + _local3;
var _local4 = -180 + ((_local2.acc * _local2.time) / 1000);
if (_local4 < _local2.maxSpeed) {
_local2._y = _local2._y + ((_local4 * _local3) / 1000);
} else {
_local2._y = _local2._y + ((_local2.maxSpeed * _local3) / 1000);
_local2.state = 1;
}
return(undefined);
}
_local2._y = _local2._y + ((_local2.maxSpeed * _local3) / 1000);
}
var maxSpeed = 700;
var acc = 600;
}
Symbol 306 MovieClip [__Packages.CIndicator] Frame 0
class CIndicator extends MovieClip
{
var curValue, maxValue;
function CIndicator () {
super();
}
function init(maxValue_) {
var _local2 = this;
_local2.maxValue = maxValue_;
_local2.curValue = 0;
_local2.startY = _local2.mc_mask._y;
_local2.updateView();
}
function addValue(val) {
var _local2 = this;
_local2.curValue = _local2.curValue + val;
if (_local2.curValue > _local2.maxValue) {
_local2.curValue = _local2.maxValue;
}
_local2.updateView();
}
function reset() {
curValue = 0;
updateView();
}
function isFull() {
return(curValue >= maxValue);
}
function updateView() {
var _local2 = this;
_local2.mc_mask._y = (_local2.startY + _local2.mc_mask._height) - ((_local2.curValue / _local2.maxValue) * _local2.mc_mask._height);
}
}
Symbol 307 MovieClip [__Packages.CGun] Frame 0
class CGun extends MovieClip
{
var txtNumber, curWaitTime, mouseControl, disableFlag;
function CGun () {
var _local3 = this;
super();
_local3.bonusNum = 0;
_local3.hideMouse = false;
_local3.curWaitTime = _local3.WAIT_TIME * 2;
_local3.txtNumber = "";
_local3.disableFlag = false;
_local3.mouseControl = false;
_local3.prevLeft = (_local3.prevRight = false);
_local3.keySpeed = _local3.keyAcc;
}
function setColor(num) {
var _local2 = this;
_local2.colorNum = num;
_local2.gotoAndStop(_local2.colorNum);
}
function setBonus(bonusNum_, bonusColorNum_) {
var _local2 = this;
_local2.bonusNum = bonusNum_;
_local2.bonusColorNum = bonusColorNum_;
_local2.mc_bonus.gotoAndStop(1 + _local2.bonusNum);
if (_local2.bonusNum == CBall.BONUS_COLOR) {
_local2.mc_bonus.mc.gotoAndStop(_local2.bonusColorNum);
}
}
function processKeys(dTime) {
var _local2 = this;
var _local3 = Key.isDown(37);
var _local5 = Key.isDown(39);
if (_local3 || (_local5)) {
if (_local2.mouseControl) {
_local2.mouseControl = false;
if (_local2.hideMouse) {
_local2.hideMouse = false;
Mouse.show();
}
}
var _local4 = dTime / 1000;
_local2.keySpeed = _local2.keySpeed + _local2.keyAcc;
if (_local2.keySpeed > _local2.maxKeySpeed) {
_local2.keySpeed = _local2.maxKeySpeed;
}
if (_local3) {
if (!_local2.prevLeft) {
_local2.keySpeed = _local2.keyAcc;
_local2.prevLeft = true;
_local2.prevRight = false;
}
_local2._rotation = _local2._rotation - (_local4 * _local2.keySpeed);
if (_local2._rotation < (-MAX_UGOL)) {
_local2._rotation = -MAX_UGOL;
}
} else {
if (!_local2.prevRight) {
_local2.keySpeed = _local2.keyAcc / 2;
_local2.prevLeft = false;
_local2.prevRight = true;
}
_local2._rotation = _local2._rotation + (_local4 * _local2.keySpeed);
if (_local2._rotation > MAX_UGOL) {
_local2._rotation = MAX_UGOL;
}
}
return(undefined);
}
_local2.prevLeft = (_local2.prevRight = false);
}
function doShot() {
var _local2 = this;
_local2.curWaitTime = _local2.WAIT_TIME;
_local2.resetNumber();
}
function resetNumber() {
txtNumber = "";
}
function autoShot() {
return(curWaitTime == 0);
}
function process(xMouse) {
var _local3 = this;
if (_local3.mouseControl) {
var _local2 = xMouse - _local3._x;
if (!_local3.disableFlag) {
if ((_local2 > 170) || (_local2 < -170)) {
if (_local3.hideMouse) {
_local3.hideMouse = false;
Mouse.show();
}
} else if (!_local3.hideMouse) {
_local3.hideMouse = true;
Mouse.hide();
}
}
_local2 = _local2 / 130;
if (_local2 > 1) {
_local2 = 1;
} else if (_local2 < -1) {
_local2 = -1;
}
_local3._rotation = _local2 * MAX_UGOL;
}
}
function myMouseMove() {
mouseControl = true;
}
function disable() {
disableFlag = true;
Mouse.show();
}
function getShotPoint() {
var _local2 = this;
var _local3 = {x:_local2.mc_point._x, y:_local2.mc_point._y};
_local2.localToGlobal(_local3);
_local2._parent.globalToLocal(_local3);
return(_local3);
}
static var MAX_UGOL = 80;
var WAIT_TIME = 6400;
var maxKeySpeed = 85;
var keyAcc = 12;
}
Symbol 308 MovieClip [__Packages.CMoveBall] Frame 0
class CMoveBall extends CBall
{
var _visible, state;
function CMoveBall () {
super();
hide();
}
function startMove(x, y, vx_, vy_) {
var _local2 = this;
_local2._x = (_local2.sX = x);
_local2._y = (_local2.sY = y);
_local2.vx = vx_;
_local2.vy = vy_;
_local2.curR = 0;
_local2.calcEndPoint();
_local2.show();
}
function doStep(step) {
var _local2 = this;
_local2.curR = _local2.curR + step;
if (_local2.curR >= _local2.commonR) {
_local2.sX = _local2.eX;
_local2.sY = _local2.eY;
_local2.curR = 0;
_local2.vx = -_local2.vx;
_local2.calcEndPoint();
}
_local2._x = _local2.sX + (_local2.curR * _local2.vx);
_local2._y = _local2.sY + (_local2.curR * _local2.vy);
}
function calcEndPoint() {
var _local2 = this;
var _local3;
var _local4;
var _local5;
var _local6;
_local2.sX = _local2.sX - _local2.mc_grid._x;
_local2.sY = _local2.sY - _local2.mc_grid._y;
_local2.eX = _local2.sX + (1000 * _local2.vx);
_local2.eY = _local2.sY + (1000 * _local2.vy);
_local3 = _local2.sY - _local2.eY;
_local4 = _local2.eX - _local2.sX;
_local5 = (_local2.sX * (_local2.eY - _local2.sY)) - (_local2.sY * (_local2.eX - _local2.sX));
_local6 = Math.sqrt((_local3 * _local3) + (_local4 * _local4));
_local3 = _local3 / _local6;
_local4 = _local4 / _local6;
_local5 = _local5 / _local6;
var _local7 = _local2.mc_grid.getBoundsIntersection(_local2.vx, _local2.vy, _local3, _local4, _local5);
_local2.eX = _local7.x;
_local2.eY = _local7.y;
_local2.commonR = Math.sqrt(((_local2.eX - _local2.sX) * (_local2.eX - _local2.sX)) + ((_local2.eY - _local2.sY) * (_local2.eY - _local2.sY)));
_local2.sX = _local2.sX + _local2.mc_grid._x;
_local2.sY = _local2.sY + _local2.mc_grid._y;
_local2.eX = _local2.eX + _local2.mc_grid._x;
_local2.eY = _local2.eY + _local2.mc_grid._y;
}
function show() {
_visible = true;
state = 1;
}
function hide() {
_visible = false;
state = 0;
}
}
Symbol 45 MovieClip Frame 90
stop();
Symbol 47 Button
on (press) {
getURL ("http://www.gamesjolly.com", "_blank");
}
Symbol 95 MovieClip Frame 1
this.stop();
Symbol 111 MovieClip [lib_ball] Frame 1
#initclip 10
Object.registerClass("lib_ball", CBall);
#endinitclip
Symbol 111 MovieClip [lib_ball] Frame 15
this.removeMovieClip();
Symbol 111 MovieClip [lib_ball] Frame 17
this.removeMovieClip();
Symbol 117 MovieClip [lib_fall] Frame 1
#initclip 9
Object.registerClass("lib_fall", CFallMovie);
#endinitclip
Symbol 122 MovieClip Frame 1
this.stop();
Symbol 139 MovieClip Frame 15
stop();
Symbol 146 MovieClip Frame 20
stop();
Symbol 149 MovieClip Frame 20
stop();
Symbol 152 MovieClip Frame 20
stop();
Symbol 153 MovieClip Frame 20
_root.gotoAndStop("main");
Symbol 158 Button
on (press) {
getURL ("http://www.gamesjolly.com", "_blank");
}
Symbol 159 MovieClip Frame 20
stop();
Symbol 160 Button
on (release) {
new_game_pressed();
}
Symbol 161 Button
on (press) {
getURL ("http://www.gamesjolly.com/scores/Moods/index.php", "_blank");
}
Symbol 164 Button
on (release) {
how_to_play_pressed();
}
Symbol 165 Button
on (release) {
more_pressed();
}
Symbol 166 MovieClip Frame 1
stop();
Symbol 173 MovieClip Frame 20
_root.gotoAndPlay("gamemodes");
Symbol 174 MovieClip Frame 20
stop();
Symbol 175 Button
on (release) {
r = 0;
classic_mode_pressed();
}
Symbol 176 MovieClip Frame 20
stop();
Symbol 177 Button
on (release) {
back_pressed();
}
Symbol 178 MovieClip Frame 20
stop();
Symbol 179 Button
on (release) {
arcade_mode_pressed();
}
Symbol 203 MovieClip Frame 1
this.stop();
Symbol 204 MovieClip [lib_ball_move] Frame 1
#initclip 14
Object.registerClass("lib_ball_move", CMoveBall);
#endinitclip
Symbol 205 MovieClip [mc_grid] Frame 1
#initclip 11
Object.registerClass("mc_grid", CGrid);
#endinitclip
Symbol 214 MovieClip [lib_ind] Frame 1
#initclip 12
Object.registerClass("lib_ind", CIndicator);
#endinitclip
stop();
Symbol 214 MovieClip [lib_ind] Frame 2
stop();
Symbol 231 MovieClip [mc_gun_] Frame 1
#initclip 13
Object.registerClass("mc_gun_", CGun);
#endinitclip
this.stop();
Symbol 236 Button
on (release) {
_root.soundss = 0;
_root.btn.setVolume(0);
nextFrame();
}
Symbol 241 Button
on (release) {
_root.soundss = 1;
_root.btn.setVolume(100);
prevFrame();
}
Symbol 242 MovieClip Frame 1
this.stop();
Symbol 242 MovieClip Frame 2
stop();
Symbol 248 MovieClip Frame 20
stop();
Symbol 250 Button
on (release) {
newGame();
}
Symbol 251 Button
on (press) {
getURL ("http://www.gamesjolly.com", "_blank");
}
on (rollOver) {
_root.morebtnactive = true;
}
on (rollOver) {
_root.morebtnactive = false;
}
Symbol 256 MovieClip Frame 20
stop();
Symbol 257 Button
on (release) {
if (soundss == 1) {
btn_sound.gotoAndStop(1);
} else {
btn_sound.gotoAndStop(2);
}
rest_pressed();
}
Symbol 258 MovieClip Frame 10
stop();
Symbol 270 MovieClip Frame 20
stop();
Symbol 271 Button
on (release) {
this._parent.nextLevel();
}
Symbol 276 MovieClip Frame 20
stop();
Symbol 281 MovieClip Frame 20
stop();
Symbol 282 Button
on (release) {
this._parent.newGame();
}
Symbol 287 MovieClip Frame 20
stop();
Symbol 290 MovieClip Frame 20
stop();
Symbol 291 Button
on (press) {
submitScore();
}
on (release) {
this._parent.newGame();
}
Symbol 292 Button
on (release) {
this._parent.more_pressed();
}
Symbol 293 Button
on (release) {
this._parent.newGame();
}
Symbol 298 MovieClip Frame 20
stop();
Symbol 299 Button
on (press) {
submitScore();
}
on (release) {
this._parent.newGame();
}
Symbol 300 MovieClip Frame 3
function submitScore() {
var _local4 = pname_txt.text;
trace(_local4);
var _local3 = txtScores;
var _local1 = "";
if (_local3 == "") {
_local1 = _local1 + "The score is required\n";
}
if (_local1 != "") {
status_txt.text = _local1;
trace("hello1231233");
return(undefined);
}
var _local2 = new LoadVars();
_local2.name = _local4;
_local2.score = _local3;
_local2.send(path, "_blank", "POST");
}
var path = "http://www.gamesjolly.com/scores/Moods/submit.php";
Symbol 300 MovieClip Frame 4
function submitScore() {
var _local4 = pname_txt.text;
trace(_local4);
var _local1 = txtScores;
trace(_local1);
var _local2 = "";
if (_local1 == "") {
_local2 = _local2 + "The score is required\n";
}
if (_local2 != "") {
status_txt.text = _local2;
trace("hello1231233");
return(undefined);
}
var _local3 = new LoadVars();
_local3.name = _local4;
_local3.score = _local1;
_local3.send(path, "_blank", "POST");
}
var path = "http://www.gamesjolly.com/scores/Moods/submit.php";