Frame 2
fp_btn.onRollOver = function () {
fp_btn.gotoAndStop("over");
};
fp_btn.onRollOut = function () {
fp_btn.gotoAndStop("normal");
};
fp_btn.onRelease = function () {
gotoAndStop ("freePlay");
};
pg_btn.onRollOver = function () {
pg_btn.gotoAndStop("over");
};
pg_btn.onRollOut = function () {
pg_btn.gotoAndStop("normal");
};
pg_btn.onRelease = function () {
gotoAndStop ("playGame");
};
r_btn.onRollOver = function () {
r_btn.gotoAndStop("over");
};
r_btn.onRollOut = function () {
r_btn.gotoAndStop("normal");
};
r_btn.onRelease = function () {
gotoAndStop ("rules");
};
stop();
Frame 3
function drawBlocks() {
row = 0;
while (row < numBlockRows) {
blocks[row] = new Array();
col = 0;
while (col < numCols) {
blocks[row][col] = NEUTRAL;
attachMovie("Block", ((("block" + row) + "_") + col) + "_mc", getNextHighestDepth());
with (this[((("block" + row) + "_") + col) + "_mc"]) {
_x = 20 + (col * _width);
_y = 20 + (row * _width);
gotoAndStop("Neutral");
}
col++;
}
row++;
}
i = 0;
while (i < numActiveCells) {
greenRow = Math.floor(Math.random() * numBlockRows);
greenCol = Math.floor(Math.random() * numCols);
this[((("block" + greenRow) + "_") + greenCol) + "_mc"].gotoAndStop("Active");
blocks[greenRow][greenCol] = ACTIVE;
i++;
}
i = 0;
while (i < numAttackCells) {
greenRow = Math.floor(Math.random() * numBlockRows);
greenCol = Math.floor(Math.random() * numCols);
this[((("block" + greenRow) + "_") + greenCol) + "_mc"].gotoAndStop("Black");
blocks[greenRow][greenCol] = BLACK;
i++;
}
}
function blockCrush() {
blocknum = 0;
while (blocknum < numBlockRows) {
if (((blockRowCount + blocknum) == playerRow) && (blocks[blocknum][playerCol] != DEAD)) {
msg = "You were crushed by the blocks";
gotoAndStop ("end");
clearBoard();
score = score + blocksDestroyed;
}
blocknum++;
}
}
function moveBlocks() {
if (((blockRowCount < (numRows + 1)) && (loop < 5)) && (msg == " ")) {
row = 0;
while (row < numBlockRows) {
col = 0;
while (col < numCols) {
with (this[((("block" + row) + "_") + col) + "_mc"]) {
_y = 20 + ((row + blockRowCount) * _width);
}
col++;
}
row++;
}
blockCrush();
} else {
row = 0;
while (row < numBlockRows) {
col = 0;
while (col < numCols) {
if (blocks[row][col] == BLACK) {
blocksDestroyed++;
_root[((("block" + row) + "_") + col) + "_mc"]._visible = false;
blocks[row][col] = DEAD;
}
col++;
}
row++;
}
blockRowCount = numBlockRows * -1;
loop++;
}
}
function drawBoard() {
row = 0;
while (row < numRows) {
col = 0;
while (col < numCols) {
attachMovie("boardTile", ((("board" + row) + "_") + col) + "_mc", getNextHighestDepth());
with (this[((("board" + row) + "_") + col) + "_mc"]) {
_x = 20 + (col * _width);
_y = 20 + (row * _width);
gotoAndStop("Neutral");
}
col++;
}
row++;
}
}
function activeBrick() {
rowbuf = -1;
while (rowbuf <= 1) {
colbuf = -1;
while (colbuf <= 1) {
switch (blocks[row + rowbuf][col + colbuf]) {
case NEUTRAL :
blocksDestroyed++;
_root[((("block" + (row + rowbuf)) + "_") + (col + colbuf)) + "_mc"]._visible = false;
blocks[row + rowbuf][col + colbuf] = DEAD;
break;
case BLACK :
blocksDestroyed++;
_root[((("block" + (row + rowbuf)) + "_") + (col + colbuf)) + "_mc"]._visible = false;
blocks[row + rowbuf][col + colbuf] = DEAD;
numRows--;
colnumber = 0;
while (colnumber < numCols) {
removeMovieClip(this[((("board" + numRows) + "_") + colnumber) + "_mc"]);
colnumber++;
}
if (playerRow >= numRows) {
msg = "You fell off the board, dumbass!";
gotoAndStop ("end");
clearBoard();
score = score + blocksDestroyed;
}
break;
case ACTIVE :
blocksDestroyed++;
_root[((("block" + (row + rowbuf)) + "_") + (col + colbuf)) + "_mc"]._visible = false;
blocks[row + rowbuf][col + colbuf] = DEAD;
lastrow = row;
lastcol = col;
row = row + rowbuf;
col = col + colbuf;
activeBrick();
row = lastrow;
col = lastcol;
}
colbuf++;
}
rowbuf++;
}
}
function clearBoard() {
row = 0;
while (row < numRows) {
col = 0;
while (col < numCols) {
removeMovieClip(this[((("board" + row) + "_") + col) + "_mc"]);
col++;
}
row++;
}
row = 0;
while (row < numBlockRows) {
col = 0;
while (col < numCols) {
removeMovieClip(this[((("block" + row) + "_") + col) + "_mc"]);
col++;
}
row++;
}
removeMovieClip(player_mc);
}
function addPlayer() {
Key.removeListener(player_mc);
attachMovie("player", "player_mc", getNextHighestDepth());
with (player_mc) {
_x = this[((("board" + playerRow) + "_") + playerCol) + "_mc"]._x;
_y = this[((("board" + playerRow) + "_") + playerCol) + "_mc"]._y;
}
Key.addListener(player_mc);
player_mc.onKeyUp = movePlayer;
}
function movePlayer() {
val = Key.getCode();
switch (val) {
case 38 :
if (playerRow > 0) {
this._y = this._y - this._width;
playerRow = playerRow - 1;
}
blockCrush();
break;
case 40 :
if (playerRow < (numRows - 1)) {
this._y = this._y + this._width;
playerRow = playerRow + 1;
}
blockCrush();
break;
case 37 :
if (playerCol > 0) {
this._x = this._x - this._width;
playerCol = playerCol - 1;
}
blockCrush();
break;
case 39 :
if (playerCol < (numCols - 1)) {
this._x = this._x + this._width;
playerCol = playerCol + 1;
}
blockCrush();
break;
case 32 :
if (!marked) {
_root[((("board" + playerRow) + "_") + playerCol) + "_mc"].gotoAndStop("Marked");
marked = true;
rowMarked = playerRow;
colMarked = playerCol;
} else {
_root[((("board" + playerRow) + "_") + playerCol) + "_mc"].gotoAndStop("Marked");
_root[((("board" + rowMarked) + "_") + colMarked) + "_mc"].gotoAndStop("Neutral");
marked = true;
rowMarked = playerRow;
colMarked = playerCol;
}
}
}
function displayGame() {
drawBoard();
addPlayer();
drawBlocks();
}
var blocks = new Array();
loop = 0;
msg = " ";
level = 1;
score = 0;
numActiveCells = 2;
numAttackCells = 1;
DEAD = 0;
NEUTRAL = 1;
ACTIVE = 2;
BLACK = 3;
X = 88;
blocksDestroyed = 0;
blocksStart = true;
numRows = 20;
numCols = 4;
numBlockRows = 2;
blockSpeed = 10;
delayLength = (delayBlocks = blockSpeed);
blockRowCount = 0;
playerRow = numRows - 1;
playerCol = Math.floor(numCols / 2);
marked = false;
startBlocks_btn.onRelease = function () {
blocksStart = true;
};
stopBlocks_btn.onRelease = function () {
blocksStart = false;
};
addBlocks_btn.onRelease = function () {
clearBoard();
numBlockRows++;
displayGame();
};
removeBlocks_btn.onRelease = function () {
clearBoard();
numBlockRows--;
displayGame();
};
increaseSpeed_btn.onRelease = function () {
blockSpeed = blockSpeed - 5;
delayLength = blockSpeed;
};
decreaseSpeed_btn.onRelease = function () {
blockSpeed = blockSpeed + 5;
delayLength = blockSpeed;
};
removeRow_btn.onRelease = function () {
clearBoard();
if (numRows > 1) {
numRows--;
}
displayGame();
};
addColumn_btn.onRelease = function () {
clearBoard();
if (numCols < 9) {
numCols++;
}
displayGame();
};
removeColumn_btn.onRelease = function () {
clearBoard();
if (numCols > 1) {
numCols--;
}
displayGame();
};
addRow_btn.onRelease = function () {
clearBoard();
if (numRows < 30) {
numRows++;
}
displayGame();
};
displayGame();
Key.addListener(this);
this.onKeyUp = function () {
if (!(Key.getCode() === X)) {
} else if (marked) {
row = 0;
while (row < numBlockRows) {
testRow = row + blockRowCount;
col = 0;
while (col < numCols) {
if ((testRow == rowMarked) && (col == colMarked)) {
switch (blocks[row][col]) {
case NEUTRAL :
blocksDestroyed++;
_root[((("block" + row) + "_") + col) + "_mc"]._visible = false;
blocks[row][col] = DEAD;
break;
case ACTIVE :
activeBrick();
break;
case BLACK :
blocksDestroyed++;
_root[((("block" + row) + "_") + col) + "_mc"]._visible = false;
blocks[row][col] = DEAD;
numRows--;
col = 0;
while (col < numCols) {
removeMovieClip(this[((("board" + numRows) + "_") + col) + "_mc"]);
col++;
}
if (playerRow < numRows) {
break;
}
msg = "You fell off the board, dumbass!";
gotoAndStop ("end");
clearBoard();
score = score + blocksDestroyed;
}
}
col++;
}
row++;
}
_root[((("board" + rowMarked) + "_") + colMarked) + "_mc"].gotoAndStop("Neutral");
marked = false;
}
};
onEnterFrame = function () {
if (blocksStart) {
if (delayBlocks > 0) {
delayBlocks--;
} else {
delayBlocks = blockSpeed;
blockRowCount++;
moveBlocks();
}
}
if (blocksDestroyed >= (numBlockRows * numCols)) {
loop = 0;
clearBoard();
levelUp = Math.floor(Math.random() * 50);
if (levelUp <= 25) {
if (numCols < 9) {
numCols++;
}
} else {
numBlockRows++;
}
displayGame();
score = score + blocksDestroyed;
blocksDestroyed = 0;
blockRowCount = 0;
level++;
} else if ((loop == 5) && (msg == " ")) {
msg = "You ran out of time";
clearBoard();
gotoAndStop ("end");
}
};
stop();
Frame 4
function drawBlocks() {
row = 0;
while (row < numBlockRows) {
blocks[row] = new Array();
col = 0;
while (col < numCols) {
blocks[row][col] = NEUTRAL;
attachMovie("Block", ((("block" + row) + "_") + col) + "_mc", getNextHighestDepth());
with (this[((("block" + row) + "_") + col) + "_mc"]) {
_x = 20 + (col * _width);
_y = 20 + (row * _width);
gotoAndStop("Neutral");
}
col++;
}
row++;
}
i = 0;
while (i < numActiveCells) {
greenRow = Math.floor(Math.random() * numBlockRows);
greenCol = Math.floor(Math.random() * numCols);
this[((("block" + greenRow) + "_") + greenCol) + "_mc"].gotoAndStop("Active");
blocks[greenRow][greenCol] = ACTIVE;
i++;
}
i = 0;
while (i < numAttackCells) {
greenRow = Math.floor(Math.random() * numBlockRows);
greenCol = Math.floor(Math.random() * numCols);
this[((("block" + greenRow) + "_") + greenCol) + "_mc"].gotoAndStop("Black");
blocks[greenRow][greenCol] = BLACK;
i++;
}
}
function moveBlocks() {
if ((blockRowCount < (numRows + 1)) && (msg == " ")) {
row = 0;
while (row < numBlockRows) {
col = 0;
while (col < numCols) {
with (this[((("block" + row) + "_") + col) + "_mc"]) {
_y = 20 + ((row + blockRowCount) * _width);
}
col++;
}
row++;
}
} else {
blockRowCount = numBlockRows * -1;
loop++;
}
}
function drawBoard() {
row = 0;
while (row < numRows) {
col = 0;
while (col < numCols) {
attachMovie("boardTile", ((("board" + row) + "_") + col) + "_mc", getNextHighestDepth());
with (this[((("board" + row) + "_") + col) + "_mc"]) {
_x = 20 + (col * _width);
_y = 20 + (row * _width);
gotoAndStop("Neutral");
}
col++;
}
row++;
}
}
function activeBrick() {
rowbuf = -1;
while (rowbuf <= 1) {
colbuf = -1;
while (colbuf <= 1) {
switch (blocks[row + rowbuf][col + colbuf]) {
case NEUTRAL :
blocksDestroyed++;
_root[((("block" + (row + rowbuf)) + "_") + (col + colbuf)) + "_mc"]._visible = false;
blocks[row + rowbuf][col + colbuf] = DEAD;
break;
case BLACK :
_root[((("block" + (row + rowbuf)) + "_") + (col + colbuf)) + "_mc"]._visible = false;
blocks[row + rowbuf][col + colbuf] = DEAD;
numRows--;
colnumber = 0;
while (colnumber < numCols) {
removeMovieClip(this[((("board" + numRows) + "_") + colnumber) + "_mc"]);
colnumber++;
}
if (playerRow >= numRows) {
msg = "You fell off the board, dumbass!";
gotoAndStop ("end");
clearBoard();
score = score + blocksDestroyed;
}
break;
case ACTIVE :
blocksDestroyed++;
_root[((("block" + (row + rowbuf)) + "_") + (col + colbuf)) + "_mc"]._visible = false;
blocks[row + rowbuf][col + colbuf] = DEAD;
lastrow = row;
lastcol = col;
row = row + rowbuf;
col = col + colbuf;
activeBrick();
row = lastrow;
col = lastcol;
}
colbuf++;
}
rowbuf++;
}
}
function clearBoard() {
row = 0;
while (row < numRows) {
col = 0;
while (col < numCols) {
removeMovieClip(this[((("board" + row) + "_") + col) + "_mc"]);
col++;
}
row++;
}
row = 0;
while (row < numBlockRows) {
col = 0;
while (col < numCols) {
removeMovieClip(this[((("block" + row) + "_") + col) + "_mc"]);
col++;
}
row++;
}
removeMovieClip(player_mc);
}
function addPlayer() {
Key.removeListener(player_mc);
attachMovie("player", "player_mc", getNextHighestDepth());
with (player_mc) {
_x = this[((("board" + playerRow) + "_") + playerCol) + "_mc"]._x;
_y = this[((("board" + playerRow) + "_") + playerCol) + "_mc"]._y;
}
Key.addListener(player_mc);
player_mc.onKeyUp = movePlayer;
}
function movePlayer() {
val = Key.getCode();
switch (val) {
case 38 :
if (playerRow > 0) {
this._y = this._y - this._width;
playerRow = playerRow - 1;
}
break;
case 40 :
if (playerRow < (numRows - 1)) {
this._y = this._y + this._width;
playerRow = playerRow + 1;
}
break;
case 37 :
if (playerCol > 0) {
this._x = this._x - this._width;
playerCol = playerCol - 1;
}
break;
case 39 :
if (playerCol < (numCols - 1)) {
this._x = this._x + this._width;
playerCol = playerCol + 1;
}
break;
case 32 :
if (!marked) {
_root[((("board" + playerRow) + "_") + playerCol) + "_mc"].gotoAndStop("Marked");
marked = true;
rowMarked = playerRow;
colMarked = playerCol;
} else {
_root[((("board" + playerRow) + "_") + playerCol) + "_mc"].gotoAndStop("Marked");
_root[((("board" + rowMarked) + "_") + colMarked) + "_mc"].gotoAndStop("Neutral");
marked = true;
rowMarked = playerRow;
colMarked = playerCol;
}
}
}
function displayGame() {
drawBoard();
addPlayer();
drawBlocks();
}
var blocks = new Array();
loop = 0;
msg = " ";
numActiveCells = 2;
numAttackCells = 1;
DEAD = 0;
NEUTRAL = 1;
ACTIVE = 2;
BLACK = 3;
X = 88;
blocksDestroyed = 0;
blocksStart = false;
numRows = 20;
numCols = 4;
numBlockRows = 2;
blockSpeed = 10;
delayLength = (delayBlocks = blockSpeed);
blockRowCount = 0;
playerRow = numRows - 1;
playerCol = Math.floor(numCols / 2);
marked = false;
startBlocks_btn.onRelease = function () {
blocksStart = true;
blockRowCount = 0;
};
stopBlocks_btn.onRelease = function () {
blocksStart = false;
blockRowCount = 0;
};
addBlocks_btn.onRelease = function () {
clearBoard();
numBlockRows++;
blockRowCount = 0;
displayGame();
};
removeBlocks_btn.onRelease = function () {
clearBoard();
numBlockRows--;
blockRowCount = 0;
displayGame();
};
increaseSpeed_btn.onRelease = function () {
blockSpeed = blockSpeed - 5;
delayLength = blockSpeed;
};
decreaseSpeed_btn.onRelease = function () {
blockSpeed = blockSpeed + 5;
delayLength = blockSpeed;
};
removeRow_btn.onRelease = function () {
clearBoard();
if (numRows > 1) {
numRows--;
}
blockRowCount = 0;
displayGame();
};
addColumn_btn.onRelease = function () {
clearBoard();
if (numCols < 9) {
numCols++;
}
blockRowCount = 0;
displayGame();
};
removeColumn_btn.onRelease = function () {
clearBoard();
if (numCols > 1) {
numCols--;
}
blockRowCount = 0;
displayGame();
};
addRow_btn.onRelease = function () {
clearBoard();
if (numRows < 30) {
numRows++;
}
blockRowCount = 0;
displayGame();
};
displayGame();
Key.addListener(this);
this.onKeyUp = function () {
if (!(Key.getCode() === X)) {
} else if (marked) {
row = 0;
while (row < numBlockRows) {
testRow = row + blockRowCount;
col = 0;
while (col < numCols) {
if ((testRow == rowMarked) && (col == colMarked)) {
switch (blocks[row][col]) {
case NEUTRAL :
blocksDestroyed++;
_root[((("block" + row) + "_") + col) + "_mc"]._visible = false;
blocks[row][col] = DEAD;
break;
case ACTIVE :
activeBrick();
break;
case BLACK :
blocksDestroyed++;
_root[((("block" + row) + "_") + col) + "_mc"]._visible = false;
blocks[row][col] = DEAD;
numRows--;
col = 0;
for(;;){
if (col >= numCols) {
break;
}
removeMovieClip(this[((("board" + numRows) + "_") + col) + "_mc"]);
col++;
};
}
}
col++;
}
row++;
}
_root[((("board" + rowMarked) + "_") + colMarked) + "_mc"].gotoAndStop("Neutral");
marked = false;
}
};
onEnterFrame = function () {
if (blocksStart) {
if (delayBlocks > 0) {
delayBlocks--;
} else {
delayBlocks = blockSpeed;
blockRowCount++;
moveBlocks();
}
}
};
mm_btn.onRollOver = function () {
mm_btn.gotoAndStop("over");
};
mm_btn.onRollOut = function () {
mm_btn.gotoAndStop("normal");
};
mm_btn.onRelease = function () {
gotoAndStop ("mainmenu");
msg = "mm";
clearBoard();
};
stop();
Frame 5
mm_btn.onRollOver = function () {
mm_btn.gotoAndStop("over");
};
mm_btn.onRollOut = function () {
mm_btn.gotoAndStop("normal");
};
mm_btn.onRelease = function () {
gotoAndStop ("mainmenu");
};
clearBoard();
Frame 6
board_Tile.gotoAndStop("Neutral");
marked_Tile.gotoAndStop("Marked");
normal_Tile.gotoAndStop("Neutral");
active_Tile.gotoAndStop("Active");
black_Tile.gotoAndStop("Black");
fp_btn.onRollOver = function () {
fp_btn.gotoAndStop("over");
};
fp_btn.onRollOut = function () {
fp_btn.gotoAndStop("normal");
};
fp_btn.onRelease = function () {
gotoAndStop ("freePlay");
};
pg_btn.onRollOver = function () {
pg_btn.gotoAndStop("over");
};
pg_btn.onRollOut = function () {
pg_btn.gotoAndStop("normal");
};
pg_btn.onRelease = function () {
gotoAndStop ("playGame");
};
mm_btn.onRollOver = function () {
mm_btn.gotoAndStop("over");
};
mm_btn.onRollOut = function () {
mm_btn.gotoAndStop("normal");
};
mm_btn.onRelease = function () {
gotoAndStop ("mainmenu");
};
Symbol 16 Button
on (release) {
_root.gotoAndPlay("mainmenu");
}
Symbol 17 MovieClip Frame 1
_root.stop();
PercentLoaded = (_root.getBytesLoaded() / _root.getBytesTotal()) * 100;
if (PercentLoaded != 100) {
bar._xscale = 100 - PercentLoaded;
} else {
gotoAndStop ("loaded");
}
Symbol 17 MovieClip Frame 2
gotoAndPlay (1);
Symbol 28 MovieClip [freePlay] Frame 1
stop();
Symbol 32 MovieClip [playGame] Frame 1
stop();
Symbol 36 MovieClip [rules] Frame 1
stop();
Symbol 83 MovieClip [mainMenu] Frame 1
stop();