Frame 1
function ScoreBoardFunc(Read) {
var _local1 = SharedObject.getLocal("tileGameScore");
if (Read) {
bestScore = _local1.data.score + 0;
bestLevel = _local1.data.level + 0;
topScores = ((("YOUR BEST SCORE : " + bestScore) + " HIGHEST LEVEL FINISHED : ") + bestLevel) + " OF 3";
} else {
var temp_bestScore = _local1.data.score;
var _local2 = _local1.data.level;
var _local3 = false;
if (Score > 0) {
if (Score > temp_bestScore) {
_local1.data.score = Score;
attachMovie("NewBestScore", "NewBestScore", 433);
_local3 = true;
}
if (Level > _local2) {
_local1.data.level = Level;
attachMovie("NewBestLevel", "NewBestLevel", 434);
_local3 = true;
}
}
if (_local3) {
var scoreStatus = _local1.flush();
if (scoreStatus != true) {
attachMovie("scoreError", "", 445, {Score:Score, Level:Level});
}
ScoreBoardFunc(true);
}
}
}
function clearGame() {
depthCount = 200;
BG._visible = false;
ID = 0;
IDMax = totalcols * totalrows;
while (ID <= IDMax) {
this["P" + ID].removeMovieClip("");
ID++;
g[c][tr] = {ID:ID, P:tileGiveAway.pop(), S:2, D:0};
}
g = new Array();
tg = new Array();
}
function generateNewBoard() {
var tileCount = (totalcols * totalrows);
tileCount = tileCount * 2;
var numOfEachTile = (tileCount / totalTiles);
tileGiveAway = new Array();
var _local2 = 1;
while (_local2 <= tileCount) {
var _local3 = Math.ceil(_local2 / numOfEachTile);
tileGiveAway.push(_local3);
var randomNum = Math.round(Math.random() * (_local2 - 1));
tileGiveAway[_local2 - 1] = tileGiveAway[randomNum];
tileGiveAway[randomNum] = _local3;
_local2++;
}
g = new Array(totalcols);
tg = new Array(totalcols);
kg = new Array();
queuedChecks = new Array();
deadDropCount = 0;
var _local1 = 0;
while (_local1 < totalcols) {
g[_local1] = new Array(totalrows);
tg[_local1] = new Array(totalrows);
_local1++;
}
jk = 400;
ID = 0;
IDMax = totalcols * totalrows;
while (ID < IDMax) {
ID++;
c = (ID - 1) % totalcols;
r = Math.ceil(ID / totalcols);
var tr = (totalrows - r);
depth = (c * totalrows) + r;
attachMovie("tilePile", "P" + ID, depth, {c:c, r:tr, ID:ID});
this["P" + ID]._x = (c * tilewidth) + tilewidth;
this["P" + ID]._y = r * tileheight;
this["P" + ID]._visible = false;
g[c][tr] = {ID:ID, P:tileGiveAway.pop(), S:2, D:0};
}
appearInWave();
}
function appearInWave() {
var _local2 = this;
appear = 0;
disableMouse(true);
onEnterFrame = function () {
var _local2 = this;
if (appear <= (totalcols + totalrows)) {
var _local1 = appear;
while (_local1 >= 0) {
_local2["P" + g[_local1][totalrows - (appear - _local1)].ID]._visible = true;
_local1--;
}
appear++;
} else {
disableMouse(false);
BG._visible = true;
delete onEnterFrame;
}
};
}
function disableMouse(Disabled) {
if (Disabled) {
attachMovie("bgButton", "bgButton", 410);
bgButton.stop();
} else {
bgButton.play();
}
}
function playSounds(num) {
if (playSound._currentframe == 1) {
playSound.gotoAndStop(num);
playSound.onEnterFrame = function () {
this.gotoAndStop(1);
delete this.onEnterFrame;
};
}
}
function emptyCheckTable() {
queuedChecks = new Array();
kg = new Array();
var _local2 = 0;
while (_local2 < totalcols) {
var _local1 = 0;
while (_local1 < totalrows) {
tg[_local2][_local1] = 0;
_local1++;
}
_local2++;
}
}
function addScore(num) {
Score = Score + (num * 10);
theLastScore = theLastScore + (((((theLastScore != "") ? ", " : "") + (num * 10)) + ((Combo > 1) ? (" x " + Combo) : "")) + "");
scoreBoard.lastScore = theLastScore;
scoreBoard.gotoAndPlay(1);
}
function playComboAnim(C, X, Y) {
depthCount++;
thisAnim = attachMovie("ComboNotice", "ComboNotice" + depthCount, depthCount);
thisAnim._x = X;
thisAnim._y = Y;
thisAnim.ID = depthCount;
thisAnim.Combo = "x" + (C - 1);
}
function checkMovesLeft() {
currentShiner.removeMovieClip("");
var _local2 = 0;
var currentCols = g.length;
if (((currentCols == 0) && (g[0].length > 0)) || (currentCols > 0)) {
while (_local2 < currentCols) {
var _local3 = g[_local2].length;
var _local1 = 0;
while (_local1 < _local3) {
if (((g[_local2][_local1].P > 0) && (g[_local2][_local1].P == g[_local2][_local1 + 1].P)) || (g[_local2][_local1].P == g[_local2 + 1][_local1].P)) {
this["P" + g[_local2][_local1].ID].Tile.attachMovie("Sparkle", "Sparkle", 1);
endDeadMode();
return(true);
}
_local1++;
}
_local2++;
}
startDeadMode();
} else {
addScore(100);
gotoAndPlay ("nextLevel");
}
return(false);
}
function startBombMode() {
if (Bombs > 1) {
attachMovie("bombFollower", "bombFollower", 180);
Bombing = true;
}
}
function endBombMode() {
if (!Dead) {
bombFollower.removeMovieClip("");
Bombing = false;
}
}
function startDeadMode() {
Dead = true;
if (Bombs > 1) {
startBombMode();
} else {
ScoreBoardFunc(false);
attachMovie("noMovesLeft", "noMovesLeft", 300);
}
}
function endDeadMode() {
Dead = false;
endBombMode();
noMovesLeft.removeMovieClip("");
}
function madeline(mlc, mlr) {
var _local1 = mlc;
if (typeof(_local1) == "object") {
linesArray = new Array();
var comboP = 0;
for (Index in _local1) {
var tc = _local1[Index].c;
var tr = _local1[Index].r;
var tUp = _local1[Index].Up;
var _local2 = _local1[Index].dirs;
var P = g[tc][tr].P;
if (P > 0) {
var c1 = ((g[tc - 1][tr].P == P) * _local2[0]);
var c2 = ((g[tc + 1][tr].P == P) * _local2[1]);
var c3 = ((g[tc][tr - 1].P == P) * _local2[2]);
if ((c1 || (c2)) || (c3)) {
if (comboP != P) {
Combo++;
comboP = P;
var _local3 = this["P" + g[tc][tr].ID];
playComboAnim(Combo, _local3._x, _local3._y);
}
linesArray.push({c:tc, r:tr});
}
}
}
if (linesArray.length > 0) {
playSounds(2);
emptyCheckTable();
for (Index in linesArray) {
var tc = linesArray[Index].c;
var tr = linesArray[Index].r;
killConnectedLinks(tc, tr);
addScore(currentScore);
currentScore = 0;
}
disableMouse(true);
if (kg.length > 0) {
maxDrop = waitForDrop;
onEnterFrame = function () {
maxDrop--;
if (maxDrop < 2) {
disableMouse(false);
delete onEnterFrame;
dropDownDead();
}
};
} else {
endTurn();
}
return(true);
}
return(false);
}
theLastScore = "";
Combo = 1;
_local1 = int(_local1);
mlr = int(mlr);
mla = g[_local1][mlr];
var P = mla.P;
var c1 = (g[_local1 - 1][mlr].P == P);
var c2 = (g[_local1 + 1][mlr].P == P);
var c3 = (g[_local1][mlr + 1].P == P);
var c4 = (g[_local1][mlr - 1].P == P);
if (((c1 || (c2)) || (c3)) || (c4)) {
playSounds(2);
killConnected(_local1, mlr);
addScore(currentScore);
currentScore = 0;
return(true);
}
endTurn();
return(false);
}
function checkLine() {
mlc = int(mlc);
mlr = int(mlr);
mla = g[mlc][mlr];
var _local1 = mla.P;
var c1 = (g[mlc - 1][mlr].P == _local1);
var c2 = (g[mlc + 1][mlr].P == _local1);
var _local3 = g[mlc][mlr + 1].P == _local1;
var _local2 = g[mlc][mlr - 1].P == _local1;
if (((c1 || (c2)) || (_local3)) || (_local2)) {
return(true);
}
return(false);
}
function endTurn() {
if (Combo == 2) {
Bombs++;
} else if (Combo > 5) {
Bombs = Bombs + 4;
} else if (Combo > 2) {
Bombs = Bombs + 2;
}
emptyCheckTable();
disableMouse(false);
BombIcons.gotoAndStop(Bombs + 1);
theLastScore = "";
checkMovesLeft();
}
function killConnected(kcX, kcY) {
emptyCheckTable();
killConnectedLinks(kcX, kcY);
maxDrop = waitForDrop;
disableMouse(true);
onEnterFrame = function () {
maxDrop--;
if (maxDrop < 2) {
disableMouse(false);
delete onEnterFrame;
dropDownDead();
}
};
}
function forceLine(tc, tr) {
var _local2 = tc;
var _local3 = this;
var _local1 = g[_local2][tr];
Combo = 1;
Bombs = Bombs - 2;
bombIcons.gotoAndStop(Bombs + 1);
playSounds(20);
Dead = false;
endBombMode();
var theP = _local3["P" + g[_local2][tr].ID];
theP.attachMovie("Explode", "Explode", 1);
if (_local1.S == 2) {
currentScore++;
_local1.S--;
_local3["P" + _local1.ID].play();
_local1.P = tileGiveAway.pop();
_local3["P" + _local1.ID].P = _local1.P;
maxDrop = 8;
disableMouse(true);
onEnterFrame = function () {
maxDrop--;
if (maxDrop < 1) {
endTurn();
delete onEnterFrame;
}
};
} else {
emptyCheckTable();
kg = new Array();
kg.push({c:_local2, r:tr});
maxDrop = waitForDrop;
disableMouse(true);
onEnterFrame = function () {
maxDrop--;
if (maxDrop < 2) {
disableMouse(false);
delete onEnterFrame;
dropDownDead();
}
};
}
}
function checkCols() {
var _local1 = g.length - 1;
if (((_local1 == 0) && (g[0].length > 0)) || (_local1 > 0)) {
var _local2 = false;
n = _local1;
while (n >= 0) {
if (g[n].length < 1) {
removeCol(n, g[n - 1].length >= 1);
if (n < _local1) {
_local2 = true;
}
}
n--;
}
if (_local2) {
Bombs++;
bombIcons.gotoAndStop(Bombs + 1);
}
} else {
addScore(100);
gotoAndPlay ("nextLevel");
}
}
function removeCol(col, firstRun) {
var _local1 = col;
var _local2 = this;
tc = g.length - 1;
g.splice(_local1, 1);
if (_local1 < tc) {
playSounds(21);
}
if (firstRun) {
for (row in g[_local1]) {
queuedChecks.push({c:_local1, r:row, up:true, dirs:[1, 0, 0, 0]});
}
}
while (_local1 < tc) {
len = g[_local1].length - 1;
row = len;
while (len >= 0) {
_local2["P" + g[_local1][len].ID].c--;
_local2["P" + g[_local1][len].ID]._x = _local2["P" + g[_local1][len].ID]._x - tilewidth;
len--;
}
_local1++;
}
}
function dropDownDead() {
maxDrop = 0;
kgL = kg.length - 1;
if (kgL >= 0) {
dropCount = 1;
removeThisCol = 0;
var _local1 = new Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
dropDetails = new Object();
spliceIt = new Array();
kg.sortOn("r").reverse();
while (kgL >= 0) {
c = kg[kgL].c;
r = kg[kgL].r;
tr = totalrows - 1;
spliceIt.push({c:c, r:r});
queuedChecks.push({c:c, r:r, up:g[c][r + 1].P != 0, dirs:[g[c - 1][r].P != 0, 1, g[c][r - 1].P != 0, 1]});
_local1[c] = _local1[c] + 1;
debug = "";
if (r != (g[c].length - 1)) {
dropCount++;
}
while (tr > r) {
if (typeof(this["P" + g[c][tr].ID]) == "movieclip") {
debug = debug + (" ," + g[c][tr].ID);
var _local3 = (dropDetails["P" + g[c][tr].ID] = new Object());
var _local2 = this["P" + g[c][tr].ID];
if (maxDrop < (_local1[c] * dropSteps)) {
maxDrop = _local1[c] * dropSteps;
}
if (_local2.P != 0) {
_local3.r = _local2.r - _local1[c];
_local3.count = _local1[c] * dropSteps;
}
}
tr--;
}
kgL--;
}
for (Split in spliceIt) {
g[spliceIt[Split].c].splice(spliceIt[Split].r, 1);
}
if (dropCount > 0) {
droneVol.setVolume(100);
Drone.gotoAndPlay(2);
for (Drop in dropDetails) {
if (typeof(this[Drop]) == "movieclip") {
this[Drop].r = dropDetails[Drop].r;
this[Drop].count = dropDetails[Drop].count;
this[Drop].onEnterFrame = dropPiece;
deadDropCount++;
}
}
maxDrop = maxDrop + 5;
disableMouse(true);
onEnterFrame = function () {
maxDrop--;
if (maxDrop < 1) {
disableMouse(true);
delete onEnterFrame;
checkCols();
Drone.stop();
if (!madeline(queuedChecks)) {
endTurn();
}
} else if (maxDrop == 5) {
droneVol.setVolume(20);
} else if (maxDrop == 4) {
droneVol.setVolume(10);
} else if (maxDrop == 3) {
droneVol.setVolume(1);
}
};
}
} else {
endTurn();
}
}
function dropPiece() {
var _local1 = this;
_local1.Count--;
if (_local1.Count >= 0) {
_local1._y = _local1._y + dropSpeed;
if (_local1.count == 0) {
playSounds(10);
}
} else if (_local1.Count == -3) {
_local1.r = totalrows - Math.floor(_local1._y / tileheight);
delete _local1.onEnterFrame;
}
}
function killConnectedLinks(kclX, kclY) {
var _local1 = kclY;
var _local2 = kclX;
if (tg[_local2][_local1] == 0) {
tg[_local2][_local1] = 1;
var _local3 = g[_local2][_local1];
var S = cp.S;
/:deadCount++;
var cp = _local3.P;
if (_local3.S == 2) {
currentScore++;
_local3.S--;
this["P" + _local3.ID].play();
_local3.P = tileGiveAway.pop();
this["P" + _local3.ID].P = _local3.P;
} else if (_local3.S == 1) {
currentScore = currentScore + 2;
_local3.S--;
_local3.P = 0;
deadCount++;
this["P" + _local3.ID].gotoAndPlay(10);
this["P" + _local3.ID].onEnterFrame = play;
this["P" + _local3.ID]._name = "Dead" + deadCount;
kg.push({c:_local2, r:_local1});
}
}
if ((g[_local2][_local1 + 1].P == cp) && (tg[_local2][_local1 + 1] == 0)) {
killConnectedLinks(_local2, _local1 + 1);
}
if ((g[_local2][_local1 - 1].P == cp) && (tg[_local2][_local1 - 1] == 0)) {
killConnectedLinks(_local2, _local1 - 1);
}
if ((g[_local2 - 1][_local1].P == cp) && (tg[_local2 - 1][_local1] == 0)) {
killConnectedLinks(_local2 - 1, _local1);
}
if ((g[_local2 + 1][_local1].P == cp) && (tg[_local2 + 1][_local1] == 0)) {
killConnectedLinks(_local2 + 1, _local1);
}
}
function killPiece(Piece) {
var _local1 = Piece;
_local1._yscale = _local1._yscale - 10;
_local1._xscale = _local1._xscale - 10;
if (_local1._yscale < 1) {
_local1.removeMovieClip("");
delete _local1.onEnterFrame;
}
}
noBackButton = true;
_quality = "low";
totalcols = 17;
totalrows = 9;
pieceamount = 8;
Active = true;
totalTiles = 8;
totalTiles = 7;
startTiles = totalTiles;
tileheight = 44;
tilewidth = 35;
Distance = 38.5;
Speed = 5.4;
dPM = 5;
deadCount = 0;
dropSteps = 4;
dropSpeed = tileheight / 4;
dropDetails = 1;
maxDrop = 0;
deadCount = 0;
waitForDrop = 9;
droneVol = new Sound(Drone);
depthCount = 200;
startBombs = 8;
Bombs = startBombs;
bombIcons.gotoAndStop(startBombs + 1);
theLastScore = "";
Score = 0;
currentGoScore = 0;
var keyCode = new Object();
Bombing = false;
keyCode.onKeyDown = function () {
if (((Key.getCode() == 32) && (!Bombing)) && (Bombs > 1)) {
startBombMode();
}
};
keyCode.onKeyUp = function () {
if ((Key.getCode() == 32) && (Bombing)) {
endBombMode();
}
};
Frame 2
play();
Frame 4
ScoreBoardFunc(true);
if (Score == 0) {
sendbtn._visible = false;
}
stop();
Frame 9
Fade.gotoAndPlay(60);
stop();
Frame 13
Level = -1;
theLastScore = "";
Score = 0;
totalTiles = startTiles;
Key.addListener(keyCode);
gotoAndStop ("nextLevel");
Bombs = startBombs - 4;
Frame 19
Level++;
totalTiles = startTiles + Level;
endDeadMode();
endBombMode();
Bombs = Bombs + 4;
bombIcons.gotoAndStop(Bombs + 1);
if (Level == 3) {
ScoreBoardFunc(false);
gotoAndStop ("Winner");
}
stop();
Frame 28
generateNewBoard();
stop();
Instance of Symbol 164 MovieClip "BG" in Frame 28
onClipEvent (load) {
_visible = false;
}
Frame 49
Level = 0;
theLastScore = "";
Score = 0;
Frame 50
stop();
Symbol 125 MovieClip Frame 1
stop();
Symbol 126 MovieClip Frame 1
stop();
Symbol 7 Button
on (release) {
removeMovieClip("");
}
Symbol 29 MovieClip [Instructions] Frame 1
BGButton.useHandCursor = false;
Symbol 32 Button
on (release) {
if (../..:maxDrop < 1) {
if (../..:Bombing && (../..:Bombs > 1)) {
../..:forceLine(..:c, ..:r);
} else {
../..:madeline(..:c, ..:r);
}
}
}
Symbol 51 MovieClip [tiles] Frame 1
Set("..:Tile", this);
Symbol 51 MovieClip [tiles] Frame 2
Set("..:P", ../..:g[..:c][..:r].P);
gotoAndStop(..:P + 1);
Symbol 55 MovieClip [tilePile] Frame 1
stop();
Symbol 55 MovieClip [tilePile] Frame 9
stop();
Symbol 55 MovieClip [tilePile] Frame 20
removeMovieClip("");
stop();
Symbol 55 MovieClip [tilePile] Frame 22
removeMovieClip("");
stop();
Symbol 63 MovieClip [Explode] Frame 4
if (getProperty("..", _currentframe) > 8) {
..:gotoAndPlay(17);
} else {
..:gotoAndStop(10);
}
Symbol 63 MovieClip [Explode] Frame 8
if (getProperty("..", _currentframe) != 10) {
..:removeMovieClip("");
} else {
removeMovieClip("");
}
stop();
Symbol 70 MovieClip [bombFollower] Frame 1
startDrag ("", true);
Symbol 70 MovieClip [bombFollower] Frame 6
gotoAndPlay (2);
Symbol 81 MovieClip [Sparkle] Frame 1
Set("../../..:currentShiner", this);
shineCount = 0;
loopCount = 0;
Symbol 81 MovieClip [Sparkle] Frame 7
shineCount++;
if (shineCount < 20) {
gotoAndPlay (2);
}
Symbol 81 MovieClip [Sparkle] Frame 19
shineCount = 0;
gotoAndPlay (2);
Symbol 85 MovieClip [comboNotice] Frame 2
if ((typeof(_parent["ComboNotice" + (ID - 1)]) == "movieclip") && (_parent["ComboNotice" + (ID - 1)]._currentframe < 7)) {
gotoAndPlay (1);
}
Symbol 85 MovieClip [comboNotice] Frame 19
removeMovieClip("");
Symbol 91 MovieClip [bgButton] Frame 1
bgButton.useHandCursor = false;
Symbol 91 MovieClip [bgButton] Frame 4
removeMovieClip("");
Symbol 100 MovieClip [noMovesLeft] Frame 100
..:clearGame();
..:gotoAndStop("Menu");
removeMovieClip("");
Symbol 102 MovieClip [NewBestLevel] Frame 26
removeMovieClip("");
stop();
Symbol 106 MovieClip [NewBestScore] Frame 35
removeMovieClip("");
stop();
Symbol 114 Button
on (release) {
play();
}
Symbol 118 Button
on (release) {
removeMovieClip("");
}
Symbol 119 MovieClip [scoreError] Frame 1
BGBut.useHandCursor = false;
Symbol 119 MovieClip [scoreError] Frame 3
stop();
Symbol 119 MovieClip [scoreError] Frame 5
Set("..:Score", Score);
Set("..:Level", Level);
..:ScoreBoardFunc(false);
removeMovieClip("");
stop();
Symbol 131 MovieClip Frame 58
stop();
Symbol 131 MovieClip Frame 115
..:play();
Symbol 131 MovieClip Frame 116
stop();
Symbol 136 Button
on (press) {
gotoAndPlay ("Outro");
}
Symbol 140 Button
on (release) {
attachMovie("Instructions", "Instructions", 400);
}
Symbol 176 Button
on (release) {
sendscore = new LoadVars();
sendscore.gscore = Score;
sendscore.gname = "GorillazTilesSte";
sendscore.send("index.php?act=Arcade&do=newscore", "_self", "POST");
stopAllSounds();
_root._visible = false;
_root.enabled = false;
}
Symbol 148 MovieClip Frame 3
../..:playSounds(15);
Symbol 148 MovieClip Frame 5
stop();
Symbol 150 MovieClip Frame 4
../..:playSounds(16);
Symbol 150 MovieClip Frame 5
stop();
Symbol 151 MovieClip Frame 9
stop();
Symbol 155 MovieClip Frame 2
if (Score < ..:Score) {
Score = Score + 5;
gotoAndPlay (1);
}
Symbol 155 MovieClip Frame 49
stop();
Symbol 156 MovieClip Frame 1
gotoFrame = ../..:Level * 35;
if (gotoFrame > 1) {
gotoAndPlay(gotoFrame);
delete gotoFrame;
}
Symbol 156 MovieClip Frame 34
stop();
Symbol 156 MovieClip Frame 68
stop();
Symbol 156 MovieClip Frame 102
stop();
Symbol 157 MovieClip Frame 47
..:play();
Symbol 164 MovieClip Frame 1
if (..:Level > 0) {
gotoAndStop(..:Level + 1);
} else {
stop();
}
Symbol 171 Button
on (press) {
gotoAndStop ("Menu");
}