Frame 1
function Loading() {
var _local2 = 0 + (Number(seconds) * 1000);
clearInterval(SSS);
Load = _root.getBytesLoaded();
Total = _root.getBytesTotal();
var _local3 = getTimer() - GlobalTime;
if (Load >= ((Total * _local3) / _local2)) {
Load = (Total * _local3) / _local2;
}
KB.text = ("Loading... (" + Math.round((100 * Load) / Total)) + "%)";
if (Total <= Load) {
loadline._x = 380;
chel._x = 300;
gotoAndStop (3);
} else {
loadline._x = Math.round(180 + ((200 * Load) / Total));
chel._x = Math.round(100 + ((200 * Load) / Total));
chel.gotoAndStop(Math.round(((100 * Load) / Total) % 50));
SSS = setInterval(Loading, 50);
}
updateAfterEvent();
}
function initoptXML() {
var _local9 = this.firstChild;
var _local8 = _local9.firstChild;
seconds = _local8.firstChild.firstChild.toString();
nagtime = Number(_local8.firstChild.nextSibling.firstChild.toString());
linklogo1 = _local8.firstChild.nextSibling.nextSibling.firstChild.toString();
linklogo2 = _local8.lastChild.firstChild.toString();
var _local10 = _local8.nextSibling;
var _local7 = _local10.childNodes;
j = 1;
while (j < 8) {
er = _local7[j - 1].firstChild.toString();
_root["menubutton" + j] = er;
j++;
}
var _local11 = _local10.nextSibling;
var _local6 = _local11.childNodes;
j = 0;
while (j < _local6.length) {
er = _local6[j].firstChild.toString();
_root["hint" + j] = er;
j++;
}
var _local4 = 3;
var _local3 = _local9.childNodes;
downloadlink = _local3[_local4++].firstChild.toString();
textscores = _local3[_local4++].firstChild.toString();
textbricks = _local3[_local4++].firstChild.toString();
textmatches = _local3[_local4++].firstChild.toString();
texttime = _local3[_local4++].firstChild.toString();
textlscore = _local3[_local4++].firstChild.toString();
texttscore = _local3[_local4++].firstChild.toString();
textseconds = _local3[_local4++].firstChild.toString();
textdownload = _local3[_local4++].firstChild.toString();
textrestart = _local3[_local4++].firstChild.toString();
textcontinue = _local3[_local4++].firstChild.toString();
textplay = _local3[_local4++].firstChild.toString();
textundo = _local3[_local4++].firstChild.toString();
textmenu = _local3[_local4++].firstChild.toString();
nagmore = _local3[_local4++].firstChild.toString();
nagtextnext = _local3[_local4++].firstChild.toString();
nagtextover = _local3[_local4++].firstChild.toString();
nagtextend = _local3[_local4++].firstChild.toString();
loadMovie (ststst + linklogo1, l1);
loadMovie (ststst + linklogo2, l2);
var _local12 = _local9.lastChild;
var _local5 = _local12.childNodes;
j = 0;
while (j < _local5.length) {
er = _local5[j].firstChild.toString();
_root["helping" + j] = er;
j++;
}
}
function initcountXML() {
var _local5 = this.firstChild;
if (_local5 != undefined) {
map = new Array();
var _local4 = _local5.childNodes;
j = 0;
while (j < _local4.length) {
var _local2 = new Array();
_local2.chips = _local4[j].attributes.chips;
var _local3 = _local4[j].childNodes;
k = 0;
while (k < _local3.length) {
aline = _local3[k].firstChild.toString().split("");
_local2[k] = aline;
k++;
}
map[j] = _local2;
j++;
}
GlobalTime = getTimer();
Loading();
} else {
KB.text = "Unable to init game";
}
}
function LoadMapXML() {
MAP = new Array();
var _local7 = this.firstChild;
var _local5 = _local7.firstChild.childNodes;
var _local6 = new Array();
var _local2 = 0;
while (_local2 < _local5.length) {
var _local4 = new Array();
_local4.x = _local5[_local2].attributes.x;
_local4.y = _local5[_local2].attributes.y;
_local4.name = _local5[_local2].attributes.name;
_local4.size = 2;
_local6[_local2] = _local4;
_local2++;
}
_local5 = _local7.lastChild.childNodes;
var _local3 = 0;
while (_local3 < _local5.length) {
var _local4 = new Array();
_local4.x = _local5[_local3].attributes.x;
_local4.y = _local5[_local3].attributes.y;
_local4.size = 1;
_local6[_local3 + _local2] = _local4;
_local3++;
}
MAP = _local6;
}
function LoadXML() {
var _local1 = new XML();
_local1.load(mmap);
_local1.ignoreWhite = true;
_local1.onLoad = LoadMapXML;
var _local3 = new XML();
_local3.ignoreWhite = true;
_local3.load(opt);
_local3.onLoad = initoptXML;
var _local2 = new XML();
_local2.ignoreWhite = true;
_local2.load(cntr);
_local2.onLoad = initcountXML;
}
stop();
chel.gotoAndStop(1);
Stage.showMenu = false;
fscommand ("trapallkeys", true);
if (_global.PATH == undefined) {
ststst = "";
} else {
ststst = _global.PATH + "/";
}
cntr = ststst + "level.xml";
opt = ststst + "option.xml";
mmap = ststst + "map.xml";
mart = ststst + "artefact.xml";
LoadXML();
this._lockroot = true;
oKey = {};
oKey.onKeyDown = function () {
if (Key.isDown(9)) {
} else if (Key.isDown(13)) {
} else if (Key.isDown(17)) {
}
};
Key.addListener(oKey);
Frame 2
stop();
this._lockroot = true;
_root.gotoAndPlay(1);
Frame 3
function TextShow(Inside, Str, l, W, H, C, S) {
function Attach(STR) {
if (S == undefined) {
S = 100;
}
Inside.TEXT.attachMovie(STR + l, U, Inside.TEXT.getNextHighestDepth(), {_x:X, _y:Y, _xscale:S, _yscale:S});
if (eval ((String(Inside) + ".TEXT.") + U)._width != undefined) {
wid = eval ((String(Inside) + ".TEXT.") + U)._width;
X = X + (wid + W);
Len++;
}
}
Letter = 0;
var Len = 0;
var X = 0;
var Y = 0;
var L = 0;
var wid = 0;
Inside.TEXT.removeMovieClip();
Inside.createEmptyMovieClip("TEXT", Inside.getNextHighestDepth());
var i = 0;
while (i < Str.length) {
var j = Str.substr(i, 1).toLowerCase();
if (j == "|") {
if (Len > Letter) {
Letter = Len;
}
Len = 0;
if (C == 1) {
X = X / 2;
var k = 0;
while (k < Str.length) {
eval (((String(Inside) + ".TEXT.t") + k) + L)._x = eval (((String(Inside) + ".TEXT.t") + k) + L)._x - X;
k++;
}
} else if (C == 2) {
var k = 0;
while (k < Str.length) {
eval (((String(Inside) + ".TEXT.t") + k) + L)._x = eval (((String(Inside) + ".TEXT.t") + k) + L)._x - X;
k++;
}
}
L++;
X = 0;
Y = Y + H;
} else {
var U = (("t" + i) + L);
if (j == " ") {
if (eval (String(Inside) + ".TEXT.t00")._width > 0) {
X = X + ((eval (String(Inside) + ".TEXT.t00")._width * 3) / 4);
Len++;
}
} else if (j == ",") {
Attach("zpt");
} else if (j == ".") {
Attach("dot");
} else if (j == ":") {
Attach("dd");
} else if (j == "!") {
Attach("voskl");
} else if (j == "-") {
Attach("tire");
} else {
Attach(String(j));
}
}
i++;
}
if (C == 1) {
X = X / 2;
var k = 0;
while (k < Str.length) {
eval (((String(Inside) + ".TEXT.t") + k) + L)._x = eval (((String(Inside) + ".TEXT.t") + k) + L)._x - X;
k++;
}
} else if (C == 2) {
var k = 0;
while (k < Str.length) {
eval (((String(Inside) + ".TEXT.t") + k) + L)._x = eval (((String(Inside) + ".TEXT.t") + k) + L)._x - X;
k++;
}
}
if (Len > Letter) {
Letter = Len;
}
return(L);
}
function ScoreAdd(chk) {
var _local1 = 5;
if (chk == "y") {
_local1 = 20;
}
if (Add > 0) {
score = score + _local1;
Add = Add - _local1;
TextShow(SCORE, String(score), "a", 0, 0, 1);
if (score >= NextLife) {
Life++;
if (SoundOn) {
life_s.start();
}
NextLife = NextLife + 35000;
}
} else {
clearInterval(scoring);
redytoend = true;
}
}
function Score(ADD, chk) {
Add = Add + ADD;
var _local1 = 0;
if (Add < 30) {
_local1 = 200;
} else if (Add < 100) {
_local1 = 20;
} else if (Add > 300) {
chk = "y";
}
clearInterval(scoring);
scoring = setInterval(ScoreAdd, _local1, chk);
}
function ConvertText(hint) {
var _local4 = "";
var _local2 = 0;
var _local1 = 0;
while (_local1 < hint.length) {
var _local3 = hint.substr(_local1, 1);
if (_local3 == "|") {
if (_local2 > Letter) {
Letter = _local2;
}
_local2 = 0;
_local4 = _local4 + newline;
Lines++;
} else {
_local4 = _local4 + _local3;
_local2++;
}
_local1++;
}
if (_local2 > Letter) {
Letter = _local2;
}
return(_local4);
}
function ClearRound() {
ClearHint();
moving = false;
lscore = score;
bricks = (matches = 0);
black.removeMovieClip();
nag.removeMovieClip();
menu.removeMovieClip();
help.removeMovieClip();
stats.removeMovieClip();
pir.removeMovieClip();
SCORE.removeMovieClip();
buttonMENU.removeMovieClip();
buttonUNDO.removeMovieClip();
left.removeMovieClip();
pole.removeMovieClip();
panel.removeMovieClip();
fon.removeMovieClip();
gamemask.removeMovieClip();
game.removeMovieClip();
gamef.removeMovieClip();
fly.removeMovieClip();
}
function SetUNDO(SSS) {
if (SSS != "HINT") {
SSS = "UNDO";
} else {
SSS = "HINT";
}
var _local2 = UNDO - 1;
while (_local2 > 0) {
if (_root[(SSS + "") + (_local2 - 1)] != undefined) {
Copy(_local2, _local2 - 1, SSS);
}
_local2--;
}
_root[SSS + 0] = new Array();
Create(0, SSS);
}
function GetUNDO(SSS) {
if (SSS != "HINT") {
SSS = "UNDO";
} else {
SSS = "HINT";
}
if (_root[SSS + "0"] != undefined) {
game.removeMovieClip();
gamef.removeMovieClip();
fly.removeMovieClip();
if (SSS == "UNDO") {
Matrix = new Array();
Matrix = _root[SSS + "0"];
score = _root[SSS + "score0"];
bricks = _root[SSS + "bricks0"];
matches = _root[SSS + "matches0"];
InitRound(C, R, 1);
}
var _local2 = 1;
while (_local2 < UNDO) {
if (_root[(SSS + "") + _local2] != undefined) {
Copy(_local2 - 1, _local2, SSS);
} else {
break;
}
_local2++;
}
delete _root[(SSS + "") + (_local2 - 1)];
}
}
function Copy(i1, j1, SSS) {
if (SSS.substr(0, 4) != "HINT") {
SSS = "UNDO";
}
_root[(SSS + "score") + i1] = _root[(SSS + "score") + j1];
_root[(SSS + "bricks") + i1] = _root[(SSS + "bricks") + j1];
_root[(SSS + "matches") + i1] = _root[(SSS + "matches") + j1];
delete _root[(SSS + "") + i1];
delete _root[(SSS + "u") + i1];
delete _root[(SSS + "d") + i1];
delete _root[(SSS + "l") + i1];
delete _root[(SSS + "r") + i1];
_root[(SSS + "") + i1] = new Array();
_root[(SSS + "u") + i1] = new Array();
_root[(SSS + "d") + i1] = new Array();
_root[(SSS + "l") + i1] = new Array();
_root[(SSS + "r") + i1] = new Array();
var _local4 = 0;
while (_local4 < Ny) {
var _local8 = new Array();
var _local2 = 0;
while (_local2 < Nx) {
_local8[_local2] = _root[(SSS + "") + j1][_local4][_local2];
_local2++;
}
_root[(SSS + "") + i1][_local4] = _local8;
_local4++;
}
_local4 = 0;
while (_local4 < 3) {
var _local9 = new Array();
var _local10 = new Array();
var _local8 = new Array();
var _local7 = new Array();
var _local2 = 0;
while (_local2 < Nx) {
_local9[_local2] = _root[(SSS + "u") + j1][_local4][_local2];
_local10[_local2] = _root[(SSS + "d") + j1][_local4][_local2];
_local8[_local2] = _root[(SSS + "l") + j1][_local4][_local2];
_local7[_local2] = _root[(SSS + "r") + j1][_local4][_local2];
_local2++;
}
_root[(SSS + "u") + i1][_local4] = _local9;
_root[(SSS + "d") + i1][_local4] = _local10;
_root[(SSS + "l") + i1][_local4] = _local8;
_root[(SSS + "r") + i1][_local4] = _local7;
_local4++;
}
}
function Create(i, SSS) {
if (SSS.substr(0, 4) != "HINT") {
SSS = "UNDO";
}
_root[(SSS + "score") + i] = score;
_root[(SSS + "bricks") + i] = bricks;
_root[(SSS + "matches") + i] = matches;
delete _root[(SSS + "") + i];
delete _root[(SSS + "u") + i];
delete _root[(SSS + "d") + i];
delete _root[(SSS + "l") + i];
delete _root[(SSS + "r") + i];
_root[(SSS + "") + i] = new Array();
_root[(SSS + "u") + i] = new Array();
_root[(SSS + "d") + i] = new Array();
_root[(SSS + "l") + i] = new Array();
_root[(SSS + "r") + i] = new Array();
var _local3 = 0;
while (_local3 < Ny) {
var _local7 = new Array();
var _local2 = 0;
while (_local2 < Nx) {
_local7[_local2] = Matrix[_local3][_local2];
if (Matrix[_local3][_local2].substr(4, 1) == "n") {
_local7[_local2] = _local7[_local2] + game[(("b" + _local3) + _local2) + "n"].direction;
}
_local2++;
}
_root[(SSS + "") + i][_local3] = _local7;
_local3++;
}
_local3 = 0;
while (_local3 < 3) {
var _local8 = new Array();
var _local9 = new Array();
var _local7 = new Array();
var _local6 = new Array();
var _local2 = 0;
while (_local2 < Nx) {
_local8[_local2] = game[(("b" + _local3) + _local2) + "up"].name;
_local9[_local2] = game[(("b" + _local3) + _local2) + "down"].name;
_local7[_local2] = game[(("b" + _local2) + _local3) + "left"].name;
_local6[_local2] = game[(("b" + _local2) + _local3) + "right"].name;
_local2++;
}
_root[(SSS + "u") + i][_local3] = _local8;
_root[(SSS + "d") + i][_local3] = _local9;
_root[(SSS + "l") + i][_local3] = _local7;
_root[(SSS + "r") + i][_local3] = _local6;
_local3++;
}
}
function InitUNDO(SSS) {
if (SSS != "HINT") {
SSS = "UNDO";
} else {
SSS = "HINT";
}
var _local2 = 0;
while (_local2 < UNDO) {
delete _root[(SSS + "") + _local2];
_local2++;
}
}
function ClearHint() {
Hint = new Array(0, 0, 0);
clearInterval(hinting);
clearInterval(fly1);
clearInterval(hint3);
clearInterval(hhh);
fon.hint.removeMovieClip();
EndCalc = true;
}
function FindHint() {
clearInterval(hinting);
if (!moving) {
if (Hint[0] == 0) {
Recursion = 2;
} else if (Hint[0] == -1) {
Hint[0] = 0;
}
if (Hint[0] == 0) {
Hint = new Array(0, 0, 0);
EndCalc = false;
ShowHint();
}
var _local1 = ((R <= 1) ? 1500 : 3000);
var bbb = 5;
clearInterval(hint3);
hint3 = setInterval(function () {
clearInterval(hint3);
if (Hint[0] == 0) {
Recursion++;
if (Recursion == bbb) {
Hint[0] = 0;
trace("QUIT!!!");
} else {
Hint[0] = -1;
FindHint();
}
} else {
GetHint(Hint[0]);
}
}, _local1 * (Recursion - 1));
} else {
Hint[0] = 0;
clearInterval(hinting);
hinting = setInterval(FindHint, 2000);
}
}
function ShowHint() {
var done = "";
var i = 0;
var j = 0;
clearInterval(hhh);
hhh = setInterval(function () {
if ((i == 10) && (j == Nx)) {
clearInterval(hhh);
} else if (j == Nx) {
j = 0;
i++;
} else {
if (Matrix[i][j] != 0) {
var _local1 = ("" + i) + j;
Create(_local1 + "0", "HINT");
HintFor(i, j, 0, 0, _local1, 0, 0, 0, 0);
if (EndCalc) {
clearInterval(hhh);
if (Hint[0] == 0) {
return(done);
}
return(Hint[0]);
}
}
j++;
}
}, ((R <= 1) ? 10 : (10 * Recursion)));
}
function HintFor(i1, j1, d, L, st) {
var arg = arguments;
var d = (d + 1);
if (((d < Recursion) && (!moving)) && (!EndCalc)) {
clearInterval(_root[(("h" + d) + L) + st]);
_root[(("h" + d) + L) + st] = setInterval(function () {
clearInterval(_root[(("h" + d) + L) + st]);
var _local4 = j1 - 2;
while (_local4 < 0) {
_local4++;
}
while (_local4 < Math.min(Nx, j1 + 3)) {
if ((!ClearCol(_local4, st + L)) && (_root[("HINT" + st) + L][0][_local4] == 0)) {
var _local2 = FindWay(0, _local4, "up", st + L);
if (Math.abs(_local2 - i1) < 3) {
var _local3 = (4 * L) + 1;
Copy(st + _local3, st + L, "HINT");
var _local7 = _root[("HINTu" + st) + _local3][0][_local4];
_root[("HINTu" + st) + _local3][0][_local4] = _root[("HINTu" + st) + _local3][1][_local4];
_root[("HINTu" + st) + _local3][1][_local4] = _root[("HINTu" + st) + _local3][2][_local4];
_root[("HINTu" + st) + _local3][2][_local4] = 0;
_root[("HINT" + st) + _local3][_local2][_local4] = _local7;
var _local5 = ("b0" + _local4) + "up";
var _local6 = FindChain(_root[("HINT" + st) + _local3], "no");
if (_local6) {
EndCalc = true;
Hint[d - 1] = _local5;
Hint[d - 2] = arg[5];
Hint[d - 3] = arg[6];
Hint[d - 4] = arg[7];
} else {
HintFor(i1, j1, d, _local3, st, _local5, arg[5], arg[6], arg[7]);
}
}
}
_local4++;
}
var _local2 = i1 - 2;
while (_local2 < 0) {
_local2++;
}
while (_local2 < Math.min(Ny, i1 + 3)) {
if ((!ClearLine(_local2, st + L)) && (_root[("HINT" + st) + L][_local2][0] == 0)) {
_local4 = FindWay(_local2, 0, "left", st + L);
if (Math.abs(_local4 - j1) < 3) {
var _local3 = (4 * L) + 3;
Copy(st + _local3, st + L, "HINT");
var _local7 = _root[("HINTl" + st) + _local3][0][_local2];
_root[("HINTl" + st) + _local3][0][_local2] = _root[("HINTl" + st) + _local3][1][_local2];
_root[("HINTl" + st) + _local3][1][_local2] = _root[("HINTl" + st) + _local3][2][_local2];
_root[("HINTl" + st) + _local3][2][_local2] = 0;
_root[("HINT" + st) + _local3][_local2][_local4] = _local7;
var _local6 = FindChain(_root[("HINT" + st) + _local3], "no");
var _local5 = ("b" + _local2) + "0left";
if (_local6) {
EndCalc = true;
Hint[d - 1] = _local5;
Hint[d - 2] = arg[5];
Hint[d - 3] = arg[6];
Hint[d - 4] = arg[7];
} else {
HintFor(i1, j1, d, _local3, st, _local5, arg[5], arg[6], arg[7]);
}
}
}
_local2++;
}
_local4 = j1 - 2;
while (_local4 < 0) {
_local4++;
}
while (_local4 < Math.min(Nx, j1 + 3)) {
if ((!ClearCol(_local4, st + L)) && (_root[("HINT" + st) + L][9][_local4] == 0)) {
_local2 = FindWay(9, _local4, "down", st + L);
if (Math.abs(_local2 - i1) < 3) {
var _local3 = (4 * L) + 2;
Copy(st + _local3, st + L, "HINT");
var _local7 = _root[("HINTd" + st) + _local3][0][_local4];
_root[("HINTd" + st) + _local3][0][_local4] = _root[("HINTd" + st) + _local3][1][_local4];
_root[("HINTd" + st) + _local3][1][_local4] = _root[("HINTd" + st) + _local3][2][_local4];
_root[("HINTd" + st) + _local3][2][_local4] = 0;
_root[("HINT" + st) + _local3][_local2][_local4] = _local7;
var _local6 = FindChain(_root[("HINT" + st) + _local3], "no");
var _local5 = ("b0" + _local4) + "down";
if (_local6) {
EndCalc = true;
Hint[d - 1] = _local5;
Hint[d - 2] = arg[5];
Hint[d - 3] = arg[6];
Hint[d - 4] = arg[7];
} else {
HintFor(i1, j1, d, _local3, st, _local5, arg[5], arg[6], arg[7]);
}
}
}
_local4++;
}
_local2 = i1 - 2;
while (_local2 < 0) {
_local2++;
}
while (_local2 < Math.min(Ny, i1 + 3)) {
if ((!ClearLine(_local2, st + L)) && (_root[("HINT" + st) + L][_local2][9] == 0)) {
_local4 = FindWay(_local2, 9, "right", st + L);
if (Math.abs(_local4 - j1) < 3) {
var _local3 = (4 * L) + 4;
Copy(st + _local3, st + L, "HINT");
var _local7 = _root[("HINTr" + st) + _local3][0][_local2];
_root[("HINTr" + st) + _local3][0][_local2] = _root[("HINTr" + st) + _local3][1][_local2];
_root[("HINTr" + st) + _local3][1][_local2] = _root[("HINTr" + st) + _local3][2][_local2];
_root[("HINTr" + st) + _local3][2][_local2] = 0;
_root[("HINT" + st) + _local3][_local2][_local4] = _local7;
var _local6 = FindChain(_root[("HINT" + st) + _local3], "no");
var _local5 = ("b" + _local2) + "0right";
if (_local6) {
EndCalc = true;
Hint[d - 1] = _local5;
Hint[d - 2] = arg[5];
Hint[d - 3] = arg[6];
Hint[d - 4] = arg[7];
} else {
HintFor(i1, j1, d, _local3, st, _local5, arg[5], arg[6], arg[7]);
}
}
}
_local2++;
}
}, ((R <= 1) ? 0 : (100 * Math.random())));
}
if (moving) {
EndCalc = true;
}
}
function InitMatrix(C, R, chk) {
if (chk == undefined) {
ttt.text = "Level " + R;
delete Matrix;
Matrix = new Array();
var _local3 = map[R];
var _local2 = 0;
while (_local2 < _local3.length) {
var _local4 = new Array();
var _local1 = 0;
while (_local1 < _local3[0].length) {
if (_local3[_local2][_local1] != 0) {
_local4[_local1] = "cub" + _local3[_local2][_local1];
} else {
_local4[_local1] = 0;
}
_local1++;
}
Matrix[_local2] = _local4;
_local2++;
}
}
}
function InitButton(button, Text, Funct, X, Y) {
var i = 0;
var j = -1;
button.gotoAndStop(1);
button._parent[button._name + "text"].removeMovieClip();
button._parent.createEmptyMovieClip(button._name + "text", button._parent.getNextHighestDepth());
button._parent[button._name + "text"]._x = (button._x + (button._width / 2)) + X;
button._parent[button._name + "text"]._y = button._y + Y;
TextShow(button._parent[button._name + "text"], Text, "n", 0, 0, 1);
button.onRollOver = function () {
TextShow(this._parent[button._name + "text"], Text, "a", 0, 0, 1);
};
button.onRollOut = function () {
TextShow(this._parent[button._name + "text"], Text, "n", 0, 0, 1);
};
button.onPress = function () {
if (SoundOn) {
button_s.start();
}
button.gotoAndStop(2);
TextShow(this._parent[button._name + "text"], Text, "a", 0, 0, 1);
this._parent[button._name + "text"]._x = this._parent[button._name + "text"]._x + i;
this._parent[button._name + "text"]._y = this._parent[button._name + "text"]._y + j;
this._parent[button._name + "text"]._alpha = 70;
};
button.onReleaseOutside = function () {
button.gotoAndStop(1);
TextShow(this._parent[button._name + "text"], Text, "n", 0, 0, 1);
this._parent[button._name + "text"]._x = this._parent[button._name + "text"]._x - i;
this._parent[button._name + "text"]._y = this._parent[button._name + "text"]._y - j;
this._parent[button._name + "text"]._alpha = 100;
};
button.onRelease = function () {
button.gotoAndStop(1);
TextShow(this._parent[button._name + "text"], Text, "n", 0, 0, 1);
this._parent[button._name + "text"]._x = this._parent[button._name + "text"]._x - i;
this._parent[button._name + "text"]._y = this._parent[button._name + "text"]._y - j;
this._parent[button._name + "text"]._alpha = 100;
_root[Funct]();
};
}
function InitRound(C, R, chk) {
if (chk == undefined) {
if (SoundOn) {
levelstart_s.start();
}
Nomer = Number(map[R].chips) - 1;
RoundTime = getTimer();
ClearRound();
buttonUNDO.removeMovieClip();
buttonMENU.removeMovieClip();
left.removeMovieClip();
pole.removeMovieClip();
panel.removeMovieClip();
fon.removeMovieClip();
pir.removeMovieClip();
gamemask.removeMovieClip();
_root.attachMovie("leftpanel", "panel", _root.getNextHighestDepth());
_root.attachMovie("pir" + Number(C + 1), "pir", _root.getNextHighestDepth(), {_x:14, _y:40});
_root.attachMovie("pole" + C, "pole", _root.getNextHighestDepth(), {_x:100});
_root.attachMovie("gamemask", "gamemask", _root.getNextHighestDepth(), {_x:GlobalX - (3 * Size), _y:GlobalY - (3 * Size)});
_root.createEmptyMovieClip("fon", _root.getNextHighestDepth());
_root.attachMovie("button", "buttonUNDO", _root.getNextHighestDepth(), {_x:13, _y:270, _width:80, _height:21});
_root.attachMovie("button", "buttonMENU", _root.getNextHighestDepth(), {_y:10, _x:260, _width:130, _height:25});
InitButton(buttonUNDO, textundo, "GetUNDO", 2, 3);
InitButton(buttonMENU, textmenu, "ShowMENU", 2, 5);
InitFon(GlobalX + ddx, GlobalY + ddx, chk);
InitUNDO();
}
game.removeMovieClip();
gamef.removeMovieClip();
fly.removeMovieClip();
SCORE.removeMovieClip();
_root.createEmptyMovieClip("gamef", _root.getNextHighestDepth());
gamef.setMask(gamemask);
_root.createEmptyMovieClip("game", _root.getNextHighestDepth());
_root.createEmptyMovieClip("fly", _root.getNextHighestDepth());
_root.createEmptyMovieClip("SCORE", _root.getNextHighestDepth());
SCORE._x = 55;
SCORE._y = 315;
TextShow(SCORE, String(score), "a", 0, 0, 1);
InitMatrix(C, R, chk);
InitGame(GlobalX, GlobalY, chk);
FindHint();
}
function FindDepth(i, j, w) {
var _local1 = 10;
if (w == "up") {
return((((2 - i) * Nx) + Number(j)) + Number(_local1));
}
_local1 = _local1 + (4 * Nx);
if (w == "left") {
return((Number(i) + ((2 - j) * Ny)) + Number(_local1));
}
_local1 = _local1 + (4 * Ny);
if ((w == "g") || (w == "n")) {
return(((i * Nx) + Number(j)) + Number(_local1));
}
_local1 = _local1 + (Nx * Ny);
if (w == "right") {
return((Number(i) + (j * Ny)) + Number(_local1));
}
_local1 = _local1 + (4 * Ny);
if (w == "down") {
return(((i * Nx) + Number(j)) + Number(_local1));
}
}
function InitGame(x, y, chk) {
var _local2 = 0;
while (_local2 < Nx) {
var _local1 = 0;
while (_local1 < Ny) {
if (Matrix[_local2][_local1] != 0) {
if ((chk != undefined) && (Matrix[_local2][_local1].substr(4, 1) == "n")) {
game.attachMovie(Matrix[_local2][_local1].substr(0, 4), (("b" + _local2) + _local1) + "n", FindDepth(_local2, _local1, "g"), {_x:x + (Size * _local1), _y:y + (Size * _local2)});
gamef.attachMovie(Matrix[_local2][_local1].substr(0, 4) + "f", (("b" + _local2) + _local1) + "n", FindDepth(_local2, _local1, "g"), {_x:x + (Size * _local1), _y:y + (Size * _local2)});
game[(("b" + _local2) + _local1) + "n"].name = Matrix[_local2][_local1].substr(0, 4);
game[(("b" + _local2) + _local1) + "n"].direction = Matrix[_local2][_local1].substr(5, 10);
var _local5 = GetRotation(Matrix[_local2][_local1].substr(5, 10));
game[(("b" + _local2) + _local1) + "n"].attachMovie("strela" + Matrix[_local2][_local1].substr(3, 1), "s", 0, {_rotation:_local5, _x:Size / 2, _y:Size / 2});
Matrix[_local2][_local1] = Matrix[_local2][_local1].substr(0, 5);
} else {
game.attachMovie(Matrix[_local2][_local1], ("b" + _local2) + _local1, FindDepth(_local2, _local1, "g"), {_x:x + (Size * _local1), _y:y + (Size * _local2)});
gamef.attachMovie(Matrix[_local2][_local1] + "f", ("b" + _local2) + _local1, FindDepth(_local2, _local1, "g"), {_x:x + (Size * _local1), _y:y + (Size * _local2)});
}
}
_local1++;
}
_local2++;
}
InitBorder(x, y, "up", chk);
InitBorder(x, y, "down", chk);
InitBorder(x, y, "left", chk);
InitBorder(x, y, "right", chk);
}
function InitBorder(x, y, w, chk) {
if (w == "up") {
var _local3 = 0;
while (_local3 < 3) {
var _local2 = 0;
while (_local2 < Nx) {
if (chk == undefined) {
var _local6 = "cub" + Math.round((Math.random() * Nomer) + 1);
} else {
var _local6 = _root[("UNDO" + w.substr(0, 1)) + "0"][_local3][_local2];
}
game.attachMovie(_local6, (("b" + _local3) + _local2) + "up", FindDepth(_local3, _local2, "up"), {_x:x + (Size * _local2), _y:y - (Size * (_local3 + 1))});
gamef.attachMovie(_local6 + "f", (("b" + _local3) + _local2) + "up", FindDepth(_local3, _local2, "up"), {_x:x + (Size * _local2), _y:y - (Size * (_local3 + 1))});
InitCube(game[(("b" + _local3) + _local2) + "up"]);
game[(("b" + _local3) + _local2) + "up"].name = _local6;
game[(("b" + _local3) + _local2) + "up"].direction = "up";
_local2++;
}
_local3++;
}
} else if (w == "down") {
var _local3 = 0;
while (_local3 < 3) {
var _local2 = 0;
while (_local2 < Nx) {
if (chk == undefined) {
var _local6 = "cub" + Math.round((Math.random() * Nomer) + 1);
} else {
var _local6 = _root[("UNDO" + w.substr(0, 1)) + "0"][_local3][_local2];
}
game.attachMovie(_local6, (("b" + _local3) + _local2) + "down", FindDepth(_local3, _local2, "down"), {_x:x + (Size * _local2), _y:(y + (Size * Ny)) + (Size * _local3)});
gamef.attachMovie(_local6 + "f", (("b" + _local3) + _local2) + "down", FindDepth(_local3, _local2, "down"), {_x:x + (Size * _local2), _y:(y + (Size * Ny)) + (Size * _local3)});
InitCube(game[(("b" + _local3) + _local2) + "down"]);
game[(("b" + _local3) + _local2) + "down"].name = _local6;
game[(("b" + _local3) + _local2) + "down"].direction = "down";
_local2++;
}
_local3++;
}
} else if (w == "left") {
var _local3 = 0;
while (_local3 < Ny) {
var _local2 = 0;
while (_local2 < 3) {
if (chk == undefined) {
var _local6 = "cub" + Math.round((Math.random() * Nomer) + 1);
} else {
var _local6 = _root[("UNDO" + w.substr(0, 1)) + "0"][_local2][_local3];
}
game.attachMovie(_local6, (("b" + _local3) + _local2) + "left", FindDepth(_local3, _local2, "left"), {_x:x - (Size * (_local2 + 1)), _y:y + (Size * _local3)});
gamef.attachMovie(_local6 + "f", (("b" + _local3) + _local2) + "left", FindDepth(_local3, _local2, "left"), {_x:x - (Size * (_local2 + 1)), _y:y + (Size * _local3)});
InitCube(game[(("b" + _local3) + _local2) + "left"]);
game[(("b" + _local3) + _local2) + "left"].name = _local6;
game[(("b" + _local3) + _local2) + "left"].direction = "left";
_local2++;
}
_local3++;
}
} else if (w == "right") {
var _local3 = 0;
while (_local3 < Ny) {
var _local2 = 0;
while (_local2 < 3) {
if (chk == undefined) {
var _local6 = "cub" + Math.round((Math.random() * Nomer) + 1);
} else {
var _local6 = _root[("UNDO" + w.substr(0, 1)) + "0"][_local2][_local3];
}
game.attachMovie(_local6, (("b" + _local3) + _local2) + "right", FindDepth(_local3, _local2, "right"), {_x:(x + (Size * Nx)) + (Size * _local2), _y:y + (Size * _local3)});
gamef.attachMovie(_local6 + "f", (("b" + _local3) + _local2) + "right", FindDepth(_local3, _local2, "right"), {_x:(x + (Size * Nx)) + (Size * _local2), _y:y + (Size * _local3)});
InitCube(game[(("b" + _local3) + _local2) + "right"]);
game[(("b" + _local3) + _local2) + "right"].name = _local6;
game[(("b" + _local3) + _local2) + "right"].direction = "right";
_local2++;
}
_local3++;
}
}
}
function InitFon(x, y) {
var _local2 = 0;
while (_local2 < Nx) {
var _local1 = 0;
while (_local1 < Ny) {
fon.attachMovie("fon", ("f" + _local2) + _local1, fon.getNextHighestDepth(), {_x:x + (Size * _local1), _y:y + (Size * _local2)});
_local1++;
}
_local2++;
}
}
function InitCube(Name) {
Name.onRollOver = MouseOver;
Name.onRollOut = MouseOut;
Name.onPress = MoveCube;
Name.onReleaseOutside = MouseOut;
Name.useHandCursor = false;
Name.tabEnabled = false;
}
function UnInitCube(Name) {
Name.onRollOver = null;
Name.onRollOut = null;
Name.onPress = null;
Name.onReleaseOutside = null;
Name.useHandCursor = false;
Name.tabEnabled = false;
}
function FindWay(i, j, w, c) {
if (c == undefined) {
var _local2 = Matrix;
} else {
var _local2 = _root["HINT" + c];
}
switch (w) {
case "up" :
var _local3 = i + 1;
while (_local3 < _local2.length) {
if (_local2[_local3][j] != 0) {
return(_local3 - 1);
}
_local3++;
}
return(Ny);
case "down" :
_local3 = i - 1;
while (_local3 >= 0) {
if (_local2[_local3][j] != 0) {
return(_local3 + 1);
}
_local3--;
}
return(-1);
case "left" :
_local3 = j + 1;
while (_local3 < _local2[0].length) {
if (_local2[i][_local3] != 0) {
return(_local3 - 1);
}
_local3++;
}
return(Nx);
case "right" :
_local3 = j - 1;
while (_local3 >= 0) {
if (_local2[i][_local3] != 0) {
return(_local3 + 1);
}
_local3--;
}
return(-1);
}
}
function MoveCube(N) {
if (N != undefined) {
this=game[N];//parameter overwritten
game[N];
}
ClearHint();
GlobalMove = true;
var _local10 = this._name.substr(3, 10);
var _local2 = this._name.substr(1, 1);
var _local3 = this._name.substr(2, 1);
var _local11 = this.getDepth + 500;
if (!moving) {
switch (_local10) {
case "up" :
if (_local2 == 0) {
if (!ClearCol(_local3)) {
var _local9 = FindWay(-1, _local3, "up");
if (_local9 >= 0) {
SetUNDO();
var _local4 = this._name;
var _local5 = (("b" + _local9) + _local3) + "n";
Move(_local4, _local5);
_local5 = _local4;
_local4 = ("b1" + _local3) + "up";
Move(_local4, _local5);
_local5 = _local4;
_local4 = ("b2" + _local3) + "up";
Move(_local4, _local5);
var _local7 = "cub" + Math.round((Math.random() * Nomer) + 1);
var _local6 = ("b3" + _local3) + "up";
game.attachMovie(_local7, _local6, 0, {_x:GlobalX + (Size * _local3), _y:GlobalY - (Size * 4), _alpha:0});
gamef.attachMovie(_local7 + "f", _local6, 0, {_x:GlobalX + (Size * _local3), _y:GlobalY - (Size * 4), _alpha:0});
game[_local6].name = _local7;
game[_local6].direction = "up";
_local5 = _local4;
_local4 = _local6;
Move(_local4, _local5, 1);
UnInitCube(this);
}
}
}
break;
case "left" :
if (_local3 == 0) {
if (!ClearLine(_local2)) {
var _local8 = FindWay(_local2, -1, "left");
if (_local8 >= 0) {
SetUNDO();
var _local4 = this._name;
var _local5 = (("b" + _local2) + _local8) + "n";
Move(_local4, _local5);
_local5 = _local4;
_local4 = (("b" + _local2) + 1) + "left";
Move(_local4, _local5);
_local5 = _local4;
_local4 = (("b" + _local2) + 2) + "left";
Move(_local4, _local5);
var _local7 = "cub" + Math.round((Math.random() * Nomer) + 1);
var _local6 = (("b" + _local2) + 3) + "left";
game.attachMovie(_local7, _local6, 0, {_y:GlobalY + (Size * _local2), _x:GlobalX - (Size * 4), _alpha:0});
gamef.attachMovie(_local7 + "f", _local6, 0, {_y:GlobalY + (Size * _local2), _x:GlobalX - (Size * 4), _alpha:0});
game[_local6].name = _local7;
game[_local6].direction = "left";
_local5 = _local4;
_local4 = _local6;
Move(_local4, _local5, 1);
UnInitCube(this);
}
}
}
break;
case "right" :
if (_local3 == 0) {
if (!ClearLine(_local2)) {
var _local8 = FindWay(_local2, Nx, "right");
if (_local8 < Nx) {
SetUNDO();
var _local4 = this._name;
var _local5 = (("b" + _local2) + _local8) + "n";
Move(_local4, _local5);
_local5 = _local4;
_local4 = (("b" + _local2) + 1) + "right";
Move(_local4, _local5);
_local5 = _local4;
_local4 = (("b" + _local2) + 2) + "right";
Move(_local4, _local5);
var _local7 = "cub" + Math.round((Math.random() * Nomer) + 1);
var _local6 = (("b" + _local2) + 3) + "right";
game.attachMovie(_local7, _local6, FindDepth(_local2, 3, "right"), {_y:GlobalY + (Size * _local2), _x:GlobalX + (Size * (3 + Nx)), _alpha:0});
gamef.attachMovie(_local7 + "f", _local6, FindDepth(_local2, 3, "right"), {_y:GlobalY + (Size * _local2), _x:GlobalX + (Size * (3 + Nx)), _alpha:0});
game[_local6].name = _local7;
game[_local6].direction = "right";
_local5 = _local4;
_local4 = _local6;
Move(_local4, _local5, 1);
UnInitCube(this);
}
}
}
break;
case "down" :
if (_local2 != 0) {
break;
}
if (ClearCol(_local3)) {
break;
}
var _local9 = FindWay(Ny, _local3, "down");
if (_local9 >= Ny) {
break;
}
SetUNDO();
var _local4 = this._name;
var _local5 = (("b" + _local9) + _local3) + "n";
Move(_local4, _local5);
_local5 = _local4;
_local4 = ("b1" + _local3) + "down";
Move(_local4, _local5);
_local5 = _local4;
_local4 = ("b2" + _local3) + "down";
Move(_local4, _local5);
var _local7 = "cub" + Math.round((Math.random() * Nomer) + 1);
var _local6 = ("b3" + _local3) + "down";
game.attachMovie(_local7, _local6, 0, {_x:GlobalX + (Size * _local3), _y:GlobalY + (Size * (3 + Ny)), _alpha:0});
gamef.attachMovie(_local7 + "f", _local6, 0, {_x:GlobalX + (Size * _local3), _y:GlobalY + (Size * (3 + Ny)), _alpha:0});
game[_local6].name = _local7;
game[_local6].direction = "down";
_local5 = _local4;
_local4 = _local6;
Move(_local4, _local5, 1);
UnInitCube(this);
}
}
}
function MouseOver() {
ClearHint();
var _local6 = this.direction;
var _local3 = this.name.substr(3, 1);
var _local5 = this._name.substr(1, 1);
var _local4 = this._name.substr(2, 1);
var _local2 = 0;
switch (_local6) {
case "up" :
if (_local5 == 0) {
if ((!ClearCol(_local4)) && (Matrix[0][_local4] == 0)) {
GetHint(this._name);
this.attachMovie("strela" + _local3, "s", _local2, {_rotation:90, _x:Size / 2, _y:Size / 2});
} else {
this.attachMovie("krest" + _local3, "s", _local2);
}
}
break;
case "left" :
if (_local4 == 0) {
if ((!ClearLine(_local5)) && (Matrix[_local5][0] == 0)) {
GetHint(this._name);
this.attachMovie("strela" + _local3, "s", _local2, {_rotation:0, _x:Size / 2, _y:Size / 2});
} else {
this.attachMovie("krest" + _local3, "s", _local2);
}
}
break;
case "right" :
if (_local4 == 0) {
if ((!ClearLine(_local5)) && (Matrix[_local5][9] == 0)) {
GetHint(this._name);
this.attachMovie("strela" + _local3, "s", _local2, {_rotation:180, _x:Size / 2, _y:Size / 2});
} else {
this.attachMovie("krest" + _local3, "s", _local2);
}
}
break;
case "down" :
if (_local5 != 0) {
break;
}
if ((!ClearCol(_local4)) && (Matrix[9][_local4] == 0)) {
GetHint(this._name);
this.attachMovie("strela" + _local3, "s", _local2, {_rotation:-90, _x:Size / 2, _y:Size / 2});
} else {
this.attachMovie("krest" + _local3, "s", _local2);
}
}
}
function MouseOut() {
ClearHint();
FindHint();
var _local2 = this._name.substr(3, 10);
var _local5 = this._name.substr(1, 1);
var _local4 = this._name.substr(2, 1);
var _local3 = this.getDepth + 500;
switch (_local2) {
case "up" :
this.s.removeMovieClip();
break;
case "left" :
this.s.removeMovieClip();
break;
case "right" :
this.s.removeMovieClip();
break;
case "down" :
this.s.removeMovieClip();
}
}
function ClearLine(i, c) {
if (c == undefined) {
var _local3 = Matrix;
} else {
var _local3 = _root["HINT" + c];
}
var _local2 = 0;
while (_local2 < Nx) {
if (_local3[i][_local2] != 0) {
return(false);
}
_local2++;
}
return(true);
}
function ClearCol(i, c) {
if (c == undefined) {
var _local3 = Matrix;
} else {
var _local3 = _root["HINT" + c];
}
var _local2 = 0;
while (_local2 < Ny) {
if (_local3[_local2][i] != 0) {
return(false);
}
_local2++;
}
return(true);
}
function geti(Name) {
return(Name.substr(1, 1));
}
function getj(Name) {
return(Name.substr(2, 1));
}
function getTail(Name) {
return(Name.substr(3, 10));
}
function FindX(j, w) {
switch (w) {
case "n" :
return(Number(GlobalX) + (j * Size));
case "up" :
return(Number(GlobalX) + (j * Size));
case "down" :
return(Number(GlobalX) + (j * Size));
case "left" :
return(Number(GlobalX) - (Number(Number(j) + 1) * Size));
case "right" :
return((Number(GlobalX) + (Nx * Size)) + (j * Size));
}
}
function FindY(i, w) {
switch (w) {
case "n" :
return(Number(GlobalY) + (i * Size));
case "up" :
return(Number(GlobalY) - (Number(Number(i) + 1) * Size));
case "down" :
return((Number(GlobalY) + (Size * Ny)) + (i * Size));
case "left" :
return(Number(GlobalY) + (i * Size));
case "right" :
return(Number(GlobalY) + (i * Size));
}
}
function GetRotation(w) {
switch (w) {
case "up" :
return(90);
case "down" :
return(-90);
case "left" :
return(0);
case "right" :
return(180);
}
}
function SwapDirection(Name) {
var _local2 = game[Name].direction;
switch (_local2) {
case "up" :
game[Name].direction = "down";
break;
case "down" :
game[Name].direction = "up";
break;
case "left" :
game[Name].direction = "right";
break;
case "right" :
game[Name].direction = "left";
}
}
function Move(Name1, Name2, chk) {
if (SoundOn && ((move_s.position == 0) || (move_s.position == move_s.duration))) {
move_s.start();
}
var _local19 = getTimer();
var _local17 = geti(Name1);
var _local15 = getj(Name1);
var _local7 = game[Name1]._x;
var _local6 = game[Name1]._y;
var _local10 = geti(Name2);
var _local9 = getj(Name2);
var _local5 = getTail(Name2);
var _local12 = getTail(Name1);
var _local16 = FindX(_local9, _local5);
var _local14 = FindY(_local10, _local5);
var _local27 = FindDepth(_local17, _local15, _local12);
var _local8 = FindDepth(_local10, _local9, _local5);
var _local22 = game[Name1].direction;
var _local4 = game[Name1].name;
var _local20 = GetRotation(game[Name1].direction);
if (chk == 1) {
var _local13 = 0;
var _local21 = 100;
} else if (chk == -1) {
var _local13 = 100;
var _local21 = 0;
}
game[Name1].removeMovieClip();
gamef[Name1].removeMovieClip();
game.attachMovie(_local4, Name2, _local8, {_x:_local7, _y:_local6, _alpha:_local13});
gamef.attachMovie(_local4 + "f", Name2, _local8, {_x:_local7, _y:_local6, _alpha:_local13});
game[Name2].name = _local4;
game[Name2].direction = _local22;
var _local11 = Speed * Math.abs(_local16 - _local7);
if (_local11 < 1) {
_local11 = Speed * Math.abs(_local14 - _local6);
}
clearInterval(_root["m" + Name2]);
_root["m" + _local8] = setInterval(Moving, 0, _local7, _local6, _local16, _local14, _local19, _local11, Name2, _local12, _local5, _local13, _local21, _local8);
if ((_local12 == "n") && (chk != 0)) {
Matrix[_local17][_local15] = 0;
}
if (_local5 == "n") {
if (chk != 0) {
Matrix[_local10][_local9] = _local4 + "n";
}
game[Name2].attachMovie("strela" + _local4.substr(3, 1), "s", 0, {_rotation:_local20, _x:Size / 2, _y:Size / 2});
}
}
function Moving(x1, y1, x2, y2, T, TT, Name, end1, end2, a1, a2, i) {
_root.moving = true;
var _local3 = getTimer();
if (_local3 >= (T + TT)) {
moving = false;
clearInterval(_root["m" + i]);
delete _root["m" + i];
game[Name]._x = x2;
game[Name]._y = y2;
game[Name]._alpha = 100;
gamef[Name]._x = x2;
gamef[Name]._y = y2;
gamef[Name]._alpha = 100;
if (end2 != "n") {
InitCube(game[Name]);
RemoveCub(Name);
if (end1 == "n") {
SwapDirection(Name);
NextMove(Matrix);
}
} else {
clearInterval(fall);
fall = setInterval(function () {
clearInterval(fall);
FindChain(Matrix);
}, 0);
NextMove(Matrix);
}
} else {
var _local8 = x1 + (((x2 - x1) * (_local3 - T)) / TT);
var _local7 = y1 + (((y2 - y1) * (_local3 - T)) / TT);
var _local5 = a1 + (((a2 - a1) * (_local3 - T)) / TT);
game[Name]._x = _local8;
game[Name]._y = _local7;
gamef[Name]._x = _local8;
gamef[Name]._y = _local7;
game[Name]._alpha = _local5;
gamef[Name]._alpha = _local5;
}
}
function RemoveCub(Name) {
var _local1 = getTail(Name);
var _local4 = geti(Name);
var _local3 = getj(Name);
if (((((_local4 == 3) && (_local1 == "up")) || ((_local4 == 3) && (_local1 == "down"))) || ((_local3 == 3) && (_local1 == "left"))) || ((_local3 == 3) && (_local1 == "right"))) {
game[Name].removeMovieClip();
gamef[Name].removeMovieClip();
}
}
function Blow(i, j) {
var Name = ((("b" + i) + j) + Matrix[i][j].substr(4, 1));
gamef[Name + "d"].removeMovieClip();
fly["dis" + Matrix[i][j].substr(0, 4)].removeMovieClip();
fly.attachMovie("dis" + Matrix[i][j].substr(0, 4), ("d" + i) + j, fly.getNextHighestDepth(), {_x:FindX(j, "n"), _y:FindY(i, "n")});
Matrix[i][j] = 0;
game[Name].removeMovieClip();
var T = getTimer();
gamef[Name]._name = Name + "d";
Name = Name + "d";
clearInterval(_root[(("dd" + i) + j) + T]);
_root[(("dd" + i) + j) + T] = setInterval(function () {
var _local3 = 500;
var _local2 = getTimer();
if (_local2 < (T + _local3)) {
gamef[Name]._alpha = 100 - ((100 * (_local2 - T)) / _local3);
} else {
clearInterval(_root[(("dd" + i) + j) + T]);
gamef[Name].removeMovieClip();
}
}, 0);
}
function ShowScore(i, j, L) {
if (SoundOn) {
boom_s.start();
}
fon.hint.removeMovieClip();
Score(L * 10);
matches++;
bricks = bricks + L;
}
function FindChain(Matrix, chk) {
function FindBlow() {
var _local5 = 0;
while (_local5 < Matrix.length) {
var _local4 = 0;
while (_local4 < Matrix[0].length) {
if (_root[("Ms" + _local5) + _local4] != undefined) {
var _local2 = _root[("Ms" + _local5) + _local4];
var _local6 = 0;
var _local7 = 0;
var _local3 = 0;
while (_local3 < _local2.length) {
i1 = Number(_local2[_local3].i);
j1 = Number(_local2[_local3].j);
_root[("c" + i1) + j1]._alpha = _root[("c" + i1) + j1]._alpha + (_local2.length * 20);
_local6 = _local6 + i1;
_local7 = _local7 + j1;
Blow(i1, j1);
_local3++;
}
ShowScore(_local6, _local7, _local2.length);
delete _root[("Ms" + _local5) + _local4];
}
_local4++;
}
_local5++;
}
}
function FindMatch(i, j, M) {
function ClearM(i, j, M) {
Matrix1[i][j] = "no";
var _local1 = new Array("i", "j");
_local1.i = i;
_local1.j = j;
M.push(_local1);
}
var _local6 = false;
var _local8 = FindDepth(i, j, "n");
if (_root["m" + _local8] == undefined) {
var _local5 = Matrix[i][j];
_local5 = Matrix[i][j].substr(0, 4);
if (_local5.substr(0, 1) == "c") {
if ((Matrix[i - 1][j].substr(0, 4) == _local5) && (_root["m" + FindDepth(i - 1, j, "n")] == undefined)) {
if (Matrix1[i - 1][j] != "no") {
ClearM(i - 1, j, M);
FindMatch(i - 1, j, M);
}
if (Matrix1[i][j] != "no") {
ClearM(i, j, M);
FindMatch(i, j, M);
}
_local6 = true;
}
if ((Matrix[i + 1][j].substr(0, 4) == _local5) && (_root["m" + FindDepth(i + 1, j, "n")] == undefined)) {
if (Matrix1[i + 1][j] != "no") {
ClearM(i + 1, j, M);
FindMatch(i + 1, j, M);
}
if (Matrix1[i][j] != "no") {
ClearM(i, j, M);
FindMatch(i, j, M);
}
_local6 = true;
}
if ((Matrix[i][j + 1].substr(0, 4) == _local5) && (_root["m" + FindDepth(i, j + 1, "n")] == undefined)) {
if (Matrix1[i][j + 1] != "no") {
ClearM(i, j + 1, M);
FindMatch(i, j + 1, M);
}
if (Matrix1[i][j] != "no") {
ClearM(i, j, M);
FindMatch(i, j, M);
}
_local6 = true;
}
if ((Matrix[i][j - 1].substr(0, 4) == _local5) && (_root["m" + FindDepth(i, j - 1, "n")] == undefined)) {
if (Matrix1[i][j - 1] != "no") {
ClearM(i, j - 1, M);
FindMatch(i, j - 1, M);
}
if (Matrix1[i][j] != "no") {
ClearM(i, j, M);
FindMatch(i, j, M);
}
_local6 = true;
}
}
}
return(_local6);
}
clearInterval(fall);
var _local9 = false;
Matrix1 = new Array();
var _local5 = 0;
while (_local5 < Matrix.length) {
var _local8 = new Array();
var _local3 = 0;
while (_local3 < Matrix[_local5].length) {
_local8[_local3] = 0;
_local3++;
}
Matrix1[_local5] = _local8;
_local5++;
}
_local5 = 0;
while (_local5 < Matrix.length) {
var _local3 = 0;
while (_local3 < Matrix[_local5].length) {
if (Matrix1[_local5][_local3] != "no") {
_root[("Ms" + _local5) + _local3] = new Array();
FindMatch(_local5, _local3, _root[("Ms" + _local5) + _local3]);
if (_root[("Ms" + _local5) + _local3].length < 3) {
delete _root[("Ms" + _local5) + _local3];
} else {
_local9 = true;
}
}
_local3++;
}
_local5++;
}
if (_local9 && (chk != "no")) {
FindBlow();
NextMove(Matrix);
}
return(_local9);
}
function NextMove(Matrix) {
var _local12 = true;
var _local11 = false;
if (!moving) {
var _local3 = 0;
while (_local3 < Matrix.length) {
var _local2 = 0;
while (_local2 < Matrix.length) {
if (Matrix[_local3][_local2] != 0) {
if (Matrix[_local3][_local2].length == 4) {
_local12 = false;
}
var _local9 = Matrix[_local3][_local2].substr(4, 10);
var _local10 = FindDepth(_local3, _local2, "n");
if ((_local9 == "n") && (_root["m" + _local10] == undefined)) {
var _local5 = (("b" + _local3) + _local2) + "n";
_local9 = game[_local5].direction;
var _local7 = game[_local5].name;
switch (_local9) {
case "up" :
if (Matrix[_local3 + 1][_local2] == undefined) {
_local11 = true;
Matrix[_local3][_local2] = 0;
var _local6 = ("b2" + _local2) + "down";
var _local8 = ("b3" + _local2) + "down";
Move(_local6, _local8, -1);
_local8 = _local6;
_local6 = ("b1" + _local2) + "down";
Move(_local6, _local8);
_local8 = _local6;
_local6 = ("b0" + _local2) + "down";
Move(_local6, _local8);
_local8 = _local6;
_local6 = _local5;
Move(_local6, _local8);
} else if (Matrix[_local3 + 1][_local2] == 0) {
_local11 = true;
Matrix[_local3][_local2] = 0;
Matrix[_local3 + 1][_local2] = _local7 + "m";
var _local8 = (("b" + Number(Number(_local3) + 1)) + _local2) + "n";
Move(_local5, _local8, 0);
}
break;
case "down" :
if (Matrix[_local3 - 1][_local2] == undefined) {
_local11 = true;
Matrix[_local3][_local2] = 0;
var _local6 = ("b2" + _local2) + "up";
var _local8 = ("b3" + _local2) + "up";
Move(_local6, _local8, -1);
_local8 = _local6;
_local6 = ("b1" + _local2) + "up";
Move(_local6, _local8);
_local8 = _local6;
_local6 = ("b0" + _local2) + "up";
Move(_local6, _local8);
_local8 = _local6;
_local6 = _local5;
Move(_local6, _local8);
} else if (Matrix[_local3 - 1][_local2] == 0) {
_local11 = true;
Matrix[_local3][_local2] = 0;
Matrix[_local3 - 1][_local2] = _local7 + "m";
var _local8 = (("b" + Number(Number(_local3) - 1)) + _local2) + "n";
Move(_local5, _local8, 0);
}
break;
case "left" :
if (Matrix[_local3][_local2 + 1] == undefined) {
_local11 = true;
Matrix[_local3][_local2] = 0;
var _local6 = (("b" + _local3) + 2) + "right";
var _local8 = (("b" + _local3) + 3) + "right";
Move(_local6, _local8, -1);
_local8 = _local6;
_local6 = (("b" + _local3) + 1) + "right";
Move(_local6, _local8);
_local8 = _local6;
_local6 = (("b" + _local3) + 0) + "right";
Move(_local6, _local8);
_local8 = _local6;
_local6 = _local5;
Move(_local6, _local8);
} else if (Matrix[_local3][_local2 + 1] == 0) {
_local11 = true;
Matrix[_local3][_local2] = 0;
Matrix[_local3][_local2 + 1] = _local7 + "m";
var _local8 = (("b" + _local3) + Number(Number(_local2) + 1)) + "n";
Move(_local5, _local8, 0);
}
break;
case "right" :
if (Matrix[_local3][_local2 - 1] == undefined) {
_local11 = true;
Matrix[_local3][_local2] = 0;
var _local6 = (("b" + _local3) + 2) + "left";
var _local8 = (("b" + _local3) + 3) + "left";
Move(_local6, _local8, -1);
_local8 = _local6;
_local6 = (("b" + _local3) + 1) + "left";
Move(_local6, _local8);
_local8 = _local6;
_local6 = (("b" + _local3) + 0) + "left";
Move(_local6, _local8);
_local8 = _local6;
_local6 = _local5;
Move(_local6, _local8);
} else {
if (Matrix[_local3][_local2 - 1] != 0) {
break;
}
_local11 = true;
Matrix[_local3][_local2] = 0;
Matrix[_local3][_local2 - 1] = _local7 + "m";
var _local8 = (("b" + _local3) + Number(Number(_local2) - 1)) + "n";
Move(_local5, _local8, 0);
}
}
}
}
_local2++;
}
_local3++;
}
SetNM(Matrix);
if ((_local12 && (!_local11)) && (!moving)) {
EndingRound();
} else if ((!_local11) && (!moving)) {
GlobalMove = false;
clearInterval(hinting);
hinting = setInterval(FindHint, 1000);
}
}
}
function EndingRound() {
ClearHint();
black.removeMovieClip();
_root.attachMovie("black", "black", _root.getNextHighestDepth(), {_width:550, _height:450, _alpha:0});
black.onPress = null;
black.useHandCursor = false;
clearInterval(endinground);
endinground = setInterval(function () {
R++;
C = Math.floor(R / 10);
clearInterval(endinground);
ShowStats();
}, 1000);
}
function SetNM(Matrix) {
var _local2 = 0;
while (_local2 < Matrix.length) {
var _local1 = 0;
while (_local1 < Matrix.length) {
if (Matrix[_local2][_local1].substr(0, 1) == "c") {
Matrix[_local2][_local1] = Matrix[_local2][_local1].split("m").join("n");
}
_local1++;
}
_local2++;
}
}
function FunctionFromMap() {
map1.removeMovieClip();
InitRound(C, R);
}
function InitMap() {
var _local6 = 0.65;
map1.removeMovieClip();
help.removeMovieClip();
_root.createEmptyMovieClip("map1", _root.getNextHighestDepth());
map1.attachMovie("map1", "map", map1.getNextHighestDepth());
map1.map.pir1.gotoAndStop(1);
map1.map.pir2.gotoAndStop(1);
map1.map.pir3.gotoAndStop(1);
var _local3 = 0;
while (_local3 <= C) {
map1.map["pir" + _local3].gotoAndStop(30);
_local3++;
}
InitButton(map1.map.b1, textplay, "FunctionFromMap", 2, 7);
InitButton(map1.map.b2, textdownload, "FunctionDownload", 2, 7);
var _local2 = 0;
while (_local2 < MAP.length) {
var _local4 = "way" + MAP[_local2].size;
var _local5 = 100;
if ((C < _local2) && (_local2 < 6)) {
_local5 = 50;
}
if (((R + 6) < _local2) && (_local2 > 5)) {
_local5 = 50;
}
map1.attachMovie(_local4, "p" + _local2, map1.getNextHighestDepth(), {_x:MAP[_local2].x * _local6, _y:MAP[_local2].y * _local6, _alpha:_local5});
_local2++;
}
map1.attachMovie("morg", "morg", map1.getNextHighestDepth(), {_x:MAP[R + 6].x * _local6, _y:MAP[R + 6].y * _local6});
TextShow(map1.map.ttt, (MAP[C].name + " - level ") + Number((R % 10) + 1), "a", 0, 0, 1);
if ((C > 0) && ((R % 10) == 0)) {
if (SoundOn) {
pir_s.start();
}
map1.map["pir" + C].gotoAndPlay(1);
}
}
function GetHint(N) {
var _local9 = getTail(N);
var _local4 = geti(N);
var _local3 = getj(N);
var T = getTimer();
fon.hint.removeMovieClip();
clearInterval(fly1);
fly1 = setInterval(function () {
var _local2 = ((R <= 1) ? 1000 : 3000);
var _local1 = getTimer();
if (_local1 >= (T + _local2)) {
clearInterval(fly1);
fon.hint._alpha = 100;
} else {
fon.hint._alpha = (100 * (_local1 - T)) / _local2;
}
}, 0);
switch (_local9) {
case "up" :
_local4 = FindWay(0, _local3, "up");
var _local5 = (_local4 + 1) * 2;
fon.createEmptyMovieClip("hint", fly.getNextHighestDepth());
fon.hint._alpha = 0;
var _local1 = 0;
while (_local1 < _local5) {
fon.hint.attachMovie("hintstr", "h" + _local1, fon.hint.getNextHighestDepth(), {_y:3 + ((_local1 * Size) / 2)});
fon.hint["h" + _local1].gotoAndPlay(_local1 % 20);
_local1++;
}
fon.hint._x = (FindX(_local3, "n") + (Size / 2)) + ddx;
fon.hint._y = (FindY(_local4, "n") + Size) + ddx;
fon.hint._rotation = 180;
break;
case "down" :
_local4 = FindWay(9, _local3, "down");
_local5 = 20 - (_local4 * 2);
fon.createEmptyMovieClip("hint", fly.getNextHighestDepth());
fon.hint._alpha = 0;
_local1 = 0;
while (_local1 < _local5) {
fon.hint.attachMovie("hintstr", "h" + _local1, fon.hint.getNextHighestDepth(), {_y:3 + ((_local1 * Size) / 2)});
fon.hint["h" + _local1].gotoAndPlay(_local1 % 20);
_local1++;
}
fon.hint._x = (FindX(_local3, "n") + (Size / 2)) + ddx;
fon.hint._y = FindY(_local4, "n") + ddx;
fon.hint._rotation = 0;
break;
case "left" :
_local3 = FindWay(_local4, 0, "left");
_local5 = (_local3 + 1) * 2;
fon.createEmptyMovieClip("hint", fly.getNextHighestDepth());
fon.hint._alpha = 0;
_local1 = 0;
while (_local1 < _local5) {
fon.hint.attachMovie("hintstr", "h" + _local1, fon.hint.getNextHighestDepth(), {_y:3 + ((_local1 * Size) / 2)});
fon.hint["h" + _local1].gotoAndPlay(_local1 % 20);
_local1++;
}
fon.hint._x = (FindX(_local3, "n") + Size) + ddx;
fon.hint._y = (FindY(_local4, "n") + (Size / 2)) + ddx;
fon.hint._rotation = 90;
break;
case "right" :
_local3 = FindWay(_local4, 9, "right");
_local5 = 20 - (_local3 * 2);
fon.createEmptyMovieClip("hint", fly.getNextHighestDepth());
fon.hint._alpha = 0;
_local1 = 0;
while (_local1 < _local5) {
fon.hint.attachMovie("hintstr", "h" + _local1, fon.hint.getNextHighestDepth(), {_y:3 + ((_local1 * Size) / 2)});
fon.hint["h" + _local1].gotoAndPlay(_local1 % 20);
_local1++;
}
fon.hint._x = FindX(_local3, "n") + ddx;
fon.hint._y = (FindY(_local4, "n") + (Size / 2)) + ddx;
fon.hint._rotation = -90;
}
}
function ShowMENU() {
ClearHint();
black.removeMovieClip();
_root.attachMovie("black", "black", _root.getNextHighestDepth(), {_width:550, _height:450, _alpha:50});
black.onPress = null;
black.useHandCursor = false;
menu.removeMovieClip();
_root.attachMovie("mainmenu", "menu", _root.getNextHighestDepth(), {_x:140, _y:30});
InitButton(menu.b1, menubutton1, "FunctionRestart", 0, 15);
InitButton(menu.b2, menubutton2, "FunctionHelp", 0, 15);
InitButton(menu.b3, menusound, "FunctionSound", 0, 15);
InitButton(menu.b4, menubutton4, "FunctionDownload", 0, 15);
InitButton(menu.b5, menubutton5, "FunctionNew", 0, 15);
InitButton(menu.b6, menubutton6, "FunctionResume", 0, 15);
}
function FunctionRestart() {
black.removeMovieClip();
menu.removeMovieClip();
score = lscore;
InitRound(C, R);
}
function FunctionHelp() {
black.swapDepths(menu);
help.removeMovieClip();
_root.attachMovie("helppanel", "help", _root.getNextHighestDepth());
if (Matrix == undefined) {
InitButton(help.b1, textplay, "InitMap", 2, 4);
} else {
InitButton(help.b1, textplay, "FunctionFromHelp", 2, 4);
}
var _local3 = new TextFormat();
_local3.font = "Arial";
_local3.size = "16";
_local3.bold = true;
_local3.color = 4598281 /* 0x462A09 */;
_local3.align = "center";
var _local2 = 1;
while (_local2 < 5) {
help["t" + _local2].createTextField("hinttext", help["t" + _local2].getNextHighestDepth(), 0, 0, 0, 0);
help["t" + _local2].hinttext.multiline = true;
help["t" + _local2].hinttext.autoSize = "center";
help["t" + _local2].hinttext.selectable = false;
help["t" + _local2].hinttext.text = ConvertText(_root["helping" + Number(_local2 - 1)]);
help["t" + _local2].hinttext.setTextFormat(_local3);
_local2++;
}
}
function FunctionSound() {
SoundOn = !SoundOn;
if (SoundOn) {
menusound = menubutton3;
} else {
menusound = menubutton7;
}
InitButton(menu.b3, menusound, "FunctionSound", 0, 15);
TextShow(menu.b3text, menusound, "a", 0, 0, 1);
}
function FunctionDownload() {
getURL (downloadlink, "_blank");
}
function FunctionNew() {
black.removeMovieClip();
menu.removeMovieClip();
nag.removeMovieClip();
score = 0;
ClearRound();
C = (R = 0);
InitMap();
}
function FunctionResume() {
black.removeMovieClip();
menu.removeMovieClip();
hinting = setInterval(FindHint, 1000);
}
function FunctionFromHelp() {
black.swapDepths(menu);
help.removeMovieClip();
}
function ShowNag() {
nagcounter++;
if (((nagtime == 0) || (R == map.length)) || ((nagcounter % nagtime) == 0)) {
nagcounter = 0;
Nag();
} else {
InitMap();
}
}
function Nag() {
nag.removeMovieClip();
_root.attachMovie("nag", "nag", _root.getNextHighestDepth());
nag.t1.createTextField("hinttext", nag.t1.getNextHighestDepth(), 0, 0, 0, 0);
nag.t1.hinttext.multiline = true;
nag.t1.hinttext.autoSize = "left";
nag.t1.hinttext.selectable = false;
nag.t2.createTextField("hinttext", nag.t2.getNextHighestDepth(), 0, 0, 0, 0);
nag.t2.hinttext.multiline = true;
nag.t2.hinttext.autoSize = "center";
nag.t2.hinttext.selectable = false;
format1 = new TextFormat();
format1.font = "Arial";
format1.size = "13";
format1.bold = true;
format1.color = 4598281 /* 0x462A09 */;
format1.align = "left";
format2 = new TextFormat();
format2.font = "Arial";
format2.size = "13";
format2.bold = true;
format2.color = 4598281 /* 0x462A09 */;
format2.align = "center";
nag.t1.hinttext.text = ConvertText(nagmore);
if (R != map.length) {
nag.t2.hinttext.text = ConvertText(nagtextnext);
InitButton(nag.b1, textcontinue, "FunctionNagContinue", 2, 8);
} else {
nag.t2.hinttext.text = ConvertText(nagtextend);
InitButton(nag.b1, textrestart, "FunctionNew", 0, 8);
}
InitButton(nag.b2, textdownload, "FunctionDownload", 2, 8);
nag.t1.hinttext.setTextFormat(format1);
nag.t2.hinttext.setTextFormat(format2);
}
function FunctionNagContinue() {
nag.removeMovieClip();
InitMap();
}
function ShowStats() {
if (SoundOn) {
levelcomplete_s.start();
}
black._alpha = 50;
lscore = score - lscore;
stats.removeMovieClip();
_root.attachMovie("scorepanel", "stats", _root.getNextHighestDepth(), {_x:120, _y:50});
InitButton(stats.okb, "OK", "FunctionFromStats", 0, 4);
TextShow(stats.description, textscores, "a", 0, 0, 1);
TextShow(stats.b11, textbricks, "a", 0, 0, 0);
TextShow(stats.b21, textmatches, "a", 0, 0, 0);
TextShow(stats.b31, texttime, "a", 0, 0, 0);
TextShow(stats.b41, textlscore, "a", 0, 0, 0);
TextShow(stats.b51, texttscore, "a", 0, 0, 0);
TextShow(stats.b12, String(bricks), "n", 0, 0, 2);
TextShow(stats.b22, String(matches), "n", 0, 0, 2);
TextShow(stats.b32, String(Math.round((getTimer() - RoundTime) / 1000)), "n", 0, 0, 2);
TextShow(stats.b42, String(lscore), "n", 0, 0, 2);
TextShow(stats.b52, String(score), "n", 0, 0, 2);
}
function FunctionFromStats() {
black.removeMovieClip();
stats.removeMovieClip();
ClearRound();
ShowNag();
}
function InitSound() {
boom_s = new Sound();
boom_s.attachSound("boom_s");
boom_s.setVolume(80);
button_s = new Sound();
button_s.attachSound("button_s");
levelcomplete_s = new Sound();
levelcomplete_s.attachSound("levelcomplete_s");
levelstart_s = new Sound();
levelstart_s.attachSound("levelstart_s");
move_s = new Sound();
move_s.attachSound("move_s");
pir_s = new Sound();
pir_s.attachSound("pir_s");
}
this._lockroot = true;
menusound = menubutton3;
nagcounter = 0;
Speed = 3;
SoundOn = true;
Nomer = 2;
oMouse = {};
oMouse.onMouseDown = function () {
fon.hint.removeMovieClip();
};
Mouse.addListener(oMouse);
stop();
UNDO = 20;
ddx = 8;
Add = (score = (lscore = (bricks = (matches = 0))));
R = 0;
C = Math.floor(R / 10);
moving = false;
Hint = new Array(0, 0, 0);
aaaaa = setInterval(function () {
updateAfterEvent();
}, 0);
Size = 23.75;
Nx = 10;
Ny = 10;
GlobalX = 136 + (3 * Size);
GlobalY = 45 + (3 * Size);
InitSound();
FunctionHelp();
oKey = {};
oKey.onKeyDown = function () {
if (Key.isDown(9)) {
} else if (Key.isDown(13)) {
} else if (Key.isDown(17)) {
} else if (Key.isDown(38)) {
if (Key.getCode() == 90) {
EndingRound();
}
}
};
oKey.onKeyUp = function () {
if (Key.getCode() == 90) {
if ((Key.isDown(17) && (gamemask._name != undefined)) && (black._name == undefined)) {
GetUNDO();
}
}
};
Key.addListener(oKey);
Symbol 79 MovieClip [apir0] Frame 49
stop();
Symbol 83 MovieClip [apir1] Frame 31
stop();
Symbol 87 MovieClip [apir2] Frame 31
stop();
Symbol 111 MovieClip [discub2] Frame 10
stop();
this.removeMovieClip();
Symbol 363 MovieClip [discub3] Frame 10
stop();
this.removeMovieClip();
Symbol 369 MovieClip [discub1] Frame 10
stop();
this.removeMovieClip();
Symbol 375 MovieClip [discub4] Frame 10
stop();
this.removeMovieClip();
Symbol 410 MovieClip [discub5] Frame 10
stop();
this.removeMovieClip();