Frame 1
tellTarget ("_level0") {
lbLoadingGame = "";
};
Frame 2
if (_framesloaded >= _totalframes) {
gotoAndPlay (3);
} else {
gotoAndPlay (1);
}
Frame 3
function Init() {
var i = 0;
while (i < NumCells) {
removeMovieClip(Names[i]);
i++;
}
var i = 0;
while (i < NumCells) {
removeMovieClip(PanelNames[i]);
i++;
}
if (checkLevel.checkLevel1._visible) {
NumRow = (NumCol = 4);
DelNum = 3;
NumColors = 4;
AddNum = 3;
}
if (checkLevel.checkLevel2._visible) {
NumRow = (NumCol = 6);
DelNum = 4;
NumColors = 5;
AddNum = 3;
}
if (checkLevel.checkLevel3._visible) {
NumRow = (NumCol = 8);
DelNum = 5;
NumColors = 6;
AddNum = 4;
}
NumCells = NumRow * NumCol;
CellHeight = (0.99 * BoardForCells._height) / NumRow;
CellWidth = (0.99 * BoardForCells._width) / NumCol;
Panel._width = CellWidth;
Panel._height = CellHeight;
Panel._x = (Panel._y = -1000);
Left = (BoardForCells._x - (BoardForCells._width / 2)) + (CellWidth / 2);
Top = (BoardForCells._y - (BoardForCells._height / 2)) + (CellHeight / 2);
var i = 1;
while (MaxNumColors >= i) {
var Ball = eval ("Ball" + i);
Ball.stop();
Ball._width = (Ball._height = CellWidth * 0.7);
Ball._x = (Ball._y = -1000);
i++;
}
CheckedBall = "";
Moving = false;
AddNew = false;
StartK = (FinishK = 0);
Score = "0";
isResultWnd = false;
HideResultWnd();
Congratulation.gotoAndStop(1);
var r = 0;
while (r < NumRow) {
var c = 0;
while (c < NumCol) {
var name = ((("Panel" + r) + "") + c);
Panel.duplicateMovieClip(name, ++NumOjects);
var NewPanel = eval (name);
NewPanel._x = Left + (c * CellWidth);
NewPanel._y = Top + (r * CellHeight);
Board[c + (r * NumCol)] = 0;
Names[c + (r * NumCol)] = "";
PanelNames[c + (r * NumCol)] = name;
c++;
}
r++;
}
var k = 0;
while (k < MaxNumCells) {
Dist[k] = -1;
k++;
}
TimeLast = getTimer();
TimeLastNew = getTimer();
TimeNewDelay = 5000;
addNewBalls(AddNum);
}
function AddNewBalls(Num) {
var i = 0;
while (i < Num) {
var n = 0;
var k = 0;
while (k < NumCells) {
if (Board[k] == 0) {
FreeK[n++] = k;
}
k++;
}
if (n == 0) {
var j = 0;
while (j < i) {
ClearLines(BallsK[j]);
j++;
}
if (i == 0) {
Congratulation.play();
if ((!isResultWnd) and (0 < Number(Score))) {
ShowResultWnd(Number(Score));
}
var b = eval (CheckedBall);
if (b) {
b.gotoAndStop("Stand");
}
ShowTime = false;
}
return(undefined);
}
var color = (random(NumColors) + 1);
var k = FreeK[random(n)];
var r = Math.floor(k / NumCol);
var c = (k - (r * NumCol));
NumOjects++;
var name = ((("Ball" + color) + "_") + NumOjects);
var Ball = eval ("Ball" + color);
Ball.duplicateMovieClip(name, NumOjects);
var NewBall = eval (name);
NewBall._x = Left + (c * CellWidth);
NewBall._y = Top + ((r - 0.05) * CellHeight);
NewBall.gotoAndPlay(1);
Board[k] = color;
Names[k] = name;
BallsK[i] = k;
i++;
}
var i = 0;
while (i < Num) {
ClearLines(BallsK[i]);
i++;
}
TimeLastNew = getTimer();
}
function CreateParh() {
var k = 0;
var lk = (NumCol + 3);
var r = 0;
while (r < NumRow) {
var c = 0;
while (c < NumCol) {
if (0 < Board[k++]) {
Dist[lk++] = -1;
} else {
Dist[lk++] = 0;
}
c++;
}
lk = lk + 2;
r++;
}
var K1 = GetLargeK(StartK);
var K2 = GetLargeK(FinishK);
Dist[K1] = 0;
Dist[K2] = 1;
var NumCol2 = (NumCol + 2);
var Depth = 2;
var Path = new Array(0);
Path.push(K2);
Loop = true;
while (Loop) {
len = Path.length;
var i = 0;
while (i < len) {
var k = Path[0];
if (Dist[k - 1] == 0) {
if ((k - 1) == K1) {
Moving = true;
return(undefined);
}
Dist[k - 1] = Depth;
Path.push(k - 1);
}
if (Dist[k - NumCol2] == 0) {
if ((k - NumCol2) == K1) {
Moving = true;
return(undefined);
}
Dist[k - NumCol2] = Depth;
Path.push(k - NumCol2);
}
if (Dist[k + 1] == 0) {
if ((k + 1) == K1) {
Moving = true;
return(undefined);
}
Dist[k + 1] = Depth;
Path.push(k + 1);
}
if (Dist[k + NumCol2] == 0) {
if ((k + NumCol2) == K1) {
Moving = true;
return(undefined);
}
Dist[k + NumCol2] = Depth;
Path.push(k + NumCol2);
}
Path.shift();
i++;
}
if (Path.length == 0) {
Moving = false;
return(undefined);
}
Depth++;
}
}
function gotoNextCell(k) {
var Kmin = FinishK;
var Min = 1000000;
if ((onBoard(k, -1, 0) and (0 < Dist[GetLargeK(k - 1)])) and (Dist[GetLargeK(k - 1)] < Min)) {
Kmin = k - 1;
Min = Dist[GetLargeK(k - 1)];
}
if ((onBoard(k, 0, -1) and (0 < Dist[GetLargeK(k - NumCol)])) and (Dist[GetLargeK(k - NumCol)] < Min)) {
Kmin = k - NumCol;
Min = Dist[GetLargeK(k - NumCol)];
}
if ((onBoard(k, 1, 0) and (0 < Dist[GetLargeK(k + 1)])) and (Dist[GetLargeK(k + 1)] < Min)) {
Kmin = k + 1;
Min = Dist[GetLargeK(k + 1)];
}
if ((onBoard(k, 0, 1) and (0 < Dist[GetLargeK(k + NumCol)])) and (Dist[GetLargeK(k + NumCol)] < Min)) {
Kmin = k + NumCol;
Min = Dist[GetLargeK(k + NumCol)];
}
Board[Kmin] = Board[k];
Board[k] = 0;
Names[Kmin] = Names[k];
Names[k] = "";
StartK = Kmin;
var r = Math.floor(StartK / NumCol);
var c = (StartK - (r * NumCol));
var b = eval (CheckedBall);
b._x = Left + (c * CellWidth);
b._y = Top + ((r - 0.05) * CellHeight);
if (Kmin == FinishK) {
Moving = false;
if (ClearLines(FinishK) == 0) {
AddNew = true;
}
TimeLastNew = getTimer();
}
return(Kmin);
}
function ClearLines(k) {
var r = Math.floor(k / NumCol);
var c = (k - (r * NumCol));
var color = Board[k];
if (0 >= color) {
return(0);
}
DelK[0] = k;
totN = 0;
var n = 1;
var i = (c + 1);
while (i < NumCol) {
if (Board[i + (r * NumCol)] == color) {
DelK[n] = i + (r * NumCol);
n++;
} else {
i = NumCol;
}
i++;
}
var i = (c - 1);
while (i >= 0) {
if (Board[i + (r * NumCol)] == color) {
DelK[n] = i + (r * NumCol);
n++;
} else {
i = -1;
}
i--;
}
if (n >= DelNum) {
DelBalls(1, n);
}
var n = 1;
var j = (r + 1);
while (j < NumRow) {
if (Board[c + (j * NumCol)] == color) {
DelK[n] = c + (j * NumCol);
n++;
} else {
j = NumRow;
}
j++;
}
var j = (r - 1);
while (j >= 0) {
if (Board[c + (j * NumCol)] == color) {
DelK[n] = c + (j * NumCol);
n++;
} else {
j = -1;
}
j--;
}
if (n >= DelNum) {
DelBalls(1, n);
}
var n = 1;
var i = 1;
while (i < NumCol) {
var ci = (c + i);
var ri = (r - i);
if (((ci < NumCol) and (ri >= 0)) and (Board[ci + (ri * NumCol)] == color)) {
DelK[n] = ci + (ri * NumCol);
n++;
} else {
i = NumCol;
}
i++;
}
var i = 1;
while (i < NumCol) {
var ci = (c - i);
var ri = (r + i);
if (((ci >= 0) and (ri < NumRow)) and (Board[ci + (ri * NumCol)] == color)) {
DelK[n] = ci + (ri * NumCol);
n++;
} else {
i = NumCol;
}
i++;
}
if (n >= DelNum) {
DelBalls(1, n);
}
var n = 1;
var i = 1;
while (i < NumCol) {
var ci = (c - i);
var ri = (r - i);
if (((ci >= 0) and (ri >= 0)) and (Board[ci + (ri * NumCol)] == color)) {
DelK[n] = ci + (ri * NumCol);
n++;
} else {
i = NumCol;
}
i++;
}
var i = 1;
while (i < NumCol) {
var ci = (c + i);
var ri = (r + i);
if (((ci < NumCol) and (ri < NumRow)) and (Board[ci + (ri * NumCol)] == color)) {
DelK[n] = ci + (ri * NumCol);
n++;
} else {
i = NumCol;
}
i++;
}
if (n >= DelNum) {
DelBalls(1, n);
}
if (0 < totN) {
var Mult = 1;
if (checkLevel.checkLevel2._visible) {
Mult = 10;
}
if (checkLevel.checkLevel3._visible) {
Mult = 100;
}
Score = Number(Score) + (((2 * ((totN - DelNum) + 1)) - 1) * Mult);
DelBalls(0, 1);
}
return(totN);
}
function DelBalls(i0, n) {
var i = i0;
while (i < n) {
var b = eval (Names[DelK[i]]);
b.gotoAndPlay("Die");
if (CheckedBall == Names[DelK[i]]) {
CheckedBall = "";
}
Names[DelK[i]] = "";
Board[DelK[i]] = 0;
i++;
}
totN = totN + n;
}
function onBoard(k, dx, dy) {
var r = Math.floor(k / NumCol);
var c = (k - (r * NumCol));
if ((c == 0) and (dx < 0)) {
return(false);
}
if ((c == (NumCol - 1)) and (0 < dx)) {
return(false);
}
if ((r == 0) and (dy < 0)) {
return(false);
}
if ((r == (NumRow - 1)) and (0 < dy)) {
return(false);
}
return(true);
}
function GetK(x, y) {
var c = Math.floor(((x - Left) / CellWidth) + 0.5);
var r = Math.floor(((y - Top) / CellHeight) + 0.5);
return(c + (r * NumCol));
}
function GetLargeK(k) {
var r = Math.floor(k / NumCol);
var c = (k - (r * NumCol));
return((c + 1) + ((r + 1) * (NumCol + 2)));
}
function ShowResultWnd(ScoreVal) {
attachMovie("ResultWnd", "ResultWndUp", 1000000);
ResultWndUp._x = BoardForCells._x;
ResultWndUp._y = BoardForCells._y;
ResultWndUp.stScore = ScoreVal;
GameOver = true;
}
function HideResultWnd() {
removeMovieClip("ResultWndUp");
}
function ShowBoard(i) {
var st = "";
if (i == 1) {
var k = 0;
while (k < NumCells) {
st = (st + Board[k]) + "\t";
if ((k - (Math.floor(k / NumCol) * NumCol)) == (NumCol - 1)) {
trace(st);
st = "";
}
k++;
}
}
if (i == 2) {
var k = 0;
while (k < (((NumCells + (2 * NumRow)) + (2 * NumCol)) + 4)) {
st = (st + Dist[k]) + "\t";
if ((k - (Math.floor(k / (NumCol + 2)) * (NumCol + 2))) == (NumCol + 1)) {
trace(st);
st = "";
}
k++;
}
}
trace(st);
}
function Crypto(st) {
var sum1 = 0;
var sum2 = 0;
var i = 0;
while (i < st.length) {
sum1 = sum1 + st.charCodeAt(i);
sum2 = sum2 + (st.charCodeAt(i) ^ 175);
i++;
}
sum1 = sum1 % 256;
sum2 = sum2 % 256;
st = (String.fromCharCode(sum1) + String.fromCharCode(sum2)) + st;
var cryptSt = "";
var b0 = 193;
var i = 0;
while (i < st.length) {
var b = st.charCodeAt(i);
var CryptB = (b ^ b0);
CryptB = CryptB.toString();
var len = CryptB.length;
var j = 0;
while (j < (3 - len)) {
CryptB = "0" + CryptB;
j++;
}
cryptSt = cryptSt + CryptB;
b0 = b;
i++;
}
return(cryptSt);
}
if (!initialized) {
initialized = true;
} else {
return(undefined);
}
fscommand ("showmenu", false);
isDynamic._visible = false;
checkLevel.checkLevel1._visible = false;
checkLevel.checkLevel3._visible = false;
MaxNumColors = 7;
MaxNumCells = 100;
NumCells = 0;
TimeNewDelay = 5000;
Board = new Array(MaxNumCells);
Dist = new Array(MaxNumCells);
FreeK = new Array(MaxNumCells);
DelK = new Array(MaxNumCells);
Names = new Array(MaxNumCells);
PanelNames = new Array(MaxNumCells);
BallsK = new Array(10);
PlayerName = "";
NumOjects = 0;
Init();
Instance of Symbol 55 MovieClip "Ball1" in Frame 3
onClipEvent (mouseDown) {
if ((!hitTest(_root._xmouse, _root._ymouse, false)) or _root.Moving) {
return(undefined);
}
if (_root.CheckedBall == _name) {
return(undefined);
}
if (4 < _currentframe) {
return(undefined);
}
var b = eval ("_root." + _root.CheckedBall);
if (b) {
b.gotoAndStop("Stand");
}
_root.CheckedBall = _name;
_root.StartK = _root.GetK(_root._xmouse, _root._ymouse);
play();
}
Instance of Symbol 56 MovieClip "Ball2" in Frame 3
onClipEvent (mouseDown) {
if ((!hitTest(_root._xmouse, _root._ymouse, false)) or _root.Moving) {
return(undefined);
}
if (_root.CheckedBall == _name) {
return(undefined);
}
if (4 < _currentframe) {
return(undefined);
}
var b = eval ("_root." + _root.CheckedBall);
if (b) {
b.gotoAndStop("Stand");
}
_root.CheckedBall = _name;
_root.StartK = _root.GetK(_root._xmouse, _root._ymouse);
play();
}
Instance of Symbol 57 MovieClip "Ball3" in Frame 3
onClipEvent (mouseDown) {
if ((!hitTest(_root._xmouse, _root._ymouse, false)) or _root.Moving) {
return(undefined);
}
if (_root.CheckedBall == _name) {
return(undefined);
}
if (4 < _currentframe) {
return(undefined);
}
var b = eval ("_root." + _root.CheckedBall);
if (b) {
b.gotoAndStop("Stand");
}
_root.CheckedBall = _name;
_root.StartK = _root.GetK(_root._xmouse, _root._ymouse);
play();
}
Instance of Symbol 71 MovieClip "Ball4" in Frame 3
onClipEvent (mouseDown) {
if ((!hitTest(_root._xmouse, _root._ymouse, false)) or _root.Moving) {
return(undefined);
}
if (_root.CheckedBall == _name) {
return(undefined);
}
if (4 < _currentframe) {
return(undefined);
}
var b = eval ("_root." + _root.CheckedBall);
if (b) {
b.gotoAndStop("Stand");
}
_root.CheckedBall = _name;
_root.StartK = _root.GetK(_root._xmouse, _root._ymouse);
play();
}
Instance of Symbol 95 MovieClip "Ball7" in Frame 3
onClipEvent (mouseDown) {
if ((!hitTest(_root._xmouse, _root._ymouse, false)) or _root.Moving) {
return(undefined);
}
if (_root.CheckedBall == _name) {
return(undefined);
}
if (4 < _currentframe) {
return(undefined);
}
var b = eval ("_root." + _root.CheckedBall);
if (b) {
b.gotoAndStop("Stand");
}
_root.CheckedBall = _name;
_root.StartK = _root.GetK(_root._xmouse, _root._ymouse);
play();
}
Instance of Symbol 99 MovieClip "Panel" in Frame 3
onClipEvent (mouseDown) {
if ((!hitTest(_root._xmouse, _root._ymouse, false)) or _root.Moving) {
return(undefined);
}
_root.FinishK = _root.GetK(_root._xmouse, _root._ymouse);
if ((_root.Board[_root.FinishK] == 0) and (_root.CheckedBall != "")) {
_root.CreateParh();
}
}
Instance of Symbol 115 MovieClip "Ball6" in Frame 3
onClipEvent (mouseDown) {
if ((!hitTest(_root._xmouse, _root._ymouse, false)) or _root.Moving) {
return(undefined);
}
if (_root.CheckedBall == _name) {
return(undefined);
}
if (4 < _currentframe) {
return(undefined);
}
var b = eval ("_root." + _root.CheckedBall);
if (b) {
b.gotoAndStop("Stand");
}
_root.CheckedBall = _name;
_root.StartK = _root.GetK(_root._xmouse, _root._ymouse);
play();
}
Instance of Symbol 122 MovieClip "Ball5" in Frame 3
onClipEvent (mouseDown) {
if ((!hitTest(_root._xmouse, _root._ymouse, false)) or _root.Moving) {
return(undefined);
}
if (_root.CheckedBall == _name) {
return(undefined);
}
if (4 < _currentframe) {
return(undefined);
}
var b = eval ("_root." + _root.CheckedBall);
if (b) {
b.gotoAndStop("Stand");
}
_root.CheckedBall = _name;
_root.StartK = _root.GetK(_root._xmouse, _root._ymouse);
play();
}
Frame 5
if (AddNew and (!Moving)) {
AddNewBalls(AddNum);
AddNew = false;
TimeLastNew = (TimeLast = getTimer());
}
if (Moving) {
gotoNextCell(StartK);
}
if ((1000 < (getTimer() - TimeLast)) and (!Moving)) {
var n = 0;
var k = 0;
while (k < NumCells) {
if (0 < Board[k]) {
n++;
}
k++;
}
if (n == 0) {
AddNewBalls(AddNum);
Score = Number(Score) + 100;
} else if (n == NumCells) {
if ((!isResultWnd) and (0 < Number(Score))) {
ShowResultWnd(Number(Score));
}
Congratulation.play();
var b = eval (CheckedBall);
if (b) {
b.gotoAndStop("Stand");
}
ShowTime = false;
}
TimeLast = getTimer();
}
if (((TimeNewDelay < (getTimer() - TimeLastNew)) and (!Moving)) and isDynamic._visible) {
TimeNewDelay = 5000 - ((3000 * Number(Score)) / 100);
if (TimeNewDelay < 2000) {
TimeNewDelay = 2000;
}
AddNewBalls(1);
TimeLastNew = getTimer();
}
prevFrame();
play();
Symbol 6 Button
on (release) {
var Level = 1;
if (_root.checkLevel.checkLevel2._visible) {
Level = 2;
}
if (_root.checkLevel.checkLevel3._visible) {
Level = 3;
}
var stSend = ((((((((Number(_root.Score) + "\t") + Level) + "\t") + stName) + "\t") + "dln") + "\t") + "out");
getURL ("http://absolutist.com/cgi-bin/gameres.pl?e=" + _root.Crypto(stSend), "_top");
_root.isResultWnd = false;
_root.PlayerName = stName;
_root.Init();
removeMovieClip("");
}
Symbol 9 Button
on (release) {
_root.isResultWnd = false;
_root.Init();
removeMovieClip("");
}
Symbol 22 MovieClip Frame 4
stop();
Symbol 22 MovieClip Frame 8
gotoAndPlay (5);
Symbol 22 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 29 MovieClip Frame 4
stop();
Symbol 29 MovieClip Frame 8
gotoAndPlay (5);
Symbol 29 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 36 MovieClip Frame 4
stop();
Symbol 36 MovieClip Frame 8
gotoAndPlay (5);
Symbol 36 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 43 MovieClip Frame 4
stop();
Symbol 43 MovieClip Frame 8
gotoAndPlay (5);
Symbol 43 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 44 MovieClip [ResultWnd] Frame 1
_root.isResultWnd = true;
stName = _root.PlayerName;
b1.gotoAndPlay("Jump");
b2.gotoAndPlay("Jump");
b3.gotoAndPlay("Jump");
b4.gotoAndPlay("Jump");
Symbol 55 MovieClip Frame 4
stop();
Symbol 55 MovieClip Frame 8
gotoAndPlay (5);
Symbol 55 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 56 MovieClip Frame 4
stop();
Symbol 56 MovieClip Frame 8
gotoAndPlay (5);
Symbol 56 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 57 MovieClip Frame 4
stop();
Symbol 57 MovieClip Frame 8
gotoAndPlay (5);
Symbol 57 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 64 Button
on (release) {
Init();
}
Symbol 71 MovieClip Frame 4
stop();
Symbol 71 MovieClip Frame 8
gotoAndPlay (5);
Symbol 71 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 80 Button
on (release) {
getURL ("http://absolutist.com", "_self");
}
Symbol 85 MovieClip Frame 23
stop();
Symbol 89 Button
on (release) {
_root.isDynamic._visible = !_root.isDynamic._visible;
}
Symbol 95 MovieClip Frame 4
stop();
Symbol 95 MovieClip Frame 8
gotoAndPlay (5);
Symbol 95 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 109 Button
on (release) {
checkLevel1._visible = true;
checkLevel2._visible = false;
checkLevel3._visible = false;
_root.init();
}
Symbol 110 Button
on (release) {
checkLevel1._visible = false;
checkLevel2._visible = true;
checkLevel3._visible = false;
_root.init();
}
Symbol 111 Button
on (release) {
checkLevel1._visible = false;
checkLevel2._visible = false;
checkLevel3._visible = true;
_root.init();
}
Symbol 115 MovieClip Frame 4
stop();
Symbol 115 MovieClip Frame 8
gotoAndPlay (5);
Symbol 115 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 122 MovieClip Frame 4
stop();
Symbol 122 MovieClip Frame 8
gotoAndPlay (5);
Symbol 122 MovieClip Frame 14
removeMovieClip("");
stop();
Symbol 126 Button
on (release) {
getURL ("http://absolutist.com/games.html", "_blank");
}