Frame 1
fscommand ("showmenu", false);
_root.best = 0;
_root.sunet = 1;
stop();
logo.onEnterFrame = function () {
if (_root.getBytesLoaded() == _root.getBytesTotal()) {
this.play();
} else {
tgFrame = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
this.progress.gotoAndStop(tgFrame);
}
};
Frame 2
stop();
delete this.onEnterFrame;
i = 1;
while (i <= 20) {
j = 1;
while (j <= 16) {
removeMovieClip(_root[(("sq" + i) + "_") + j]);
j++;
}
i++;
}
i = 1000;
while (i <= 1016) {
removeMovieClip(_root["sqq" + i]);
i++;
}
son1 = new Sound();
son1.attachSound("shot1");
son1.setVolume(80);
Frame 3
mat1 = new Array();
aux = new Array();
i = 1;
while (i <= 21) {
mat1[i] = new Array();
i++;
}
this.matInit = function () {
mat = new Array();
i = 1;
while (i <= 21) {
mat[i] = new Array();
i++;
}
i = 1;
while (i <= 20) {
j = 1;
while (j <= 16) {
mat[i][j] = 0;
j++;
}
i++;
}
j = 1;
while (j <= 16) {
mat[21][j] = 7;
j++;
}
i = 17;
while (i <= 20) {
j = 1;
while (j <= 16) {
mat[i][j] = random(4) + 1;
j++;
}
i++;
}
};
this.matToElim = function (lin, col, val) {
if (toElim < 3) {
if (mat1[lin + 1][col] == val) {
mat1[lin][col] = 5;
matToElim(lin + 1, col, val);
}
if (mat1[lin - 1][col] == val) {
mat1[lin][col] = 5;
matToElim(lin - 1, col, val);
}
if (mat1[lin][col + 1] == val) {
mat1[lin][col] = 5;
matToElim(lin, col + 1, val);
}
if (mat1[lin][col - 1] == val) {
mat1[lin][col] = 5;
matToElim(lin, col - 1, val);
}
mat1[lin][col] = 0;
toElim++;
}
return(undefined);
};
this.matFlood = function (lin, col, val) {
if (mat[lin + 1][col] == val) {
mat[lin][col] = 5;
matFlood(lin + 1, col, val);
}
if (mat[lin - 1][col] == val) {
mat[lin][col] = 5;
matFlood(lin - 1, col, val);
}
if (mat[lin][col + 1] == val) {
mat[lin][col] = 5;
matFlood(lin, col + 1, val);
}
if (mat[lin][col - 1] == val) {
mat[lin][col] = 5;
matFlood(lin, col - 1, val);
}
mat[lin][col] = 0;
return(undefined);
};
this.matDraw = function () {
i = 1;
while (i <= 20) {
j = 1;
while (j <= 16) {
removeMovieClip(_root[(("sq" + i) + "_") + j]);
j++;
}
i++;
}
k = 1;
i = 1;
while (i <= 20) {
j = 1;
while (j <= 16) {
if (mat[i][j] != 0) {
_root["sq" + mat[i][j]].duplicateMovieClip((("sq" + i) + "_") + j, k);
k++;
_root[(("sq" + i) + "_") + j]._y = (i * 20) + 10;
_root[(("sq" + i) + "_") + j]._x = (j * 20) + 20;
}
j++;
}
i++;
}
};
matElim = function () {
i = 1;
while (i <= 20) {
j = 1;
while (j <= 16) {
if (mat[i][j] == 0) {
k = i;
while (k >= 2) {
mat[k][j] = mat[k - 1][j];
k--;
}
}
j++;
}
i++;
}
j = 1;
while (j <= 16) {
if (mat[20][j] == 0) {
i = 1;
while (i <= 20) {
q = j;
while (q <= 15) {
mat[i][q] = mat[i][q + 1];
q++;
}
i++;
}
w = 1;
while (w <= 20) {
mat[w][16] = 0;
w++;
}
}
j++;
}
};
time1 = getTimer();
k1 = 1000;
this.onEnterFrame = function () {
if (_root.score > _root.best) {
_root.best = _root.score;
_root.bestSc.text = _root.best;
}
if (gOv == 0) {
if ((getTimer() - time1) >= 150) {
i = 1;
while (i <= 16) {
if (mat[1][i] != 0) {
_root.gOver.play();
}
i++;
}
time1 = getTimer();
ran = random(4) + 1;
_root["sqx" + ran].duplicateMovieClip("sqq" + k1, k1);
_root["sqq" + k1]._y = 435;
_root["sqq" + k1]._x = ((k1 - 1000) * 20) + 40;
aux[k1] = ran;
k1++;
if (k1 > 1016) {
i = 1;
while (i <= 19) {
j = 1;
while (j <= 16) {
mat[i][j] = mat[i + 1][j];
j++;
}
i++;
}
i = 1;
while (i <= 16) {
mat[20][i] = aux[i + 999];
i++;
}
matDraw();
i = 1000;
while (i <= 1016) {
removeMovieClip(_root["sqq" + i]);
i++;
}
k1 = 1000;
}
}
}
};
stop();
gOv = 0;
_root.score = 0;
_root.bestSc.text = _root.best;
matInit();
matDraw();
generateLine();
gOver1.duplicateMovieClip("gOver", 1100);
_root.gOver._x = 190;
_root.gOver._y = 190;
Symbol 12 MovieClip Frame 1
stop();
Symbol 16 MovieClip Frame 63
stop();
Symbol 16 MovieClip Frame 272
_root.gotoAndStop(2);
Symbol 23 Button
on (release) {
_root.gotoAndStop(3);
}
Symbol 27 Button
on (release) {
if (_root.sunet == 0) {
_root.sunet = 1;
_root.son.start(0, 100);
} else {
_root.sunet = 0;
_root.son.stop();
}
}
Symbol 37 MovieClip Frame 1
this.onPress = function () {
if (_root.gOv == 0) {
posi = (this._y - 10) / 20;
posj = (this._x - 20) / 20;
_root.toElim = 0;
i = 1;
while (i <= 21) {
j = 1;
while (j <= 16) {
_root.mat1[i][j] = _root.mat[i][j];
j++;
}
i++;
}
_root.matToElim(posi, posj, _root.mat[posi][posj]);
if (_root.toElim >= 3) {
if (_root.sunet == 1) {
_root.son1.start();
}
_root.score = _root.score + (_root.toElim * (10 + (_root.toElim * 2)));
_root.scor.text = _root.score;
_root.matFlood(posi, posj, _root.mat[posi][posj]);
_root.matElim();
_root.matDraw();
} else if (_root.score > 30) {
_root.score = _root.score - 30;
_root.scor.text = _root.score;
}
}
};
Symbol 40 MovieClip Frame 1
this.onPress = function () {
if (_root.gOv == 0) {
posi = (this._y - 10) / 20;
posj = (this._x - 20) / 20;
_root.toElim = 0;
i = 1;
while (i <= 20) {
j = 1;
while (j <= 16) {
_root.mat1[i][j] = _root.mat[i][j];
j++;
}
i++;
}
_root.matToElim(posi, posj, _root.mat[posi][posj]);
if (_root.toElim >= 3) {
if (_root.sunet == 1) {
_root.son1.start();
}
_root.score = _root.score + (_root.toElim * (10 + (_root.toElim * 2)));
_root.scor.text = _root.score;
_root.matFlood(posi, posj, _root.mat[posi][posj]);
_root.matElim();
_root.matDraw();
} else if (_root.score > 30) {
_root.score = _root.score - 30;
_root.scor.text = _root.score;
}
}
};
Symbol 43 MovieClip Frame 1
this.onPress = function () {
if (_root.gOv == 0) {
posi = (this._y - 10) / 20;
posj = (this._x - 20) / 20;
_root.toElim = 0;
i = 1;
while (i <= 20) {
j = 1;
while (j <= 16) {
_root.mat1[i][j] = _root.mat[i][j];
j++;
}
i++;
}
_root.matToElim(posi, posj, _root.mat[posi][posj]);
if (_root.toElim >= 3) {
if (_root.sunet == 1) {
_root.son1.start();
}
_root.score = _root.score + (_root.toElim * (10 + (_root.toElim * 2)));
_root.scor.text = _root.score;
_root.matFlood(posi, posj, _root.mat[posi][posj]);
_root.matElim();
_root.matDraw();
} else if (_root.score > 30) {
_root.score = _root.score - 30;
_root.scor.text = _root.score;
}
}
};
Symbol 46 MovieClip Frame 1
this.onPress = function () {
if (_root.gOv == 0) {
posi = (this._y - 10) / 20;
posj = (this._x - 20) / 20;
_root.toElim = 0;
i = 1;
while (i <= 20) {
j = 1;
while (j <= 16) {
_root.mat1[i][j] = _root.mat[i][j];
j++;
}
i++;
}
_root.matToElim(posi, posj, _root.mat[posi][posj]);
if (_root.toElim >= 3) {
if (_root.sunet == 1) {
_root.son1.start();
}
_root.score = _root.score + (_root.toElim * (10 + (_root.toElim * 2)));
_root.scor.text = _root.score;
_root.matFlood(posi, posj, _root.mat[posi][posj]);
_root.matElim();
_root.matDraw();
} else if (_root.score > 30) {
_root.score = _root.score - 30;
_root.scor.text = _root.score;
}
}
};
Symbol 67 Button
on (release) {
_root.gOver1.gotoAndStop(1);
removeMovieClip(_root.gOver);
_root.gotoAndStop(2);
}
Symbol 68 MovieClip Frame 1
stop();
Symbol 68 MovieClip Frame 2
_root.gOv = 1;
Symbol 68 MovieClip Frame 55
stop();
Symbol 70 Button
on (release) {
_root.gotoAndStop(2);
}
Symbol 72 Button
on (release) {
if (_root.gOv == 0) {
_root.gOv = 1;
} else {
_root.gOv = 0;
}
}