Frame 1
function goTo() {
getURL ("http://www.MoFunZone.com");
}
var newMenu = new ContextMenu();
newMenu.hideBuiltInItems();
newMenu.customItems.push(new ContextMenuItem("MoFunZone.com - Play More Games", goTo));
this.menu = newMenu;
new Sound().setVolume(100);
function strToBool(conv) {
if (conv == "true") {
conv = true;
return(conv);
}
if (conv == "false") {
conv = false;
return(conv);
}
}
function strToNum(conv) {
if (conv == "1") {
conv = 1;
return(conv);
}
if (conv == "2") {
conv = 2;
return(conv);
}
}
_root.gamedemo = false;
_root.webdemo = false;
_root.so = SharedObject.getLocal("se");
if (_root.so.data.gamesave != true) {
_root.maxconti = 5;
_root.so.data.continuecount = _root.maxconti;
}
_root.continuecount = _root.so.data.continuecount;
loadVariables ("saveconfig.txt", _root);
loadVariables ("savequality.txt", _root);
_root.onEnterFrame = function () {
if (_root.getBytesLoaded() >= _root.getBytesTotal()) {
_root.onEnterFrame = null;
gotoAndPlay (2);
} else {
_root.bytesloadedresult = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
_root.preloadergage.gotoAndStop(1 + Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100));
}
};
stop();
Frame 2
_root.b_skip.onRelease = function () {
gotoAndStop (82);
};
Frame 71
Frame 82
_root.storystartLV = 1;
_root.survivalstartLV = 9;
stop();
_root.pa_warning._visible = false;
_root.pa_setting._visible = false;
_root.pa_help._visible = false;
_root.b_start0.onRelease = function () {
if (((_root.pa_setting._visible != true) and (_root.so.data.gamesave != true)) or (_root.so.data.continuecount == 0)) {
_root.gamemode = "story";
_root.so.data.gamesave = false;
_root.so.data.continuecount = _root.maxconti;
play();
}
};
_root.b_start1._alpha = 25;
if ((((_root.so.data.gamesave != true) or (_root.gamedemo == true)) or (_root.webdemo == true)) or (_root.so.data.continuecount == 0)) {
_root.b_continue._alpha = 25;
} else {
_root.b_continue._alpha = 255;
}
_root.b_continue.onRelease = function () {
if ((_root.so.data.gamesave == true) and (_root.b_continue._alpha >= 100)) {
_root.so.data.continued = true;
_root.continuecount--;
_root.so.data.continuecount = _root.continuecount;
play();
}
};
_root.b_setting.onRelease = function () {
_root.pa_setting._visible = true;
};
if (_root.gamedemo == true) {
_root.b_seti._alpha = 25;
}
_root.b_help.onRelease = function () {
if (_root.pa_setting._visible != true) {
_root.pa_help._visible = true;
_root.pa_help.gotoAndStop(2);
}
};
_root.b_quit.onRelease = function () {
fscommand ("quit");
};
if (_root.gamedemo == true) {
_root.b_quit._visible = false;
}
if (_root.gamedemo != true) {
_root.b_buy._visible = false;
}
_root.b_buy.onRelease = function () {
getURL ("http://www.greenhermit.net", "_blank");
};
_root.b_more.onRelease = function () {
getURL ("http://www.mofunzone.com/", "_blank");
};
_root.b_highscore.onRelease = function () {
getURL ("http://www.mofunzone.com/game_scores/aquacubes/highscores.shtml", "_blank");
};
_root.displaymode = 1;
_root.pa_setting.window.gotoAndStop(strToNum(_root.win_act));
_root.pa_setting.full_low.gotoAndStop(strToNum(_root.low_act));
_root.pa_setting.full_mid.gotoAndStop(strToNum(_root.mid_act));
_root.pa_setting.full_high.gotoAndStop(strToNum(_root.high_act));
_root.pa_setting.q_low.gotoAndStop(strToNum(_root.q_low));
_root.pa_setting.q_mid.gotoAndStop(strToNum(_root.q_mid));
_root.pa_setting.q_high.gotoAndStop(strToNum(_root.q_high));
if (strToNum(_root.q_low) == 2) {
_root._quality = "LOW";
}
if (strToNum(_root.q_mid) == 2) {
_root._quality = "MEDIUM";
}
if (strToNum(_root.q_high) == 2) {
_root._quality = "HIGH";
}
_root.pa_setting.b_cancel.onRelease = function () {
_root.pa_setting.window.gotoAndStop(strToNum(_root.win_act));
_root.pa_setting.full_low.gotoAndStop(strToNum(_root.low_act));
_root.pa_setting.full_mid.gotoAndStop(strToNum(_root.mid_act));
_root.pa_setting.full_high.gotoAndStop(strToNum(_root.high_act));
_root.pa_setting.q_low.gotoAndStop(strToNum(_root.q_low));
_root.pa_setting.q_mid.gotoAndStop(strToNum(_root.q_mid));
_root.pa_setting.q_high.gotoAndStop(strToNum(_root.q_high));
if (strToNum(_root.q_low) == 2) {
_root._quality = "LOW";
}
if (strToNum(_root.q_mid) == 2) {
_root._quality = "MEDIUM";
}
if (strToNum(_root.q_high) == 2) {
_root._quality = "HIGH";
}
_root.pa_setting._visible = false;
};
_root.pa_setting.b_ok.onRelease = function () {
_root.pa_setting._visible = false;
_root.displaymode = (((_root.pa_setting.window._currentframe * 1000) + (_root.pa_setting.full_low._currentframe * 100)) + (_root.pa_setting.full_mid._currentframe * 10)) + _root.pa_setting.full_high._currentframe;
fscommand ("open", "config.txt");
fscommand ("write", _root.displaymode);
fscommand ("close");
fscommand ("open", "saveconfig.txt");
fscommand ("write", (((((("win_act=" + _root.pa_setting.b_window._currentframe) + "&low_act=") + _root.pa_setting.b_fulllow._currentframe) + "&mid_act=") + _root.pa_setting.b_fullmid._currentframe) + "&high_act=") + _root.pa_setting.b_fullhigh._currentframe);
fscommand ("close");
fscommand ("open", "savequality.txt");
fscommand ("write", (((("q_low=" + _root.pa_setting.b_qlow._currentframe) + "&q_mid=") + _root.pa_setting.b_qmid._currentframe) + "&q_high=") + _root.pa_setting.b_qhigh._currentframe);
fscommand ("close");
};
Frame 83
stopAllSounds();
_root.bgm = new Sound();
_root.bgm.attachSound("bgm" + random(3));
_root.bgm.start(0, 1);
_root.bgm.onSoundComplete = function () {
_root.bgm.attachSound("bgm" + random(3));
_root.bgm.start(0, 1);
};
_root.today = new Date();
_root.EPOCH_TIME = _root.today.getTime();
removeClip = function () {
removeMovieClip(_root.pa_help);
removeMovieClip(_root.pa_syst);
removeMovieClip(_root.fx_over);
removeMovieClip(_root.fx_lvclear);
};
pauseChecker = function () {
if ((_root.gamepause == true) or (_root.systpause == true)) {
_root.b_pause.gotoAndStop("pause");
} else {
_root.b_pause.gotoAndStop("play");
}
};
hint.onRelease = function () {
if ((_root.sp >= 100) and (_root.gamemode == "story")) {
_root.sp = 0;
_root.sfx_hint.start(0, 1);
var _local2 = board.getHint();
trace((((_local2.dir + ",") + _local2.step) + ",") + _local2.no);
var _local3 = board["block" + _local2.no];
var _local4;
switch (_local2.dir) {
case "R" :
if (_local2.step < 0) {
_local2.step = _local2.step + board.col;
}
_local4 = board.getRealBlock(_local3.pos.row, _local3.pos.col + _local2.step);
hint_start.gotoAndStop(1);
break;
case "C" :
if (_local2.step < 0) {
_local2.step = _local2.step + board.row;
}
_local4 = board.getRealBlock(_local3.pos.row + _local2.step, _local3.pos.col);
hint_start.gotoAndStop(2);
}
trace((((_local3 + ",") + _local3.pos.row) + ",") + _local3.pos.col);
trace((((_local4 + ",") + _local4.pos.row) + ",") + _local4.pos.col);
var _local6 = {x:0, y:0};
_local3.localToGlobal(_local6);
hint_start._parent.globalToLocal(_local6);
hint_start._x = _local6.x;
hint_start._y = _local6.y;
hint_start._visible = true;
var _local5 = {x:0, y:0};
_local4.localToGlobal(_local5);
hint_target._parent.globalToLocal(_local5);
hint_target._x = _local5.x;
hint_target._y = _local5.y;
hint_target._visible = true;
}
};
hint_start._visible = false;
hint_target._visible = false;
function setBlock(block, frame) {
block.color = frame % MAX_COLOR;
block.bomb = ((frame > MAX_COLOR) ? true : false);
block.gotoAndStop(frame);
}
var BLOCK_WIDTH = 40;
var BLOCK_HEIGHT = 40;
var MIN_BLOCK = 4;
var MAX_COLOR = 9;
ctrl.initialGame = function (row, col) {
trace("initialGame");
board.row = row;
board.col = col;
var _local2;
_local2 = 1;
var _local6 = 1;
while (_local6 <= col) {
var _local5 = row;
while (_local5 >= 1) {
var _local4 = board.attachMovie("obj_piece", "block" + _local2, _local2);
_local4.no = _local2;
var _local3 = new Object();
_local3.row = _local5;
_local3.col = _local6;
_local3.x = (_local4._x = (_local6 - 1) * BLOCK_WIDTH);
_local3.y = (_local4._y = (_local5 - 1) * BLOCK_HEIGHT);
_local2++;
_local4.pos = _local3;
_local4.onPress = function () {
trace((((this + ",") + this.color) + ",") + this.bomb);
ctrl.startMove(this);
};
_local5--;
}
_local6++;
}
board.createEmptyMovieClip("contCol1", 1101);
board.createEmptyMovieClip("contCol2", 1102);
board.createEmptyMovieClip("contRow1", 1103);
board.createEmptyMovieClip("contRow2", 1104);
var _local7;
var _local8 = 1;
while (_local8 <= 2) {
_local7 = board["contCol" + _local8];
_local7._visible = false;
_local2 = 1;
var _local5 = 0;
while (_local5 < row) {
var _local4 = _local7.attachMovie("obj_piece", "block" + _local2, _local2);
_local2++;
_local4._x = 0;
_local4._y = _local5 * BLOCK_HEIGHT;
_local4.stop();
_local5++;
}
_local7 = board["contRow" + _local8];
_local7._visible = false;
_local2 = 1;
_local6 = 0;
while (_local6 < col) {
var _local4 = _local7.attachMovie("obj_piece", "block" + _local2, _local2);
_local2++;
_local4._x = _local6 * BLOCK_WIDTH;
_local4._y = 0;
_local4.stop();
_local6++;
}
_local8++;
}
};
ctrl.resetGame = function () {
hint_start._visible = false;
hint_target._visible = false;
delete this.onEnterFrame;
delete this.onMouseMove;
delete this.onMouseUp;
delete this.disposeInfo;
delete this.moveInfo;
this.onEnterFrame = function () {
this.checkMove();
delete this.onEnterFrame;
trace("movable : " + this.movable);
};
combo.gotoAndStop(1);
board.resetBoard();
};
board.createDisposeAt = function (block) {
var _local3 = this.dNo;
var _local2 = this.attachMovie("fx_explode", "explode" + _local3, 2000 + _local3);
if (_local2) {
this.dNo++;
_local2._x = block._x;
_local2._y = block._y;
}
};
board.createLinkAt = function (block, dir) {
var _local1;
if (dir == "T") {
_local1 = block.attachMovie("linkT", "link1", 101);
} else if (dir == "B") {
_local1 = block.attachMovie("linkB", "link2", 101);
}
return(_local1);
};
ctrl.randomLink = function () {
if ((this.moveInfo == undefined) && (this.disposeInfo == undefined)) {
trace("ctrl.randomLink");
board.randomLink(blocks);
delete this.linkInfo;
} else {
this.linkInfo = true;
}
};
board.randomLink = function () {
trace("randomLink");
var _local4 = this.getBlocks();
_local4.shift();
var _local10 = 0;
var _local5 = _local4.length - 1;
while (_local5 >= 0) {
if (_local4[_local5].link1) {
_local10++;
}
_local5--;
}
if (_local10 < game.maxObstruct) {
trace("board.randomLink");
var _local8 = false;
do {
var _local6 = Math.floor(Math.random() * _local4.length);
var _local2 = _local4[_local6];
var _local7 = _local2.pos.row;
var _local9 = _local2.pos.col;
_local4.splice(_local6, 1);
if (_local7 != this.row) {
var _local3 = this.getRealBlock(_local2.pos.row + 1, _local2.pos.col);
if ((((_local2.link1 == undefined) && (_local2.link2 == undefined)) && (_local3.link1 == undefined)) && (_local3.link2 == undefined)) {
this.createLinkAt(_local2, "T");
this.createLinkAt(_local3, "B");
_local2.link1.linkTo = _local3.link2;
_local3.link2.linkTo = _local2.link1;
_local8 = true;
}
}
} while ((!_local8) && (_local4.length > 0));
}
};
board.resetBoard = function () {
this.dNo = 0;
this.backToNormal();
var i = (this.row * this.col);
while (i > 0) {
with (this["block" + i]) {
_x = pos.x;
_y = pos.y;
}
i--;
}
};
board.backToNormal = function () {
this.contCol1._visible = false;
this.contCol2._visible = false;
this.contRow1._visible = false;
this.contRow2._visible = false;
var _local2 = this.grab.pos;
this.setVisibleLine("C", _local2.col, true);
this.setVisibleLine("R", _local2.row, true);
};
board.getRealBlock = function (tr, tc) {
return(this["block" + (((tc - 1) * this.col) + ((this.row - tr) + 1))]);
};
board.setVisibleLine = function (dir, t, vis) {
var _local2 = function (block) {
block._visible = vis;
};
this.traverse(dir, t, _local2);
};
board.traverse = function (dir, t, action) {
switch (dir) {
case "R" :
var _local3 = 1;
while (_local3 <= this.col) {
action.apply(action, [this.getRealBlock(t, _local3)]);
_local3++;
}
break;
case "C" :
var _local2 = 1;
for(;;){
if (_local2 > this.row) {
break;
}
action.apply(action, [this.getRealBlock(_local2, t)]);
_local2++;
};
}
};
board.randomBoard = function () {
var _local7 = new Array((this.row * this.col) + 1);
var _local3 = 1;
while (_local3 < _local7.length) {
var _local6 = false;
do {
var _local5 = 1 + Math.floor(Math.random() * game.playColor);
_local7[_local3] = {color:_local5};
var _local4 = this.findSmallAdjacent(_local3, _local7);
if ((_local4 == undefined) || (_local4.length < MIN_BLOCK)) {
_local6 = true;
var _local2 = this["block" + _local3];
setBlock(_local2, _local5);
_local2.link1.removeMovieClip();
_local2.link2.removeMovieClip();
}
} while (!_local6);
_local3++;
}
};
board.getHint = function () {
var _local8 = 1;
while (_local8 <= this.row) {
var _local5 = 1;
while (_local5 <= this.col) {
var _local3 = this.getRealBlock(_local8, _local5);
var _local6;
var _local2;
if (!this.getLock(_local3).lockRow) {
var _local7 = 1;
while (_local7 <= this.row) {
var _local10 = _local7 - _local8;
if (_local10 != 0) {
_local6 = this.prepareAdjacent(_local3, "R", _local10).blocks;
var _local12 = new Array();
var _local4 = this.col;
while (_local4 >= 1) {
_local2 = this.findSmallAdjacent(this.getRealBlock(_local8, _local4).no, _local6);
if (_local2 && (_local2.length >= MIN_BLOCK)) {
return({dir:"R", step:_local10, no:_local3.no});
}
_local4--;
}
}
_local7++;
}
}
var _local7 = 1;
while (_local7 <= this.col) {
var _local10 = _local7 - _local5;
if (_local10 != 0) {
_local6 = this.prepareAdjacent(_local3, "C", _local10).blocks;
var _local12 = new Array();
var _local4 = this.row;
while (_local4 >= 1) {
_local2 = this.findSmallAdjacent(this.getRealBlock(_local4, _local5).no, _local6);
if (_local2 && (_local2.length >= MIN_BLOCK)) {
return({dir:"C", step:_local10, no:_local3.no});
}
_local4--;
}
}
_local7++;
}
_local5++;
}
_local8++;
}
};
board.getLock = function (block) {
var _local6 = new Object();
var _local5;
_local5 = block.pos.row;
var _local3 = 1;
while (_local3 <= this.col) {
var _local4 = this.getRealBlock(_local5, _local3);
if (_local4.link1 || (_local4.link2)) {
_local6.lockRow = true;
break;
}
_local3++;
}
_local5 = block.pos.col;
var _local2 = 1;
while (_local2 <= this.row) {
if (this.getRealBlock(_local2, _local5).linkCol) {
_local6.lockCol = true;
break;
}
_local2++;
}
return(_local6);
};
board.prepareAdjacent = function (block, dir, step) {
var _local4;
switch (dir) {
case "R" :
_local4 = (this.row - block.pos.row) + 1;
break;
case "C" :
_local4 = block.pos.col;
}
var _local5 = this.getBlocks();
var _local6 = this.getRollChanged(_local5, dir, _local4, step);
var _local2 = _local6.length - 1;
while (_local2 >= 0) {
var _local3 = _local6[_local2];
_local5[_local3.no] = _local3.value;
_local2--;
}
return({blocks:_local5, roll:_local6});
};
board.getAdjacent = function (find, blocks) {
var _local4 = new Array();
var _local6;
while (_local6 = find.pop() , _local6) {
var _local5;
var _local3 = _local4.length - 1;
while (_local3 >= 0) {
var _local2 = _local4[_local3].length - 1;
while (_local2 >= 0) {
if (_local4[_local3][_local2] == _local6) {
_local5 = true;
break;
}
_local2--;
}
if (_local5) {
break;
}
_local3--;
}
if (!_local5) {
var _local7 = this.findAdjacent(_local6, blocks);
if (_local7 && (_local7.length >= MIN_BLOCK)) {
_local4.push(_local7);
}
}
}
return(_local4);
};
board.blazeTheBomb = function (res) {
var _local9 = this.row;
var _local14 = this.col;
var _local10 = 0;
while (_local10 < res.length) {
var _local4 = res[_local10];
if (this["block" + _local4].bomb) {
var _local11 = new Sound();
_local11.attachSound("sfx_explode01");
_local11.start();
var _local6 = [_local4 - _local9, _local4 + _local9];
var _local12 = _local4 % _local9;
if (_local12 != 0) {
_local6 = _local6.concat([(_local4 - _local9) + 1, _local4 + 1, (_local4 + _local9) + 1]);
}
if (_local12 != 1) {
_local6 = _local6.concat([(_local4 - _local9) - 1, _local4 - 1, (_local4 + _local9) - 1]);
}
var _local13 = _local9 * _local14;
var _local7 = 0;
while (_local7 < _local6.length) {
var _local3 = _local6[_local7];
if ((_local3 >= 1) && (_local3 <= _local13)) {
var _local8 = false;
var _local2 = 0;
while (_local2 < res.length) {
if (res[_local2] == _local3) {
_local8 = true;
break;
}
_local2++;
}
if (!_local8) {
res.push(_local3);
}
}
_local7++;
}
}
_local10++;
}
return(res);
};
ctrl.startMove = function (block) {
if (_root.gamepause) {
return(undefined);
}
if (this.moveInfo != undefined) {
return(undefined);
}
if (this.disposeInfo != undefined) {
return(undefined);
}
board.grab = block;
board.bound = block.getBounds(this);
delete this.lock;
delete this.lockRow;
delete this.lockCol;
var _local15 = board.getLock(block);
this.lockRow = _local15.lockRow;
this.lockCol = _local15.lockCol;
this.onMouseUp = function () {
delete this.onMouseMove;
delete this.onMouseUp;
var _local17 = this.lock;
delete this.lock;
if (_local17) {
delete this.moveInfo;
return(undefined);
}
var _local11 = this.moveInfo;
if (_local11 != undefined) {
var _local14;
var _local9 = new Array();
trace(_local11.step);
switch (_local11.dir) {
case "R" :
_local14 = Math.round(_local11.step / BLOCK_WIDTH);
var _local10 = board.grab.pos.row;
var _local5 = board.col;
while (_local5 >= 1) {
_local9.push(board.getRealBlock(_local10, _local5).no);
_local5--;
}
break;
case "C" :
_local14 = Math.round(_local11.step / BLOCK_HEIGHT);
_local10 = board.grab.pos.col;
_local5 = board.row;
for(;;){
if (_local5 < 1) {
break;
}
_local9.push(board.getRealBlock(_local5, _local10).no);
_local5--;
};
}
var _local13 = board.prepareAdjacent(board.grab, _local11.dir, _local14);
var _local15 = _local13.blocks;
var _local6 = _local13.roll;
var _local16 = board.getAdjacent(_local9, _local15);
game.sum = 0;
var _local12 = game.calculate(_local16);
trace("found : " + _local12);
if (_local12.length > 0) {
_local5 = _local6.length - 1;
while (_local5 >= 0) {
var _local2 = _local6[_local5];
var _local4 = board["block" + _local2.no];
setBlock(_local4, _local2.face);
if (_local2.link1) {
board.createLinkAt(_local4, "T");
} else {
_local4.link1.removeMovieClip();
}
if (_local2.link2) {
board.createLinkAt(_local4, "B");
} else {
_local4.link2.removeMovieClip();
}
_local5--;
}
_local5 = _local6.length - 1;
while (_local5 >= 0) {
var _local3 = _local6[_local5].no;
var _local4 = board["block" + _local3];
if (_local4.link2) {
var _local8 = (((_local3 % board.row) == 0) ? ((_local3 - board.row) + 1) : (_local3 + 1));
var _local7 = board["block" + _local8];
_local4.link2.linkTo = _local7.link1;
_local7.link1.linkTo = _local4.link2;
}
_local5--;
}
this.moveInfo.step = 0;
this.onRollBlockBack();
_local12 = board.blazeTheBomb(_local12);
this.disposeBlock(_local12);
} else {
this.onEnterFrame = this.onRollBlockBack;
}
}
};
this.onMouseMove = this.onMoveInBlock;
};
board.findDispose = function (list) {
var _local2 = this.getBlocks();
var _local3 = this.getAdjacent(list, _local2);
return(_local3);
};
board.afterDispose = function (list) {
this.dNo = 0;
var _local7 = 0;
while (_local7 < list.length) {
var _local3 = list[_local7];
var _local2 = 1 + Math.floor(Math.random() * game.playColor);
setBlock(_local3, _local2);
_local7++;
}
if (Math.floor(Math.random() * 100) < 4) {
_local7 = Math.floor(Math.random() * list.length);
var _local5 = list[_local7];
var _local6 = _local5._currentframe + MAX_COLOR;
if (_local6 <= _local5._totalframes) {
setBlock(_local5, _local6);
}
}
};
ctrl.playUnlockSound = function (block) {
if (block.link1 || (block.link2)) {
}
};
ctrl.disposeBlock = function (list) {
hint_start._visible = false;
hint_target._visible = false;
disposeResult(list);
list.sort(Array.NUMERIC);
var _local17 = new Array();
var _local7 = 1;
var _local3 = board.row;
var _local14;
var _local16 = 0;
while (_local16 < board.col) {
_local14 = board["block" + _local3];
var _local15;
var _local6 = 0;
while (_local6 < list.length) {
if (list[_local6] <= _local3) {
_local15 = _local6;
}
_local6++;
}
if (_local15 != undefined) {
var _local11 = list.splice(0, _local15 + 1);
trace(">..." + _local11);
_local6 = 0;
while (_local6 < _local11.length) {
var _local12 = board["block" + _local11[_local6]];
board.createDisposeAt(_local12);
_local12._y = _local14._y - BLOCK_HEIGHT;
_local12.dispose = true;
_local14 = _local12;
this.playUnlockSound(_local12);
_local12.link1.linkTo.removeMovieClip();
_local12.link1.removeMovieClip();
_local12.link2.linkTo.removeMovieClip();
_local12.link2.removeMovieClip();
_local6++;
}
var _local10 = new Array();
var _local4 = _local7;
while (_local4 <= _local3) {
var _local12 = board["block" + _local4];
var _local2 = new Object();
_local2._y = _local12._y;
_local2.no = _local4;
_local2.type = _local12._currentframe;
_local2.dispose = _local12.dispose;
if (_local4 == _local7) {
this.playUnlockSound(_local12);
_local12.link1.removeMovieClip();
_local12.link1.linkTo.removeMovieClip();
} else if (_local4 == _local3) {
_local12.link2.removeMovieClip();
_local12.link2.linkTo.removeMovieClip();
}
_local2.link1 = _local12.link1 != undefined;
_local2.link2 = _local12.link2 != undefined;
_local12.link1.removeMovieClip();
_local12.link2.removeMovieClip();
_local10.push(_local2);
_local4++;
}
_local10.sortOn("_y", Array.NUMERIC | Array.DESCENDING);
_local4 = _local7;
var _local9 = 0;
while (_local4 <= _local3) {
var _local12 = board["block" + _local4];
var _local2 = _local10[_local9];
_local12._y = _local2._y;
setBlock(_local12, _local2.type);
if (_local2.link1) {
board.createLinkAt(_local12, "T");
}
if (_local2.link2) {
board.createLinkAt(_local12, "B");
}
delete _local12.dispose;
if (_local2.dispose) {
_local17.push(_local12);
}
_local4++;
_local9++;
}
_local4 = _local7;
while (_local4 <= _local3) {
var _local5 = board["block" + _local4];
if (_local5.link2) {
var _local8 = board["block" + (_local4 + 1)];
_local5.link2.linkTo = _local8.link1;
_local8.link1.linkTo = _local5.link2;
}
_local4++;
}
}
_local16++;
_local7 = _local7 + board.row;
_local3 = _local3 + board.row;
}
var _local18 = new Array();
var _local19 = new Array();
_local16 = board.row * board.col;
while (_local16 >= 1) {
var _local12 = board["block" + _local16];
if (_local12._y != _local12.pos.y) {
_local18.push(_local12);
_local19.push(_local12.no);
}
_local16--;
}
var _local20 = new Object();
_local20.list = _local17;
_local20.moveBlock = _local18;
_local20.findBlock = _local19;
this.disposeInfo = _local20;
this.finish = getTimer() + 500;
this.onEnterFrame = function () {
if (getTimer() > this.finish) {
delete this.finish;
board.afterDispose(this.disposeInfo.list);
this.onEnterFrame = this.onBlockFall;
}
};
};
ctrl.checkMove = function () {
var _local2 = board.getHint();
this.movable = _local2 != undefined;
};
ctrl.onBlockFall = function () {
var _local5 = this.disposeInfo.moveBlock;
var _local4 = _local5.length - 1;
while (_local4 >= 0) {
var _local3 = _local5[_local4];
_local3._y = _local3._y + Math.min(_local3.pos.y - _local3._y, 20);
if (_local3._y == _local3.pos.y) {
_local5.splice(_local4, 1);
}
_local4--;
}
if (_local5.length == 0) {
this.finish = getTimer() + 100;
this.onEnterFrame = function () {
if (getTimer() > this.finish) {
delete this.finish;
this.onEnterFrame = function () {
if (_root.gamepause) {
return(undefined);
}
var _local4 = board.findDispose(this.disposeInfo.findBlock);
var _local3 = game.calculate(_local4);
if (_local3.length > 0) {
_local3 = board.blazeTheBomb(_local3);
this.disposeBlock(_local3);
} else {
delete this.disposeInfo;
delete this.onEnterFrame;
if (this.linkInfo) {
ctrl.randomLink();
}
this.checkMove();
combo.gotoAndStop(1);
}
};
}
};
}
};
game.calculate = function (adj) {
var _local4 = new Array();
var _local6 = 0;
var _local7 = 0;
var _local3 = 0;
while (_local3 < adj.length) {
_local4 = _local4.concat(adj[_local3]);
var _local2 = adj[_local3].length;
game.sum = game.sum + _local2;
_local6 = Math.max(_local2, _local6);
if (_local2 > 6) {
_local7 = _local7 + ((_local2 - 6) * 100);
}
_local3++;
}
if (_local4.length > 0) {
if (_root.gamemode == "story") {
trace("add score story");
_root.score = _root.score + ((_local4.length * 10) + _local7);
}
if (_root.gamemode == "survival") {
trace("add score survival");
_root.score = _root.score + (((MAX_COLOR + _local4.length) + _local7) * 15);
}
}
if (game.sum >= 11) {
combo.gotoAndStop(4);
} else if (game.sum >= 9) {
combo.gotoAndStop(3);
} else if (game.sum >= 7) {
combo.gotoAndStop(2);
}
combo.cmb.gotoAndPlay(1);
return(_local4);
};
ctrl.onRollBlockBack = function () {
var _local2 = this.moveInfo;
if (_local2.step == 0) {
board.backToNormal();
delete this.moveInfo;
delete this.onEnterFrame;
} else {
_local2.step = _local2.step * 0.8;
if (Math.abs(_local2.step) < 1) {
_local2.step = 0;
}
this.updateMove();
}
};
ctrl.getDirection = function (bound, x, y) {
var _local3 = bound;
var _local7;
var _local6;
var _local5;
var _local4;
_local7 = _local3.xMin - x;
_local6 = x - _local3.xMax;
_local5 = _local3.yMin - y;
_local4 = y - _local3.yMax;
var _local2 = Math.max(Math.max(_local7, _local6), Math.max(_local5, _local4));
if (_local2 > 0) {
var _local1 = new Object();
if (_local2 == _local7) {
_local1.dir = "R";
_local1.step = -_local2;
} else if (_local2 == _local6) {
_local1.dir = "R";
_local1.step = _local2;
} else if (_local2 == _local5) {
_local1.dir = "C";
_local1.step = -_local2;
} else if (_local2 == _local4) {
_local1.dir = "C";
_local1.step = _local2;
}
return(_local1);
}
};
ctrl.onMoveInBlock = function () {
delete this.lock;
var _local5 = this.getDirection(board.bound, this._xmouse, this._ymouse);
if (_local5 != undefined) {
this.moveInfo = _local5;
var _local4 = board.grab.pos;
var _local6;
var _local3;
var _local2;
var lock;
switch (_local5.dir) {
case "R" :
_local3 = board.contRow1;
_local3._x = 0;
_local3._y = _local4.y;
_local2 = board.contRow2;
_local2._x = 0;
_local2._y = _local4.y;
_local6 = _local4.row;
if (this.lockRow) {
lock = true;
}
break;
case "C" :
_local3 = board.contCol1;
_local3._x = _local4.x;
_local3._y = 0;
_local2 = board.contCol2;
_local2._x = _local4.x;
_local2._y = 0;
_local6 = _local4.col;
if (!this.lockCol) {
break;
}
lock = true;
}
this.lock = lock == true;
trace(this.lock);
if (lock) {
trace("lock.............");
} else {
board.setVisibleLine(_local5.dir, _local6, false);
this.setContainerLine(_local5.dir, _local6, [_local3, _local2]);
_local3._visible = true;
_local2._visible = true;
this.onMouseMove = this.onMoveOutBlock;
}
} else {
board.backToNormal();
delete this.moveInfo;
}
};
ctrl.setContainerLine = function (dir, t, cont) {
var _local7;
var _local2;
_local7 = ((dir == "R") ? (board.col) : (board.row));
var _local3 = 1;
while (_local3 <= _local7) {
if (dir == "R") {
_local2 = board.getRealBlock(t, _local3);
} else {
_local2 = board.getRealBlock(_local3, t);
}
for (var _local6 in cont) {
var _local1 = cont[_local6]["block" + _local3];
setBlock(_local1, _local2._currentframe);
if (_local2.link1) {
board.createLinkAt(_local1, "T");
} else {
_local1.link1.removeMovieClip();
}
if (_local2.link2) {
board.createLinkAt(_local1, "B");
} else {
_local1.link2.removeMovieClip();
}
}
_local3++;
}
};
ctrl.onMoveOutBlock = function () {
var _local2 = this.getDirection(board.bound, this._xmouse, this._ymouse);
if (_local2 != undefined) {
switch (_local2.dir) {
case "C" :
_local2.step = _local2.step + ((((_local2.step > 0) ? 1 : -1) * BLOCK_HEIGHT) / 2);
break;
case "R" :
_local2.step = _local2.step + ((((_local2.step > 0) ? 1 : -1) * BLOCK_WIDTH) / 2);
}
this.moveInfo = _local2;
this.updateMove();
} else {
trace("come back");
this.onMouseMove = this.onMoveInBlock;
}
};
ctrl.updateMove = function () {
var _local3 = this.moveInfo.step;
var _local4 = board.grab;
var _local2;
switch (this.moveInfo.dir) {
case "C" :
_local2 = board.contCol1;
_local2._y = _local3 % _local2._height;
board.contCol2._y = _local2._y + (((_local3 > 0) ? -1 : 1) * _local2._height);
break;
case "R" :
_local2 = board.contRow1;
_local2._x = _local3 % _local2._width;
board.contRow2._x = _local2._x + (((_local3 > 0) ? -1 : 1) * _local2._width);
}
};
board.initialAdjacent = function () {
var _local3 = (this.adjData = new Object());
_local3.head = new Array();
_local3.bottom = new Array();
var _local5;
var _local4;
_local5 = this.row;
_local4 = 1;
var _local2 = 0;
while (_local2 < this.col) {
_local3.head[_local2] = _local5;
_local3.bottom[_local2] = _local4;
_local5 = _local5 + this.row;
_local4 = _local4 + this.row;
_local2++;
}
};
board.getBlocks = function () {
var _local4 = new Array((this.row * this.col) + 1);
var _local2 = _local4.length - 1;
while (_local2 > 0) {
var _local3 = this["block" + _local2];
_local4[_local2] = _local3;
_local2--;
}
return(_local4);
};
board.getRollChanged = function (blocks, dir, line, step) {
var _local7;
var _local6;
var _local5;
switch (dir) {
case "R" :
_local7 = line;
_local6 = this.row;
_local5 = this.row;
break;
case "C" :
_local7 = ((line - 1) * this.row) + 1;
_local6 = 1;
_local5 = this.col;
step = -step;
}
var _local4 = new Array(_local5);
step = step % _local5;
var _local2 = 0;
while (_local2 < _local5) {
_local4[_local2] = blocks[_local7 + (_local6 * _local2)];
_local2++;
}
var _local10;
if (step > 0) {
_local10 = _local4.splice(-step);
_local4 = _local10.concat(_local4);
} else {
_local10 = _local4.splice(0, Math.abs(step));
_local4 = _local4.concat(_local10);
}
_local2 = 0;
while (_local2 < _local5) {
var _local3 = new Object();
_local3.no = _local7 + (_local6 * _local2);
_local3.value = _local4[_local2];
_local3.face = _local4[_local2]._currentframe;
_local3.link1 = _local4[_local2].link1 != undefined;
_local3.link2 = _local4[_local2].link2 != undefined;
_local4[_local2] = _local3;
_local2++;
}
return(_local4);
};
board.findSmallAdjacent = function (numba, blocks) {
return(this.findAdjacent(numba, blocks, MIN_BLOCK));
};
board.findAdjacent = function (numba, blocks, atleast) {
if (this.adjData == undefined) {
this.initialAdjacent();
}
var _local2 = (this.adjFinder = new Object());
_local2.allBlock = blocks;
_local2.result = [numba];
_local2.c = 0;
_local2.find = _local2.allBlock[numba].color;
atleast = Number(atleast);
if ((!isNaN(atleast)) && (atleast > 1)) {
_local2.atleast = atleast;
}
this.findAdjacent2(numba);
return(((_local2.result.length > 1) ? (_local2.result) : undefined));
};
board.findAdjacent2 = function (numba) {
var _local5 = 0;
var _local7 = 0;
var _local2 = 0;
while (_local2 < this.col) {
if (numba == this.adjData.head[_local2]) {
_local7 = 1;
break;
}
if (numba == this.adjData.bottom[_local2]) {
_local5 = 1;
break;
}
_local2++;
}
var _local6 = this.adjFinder.result;
var _local8 = this.adjFinder.allBlock;
var _local10 = this.adjFinder.find;
var _local3;
var _local9 = _local8.length - 1;
_local3 = numba + 1;
if (((((_local3 >= 1) && (_local3 <= _local9)) && (_local10 == _local8[_local3].color)) && (_local7 != 1)) && (this.isAdjacent(_local3))) {
_local6.push(_local3);
}
_local3 = numba + this.row;
if ((((_local3 >= 1) && (_local3 <= _local9)) && (_local10 == _local8[_local3].color)) && (this.isAdjacent(_local3))) {
_local6.push(_local3);
}
_local3 = numba - 1;
if (((((_local3 >= 1) && (_local3 <= _local9)) && (_local10 == _local8[_local3].color)) && (_local5 != 1)) && (this.isAdjacent(_local3))) {
_local6.push(_local3);
}
_local3 = numba - this.row;
if ((((_local3 >= 1) && (_local3 <= _local9)) && (_local10 == _local8[_local3].color)) && (this.isAdjacent(_local3))) {
_local6.push(_local3);
}
this.adjFinder.c++;
if (this.adjFinder.atleast && (_local6.length >= this.adjFinder.atleast)) {
return(undefined);
}
if (this.adjFinder.c == _local6.length) {
} else {
this.findAdjacent2(_local6[this.adjFinder.c]);
}
};
board.isAdjacent = function (numba) {
var _local4 = 1;
var _local3 = this.adjFinder.result;
var _local2 = 0;
while (_local2 < _local3.length) {
if (_local3[_local2] == numba) {
_local4 = 0;
break;
}
_local2++;
}
if (_local4 == 1) {
return(true);
}
return(false);
};
ctrl.initialGame(9, 9);
function disposeResult(list) {
if (_root.gamemode == "survival") {
game.timeOut = game.timeOut + ((list.length * 100) + 50);
} else {
game.point = game.point + list.length;
}
}
function noMoreMove() {
trace("noMoreMove");
_root.gamepause = true;
fx_no_move.play();
}
function afterNoMove() {
trace("afterNoMove");
if (_root.gamemode == "survival") {
levelTimeOut();
} else {
_root.gamepause = false;
board.randomBoard();
ctrl.resetGame();
fx_no_move.gotoAndPlay(1);
}
}
function levelTimeOut() {
trace("levelTimeOut");
fx_over.play();
_root.gamepause = true;
}
function passLevel() {
trace("passLevel");
_root.score = _root.score + _root.timebonus;
_root.sp = 100;
fx_lvclear.play();
_root.gamepause = true;
}
function nextLevel() {
trace("nextLevel");
_root.level++;
if (_root.level >= 9) {
_root.level = 9;
_root.so.data.enablesurvival = true;
}
resetLevel(_root.level);
}
function setLevel(lv) {
var _local3;
if (lv < 5) {
_local3 = 5;
}
if (lv >= 5) {
_local3 = 6;
}
if (_root.gamemode == "survival") {
_local3 = 7;
}
var _local4;
if (lv < 3) {
_local4 = 3;
}
if ((lv >= 3) and (lv <= 6)) {
_local4 = 6;
}
if (lv > 6) {
_local4 = 9;
}
game.playColor = _local3;
game.maxObstruct = _local4;
game.pointTarget = 102 + (_root.level * 8);
game.linkTime = 15;
game.linkPercent = 9 + (lv * 9);
}
function resetLevel(lv) {
_root.level = lv;
game.timeOut = getTimer() + RUNOUT;
game.point = 0;
game.linkCreate = false;
gauge.gotoAndStop(1);
setLevel(lv);
bomb.gotoAndStop(1);
board.randomBoard();
ctrl.resetGame();
}
stop();
_root.gamepause = false;
_root.systpause = false;
_root.pa_syst._visible = false;
_root.level = 1;
_root.sp = 100;
_root.spMAX = 100;
_root.timebonus = 2160;
_root.score = 0;
removeClip();
_root.fx_over_origin.duplicateMovieClip("fx_over", _root.getNextHighestDepth());
_root.fx_over_origin._visible = false;
_root.fx_lvclear_origin.duplicateMovieClip("fx_lvclear", _root.getNextHighestDepth());
_root.fx_lvclear_origin._visible = false;
_root.sfx_hint = new Sound();
_root.sfx_hint.attachSound("sfx_hint.wav");
_root.onEnterFrame = function () {
pauseChecker();
if (_root.gamemode == "story") {
_root.sholevel = "Level " + _root.level;
_root.hint._alpha = 10 + _root.sp;
_root.b_survmenu._visible = false;
} else if (_root.gamemode == "survival") {
_root.sholevel = "Survival Mode";
_root.hint._visible = false;
_root.b_survmenu._visible = true;
}
if ((_root.gamepause == false) and (_root.systpause == false)) {
if (game.pauseAt != undefined) {
game.timeOut = game.timeOut + (getTimer() - game.pauseAt);
delete game.pauseAt;
}
_root.timebonus--;
if (_root.gamemode == "survival") {
if ((_root.score >= 500) && (game.playColor != 8)) {
game.playColor = 8;
} else if ((_root.score >= 1000) && (game.playColor != 9)) {
game.playColor = 9;
}
} else {
if (game.point > 10) {
game.point = game.point - 0.02;
}
_root.gauge.gotoAndStop(Math.floor((game.point * gauge._totalframes) / game.pointTarget));
if (game.point >= game.pointTarget) {
passLevel();
}
}
if (!ctrl.movable) {
trace("--------no move-----------");
ctrl.movable = true;
noMoreMove();
}
var _local2 = game.timeOut - getTimer();
if (_root.gamemode == "story") {
bomb.gotoAndStop(Math.floor(bomb._totalframes - ((_local2 * bomb._totalframes) / RUNOUT)));
if (_local2 <= 0) {
levelTimeOut();
}
}
var _local3 = Math.floor((RUNOUT - _local2) / 1000) % game.linkTime;
if (!game.linkCreate) {
if (_local3 == (game.linkTime - 1)) {
game.linkCreate = true;
if (Math.floor(Math.random() * 100) < game.linkPercent) {
trace("link create");
ctrl.randomLink();
}
}
} else if (_local3 == 0) {
game.linkCreate = false;
}
} else if (game.pauseAt == undefined) {
game.pauseAt = getTimer();
}
};
var RUNOUT = 90000;
if (_root.gamemode == "survival") {
resetLevel(_root.survivalstartLV);
} else {
resetLevel(_root.storystartLV);
}
_root.fx_mute._visible = false;
_root.fx_pause._visible = false;
_root.b_mute.b.onRelease = function () {
if (_root.systpause == false) {
_root.fx_mute._visible = !_root.fx_mute._visible;
}
_root.b_mute.play();
var _local2 = new Sound(_root);
if (_root.fx_mute._visible) {
_root.volume = _local2.getVolume();
_local2.setVolume(0);
} else {
_local2.setVolume(_root.volume);
delete _root.volume;
}
};
_root.b_pause.b.onRelease = function () {
if (((_root.systpause == false) and (_root.pa_syst._visible != true)) and (_root.pa_help._visible != true)) {
_root.gamepause = !_root.gamepause;
_root.fx_pause._visible = !_root.fx_pause._visible;
}
};
_root.b_MFZ.onRelease = function () {
getURL ("http://www.mofunzone.com/", "_blank");
};
_root.b_survmenu.onRelease = function () {
stopAllSounds();
_root.gotoAndStop("Title", "title");
};
Symbol 80 MovieClip [fx_explode] Frame 13
this.removeMovieClip();
Symbol 90 MovieClip Frame 1
stop();
Symbol 92 Button
on (release) {
getURL ("http://www.mofunzone.com/", "_blank");
}
Symbol 135 Button
on (release) {
gotoAndStop (1);
}
Symbol 136 MovieClip Frame 1
stop();
Symbol 136 MovieClip Frame 2
stop();
Symbol 144 Button
on (release) {
getURL ("http://www.mofunzone.com/", "_blank");
}
Symbol 148 MovieClip Frame 101
stop();
Symbol 165 MovieClip Frame 20
gotoAndPlay (1);
Symbol 167 MovieClip Frame 20
gotoAndPlay (1);
Symbol 173 MovieClip Frame 1
stop();
Symbol 173 MovieClip Frame 2
stop();
Symbol 177 MovieClip Frame 1
_root.bgm.setVolume(100);
stop();
Symbol 177 MovieClip Frame 2
_root.bgm.setVolume(0);
stop();
Symbol 182 MovieClip Frame 1
stop();
Symbol 192 MovieClip Frame 1
stop();
Symbol 192 MovieClip Frame 50
_root.afterNoMove();
stop();
Symbol 196 MovieClip Frame 10
stop();
Symbol 200 MovieClip Frame 10
stop();
Symbol 204 MovieClip Frame 10
stop();
Symbol 205 MovieClip Frame 1
stop();
Symbol 218 Button
on (release) {
stopAllSounds();
_root.gotoAndStop("Title", "title");
}
Symbol 221 Button
on (release) {
getURL ("http://www.mofunzone.com/online_games/aquacubes.shtml", "_blank");
}
Symbol 222 MovieClip Frame 1
stop();
Symbol 222 MovieClip Frame 5
if (_root.gamemode == "story") {
fx_outoftime._visible = true;
} else {
fx_outoftime._visible = false;
}
Symbol 222 MovieClip Frame 65
gotoAndPlay ("PB");
Symbol 222 MovieClip Frame 85
Selection.setFocus("newname");
stop();
Symbol 222 MovieClip Frame 115
stop();
Symbol 233 Button
on (release) {
getURL ("http://www.mofunzone.com/online_games/aquacubes.shtml ", "_blank");
}
Symbol 234 Button
on (release) {
stopAllSounds();
_root.gotoAndStop("Title", "title");
}
Symbol 238 MovieClip Frame 1
stop();
Symbol 238 MovieClip Frame 17
if ((_root.level >= 9) and (_root.endingplayed != true)) {
_root.ending = true;
}
_root.nextLevel();
Symbol 238 MovieClip Frame 86
if (_root.ending != true) {
_root.gamepause = false;
gotoAndStop (1);
} else if (_root.ending == true) {
gotoAndStop ("ending");
_root.ending = false;
}
_root.timebonus = 2160;
trace("end pass level");
Symbol 238 MovieClip Frame 95
Selection.setFocus("newname");
stop();