Frame 1
stage.showMenu = false;
_global.stage_mc = this;
_global.preloader = function () {
bytesTotal = _root.getBytesTotal();
bytesLoaded = _root.getBytesLoaded();
if (bytesLoaded >= bytesTotal) {
gotoAndStop (21);
} else {
percent_mc.percentBar_mc._width = (bytesLoaded / bytesTotal) * 100;
gotoAndPlay (1);
}
};
_global.preloader2 = function () {
if (percent_mc.percentBar_mc._width >= 100) {
gotoAndStop (21);
} else {
percent_mc.percentBar_mc._width = percent_mc.percentBar_mc._width + 1;
gotoAndPlay (1);
}
};
_global.preloader();
Frame 2
_global.preloader();
Frame 21
function checkStage() {
rowBonus = 0;
row = 19;
while (row >= 0) {
if (((((((((_global.stage_array[row][0] && (_global.stage_array[row][1])) && (_global.stage_array[row][2])) && (_global.stage_array[row][3])) && (_global.stage_array[row][4])) && (_global.stage_array[row][5])) && (_global.stage_array[row][6])) && (_global.stage_array[row][7])) && (_global.stage_array[row][8])) && (_global.stage_array[row][9])) {
_global.score = _global.score + 10;
_global.clearedLines++;
rowBonus++;
inCol = 0;
while (inCol < 10) {
mainWindow_mc[(("tile" + row.toString()) + "|") + inCol.toString()].removeMovieClip();
inCol++;
}
inRow = row;
while (inRow >= 0) {
inCol = 0;
while (inCol < 10) {
_global.stage_array[inRow][inCol] = _global.stage_array[inRow - 1][inCol];
if (_global.stage_array[inRow - 1][inCol]) {
mainWindow_mc.attachMovie("tile" + mainWindow_mc[(("tile" + (inRow - 1).toString()) + "|") + inCol.toString()].saveColor, (("tile" + inRow.toString()) + "|") + inCol.toString(), _global.depth++);
mainWindow_mc[(("tile" + inRow.toString()) + "|") + inCol.toString()].saveColor = mainWindow_mc[(("tile" + (inRow - 1).toString()) + "|") + inCol.toString()].saveColor;
mainWindow_mc[(("tile" + inRow.toString()) + "|") + inCol.toString()]._x = mainWindow_mc[(("tile" + (inRow - 1).toString()) + "|") + inCol.toString()]._x;
mainWindow_mc[(("tile" + inRow.toString()) + "|") + inCol.toString()]._y = mainWindow_mc[(("tile" + (inRow - 1).toString()) + "|") + inCol.toString()]._y + 20;
mainWindow_mc[(("tile" + (inRow - 1).toString()) + "|") + inCol.toString()].removeMovieClip();
}
inCol++;
}
inRow--;
}
col = 0;
while (col < 10) {
_global.stage_array[0][col] = 0;
col++;
}
row++;
}
row--;
}
if (rowBonus > 1) {
_global.score = _global.score + (rowBonus * 5);
}
if (rowBonus == 1) {
line1_sound.start();
} else if (rowBonus == 2) {
line2_sound.start();
} else if (rowBonus == 3) {
line3_sound.start();
} else if (rowBonus == 4) {
line4_sound.start();
}
}
function changePiece() {
if (_global.currentPiece != null) {
pieces[_global.currentPiece].setNext();
change_sound.start();
for (piece in mainWindow_mc) {
if (piece.toString().substr(0, 5) == "piece") {
mainWindow_mc[piece].removeMovieClip();
}
}
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if (pieces[_global.currentPiece].getArray()[row][col]) {
mainWindow_mc.attachMovie("tile" + _global.lastColor, (("piece" + row.toString()) + "|") + col.toString(), _global.depth++);
mainWindow_mc[(("piece" + row.toString()) + "|") + col.toString()].saveColor = pieceColor;
mainWindow_mc[(("piece" + row.toString()) + "|") + col.toString()]._x = (col + _global.currentPiece_col) * 20;
mainWindow_mc[(("piece" + row.toString()) + "|") + col.toString()]._y = (row + _global.currentPiece_row) * 20;
}
col++;
}
row++;
}
}
updateHelpBar();
}
function drawPiece(moveDiag) {
if (_global.currentPiece == null) {
if (_global.nextPiece == null) {
_global.currentPiece = Math.floor(Math.random() * 7);
_global.nextPiece = Math.floor(Math.random() * 7);
pieceColor = Number(Math.floor(Math.random() * 5) + 1);
_global.lastColor = pieceColor;
do {
_global.nextPieceColor = Number(Math.floor(Math.random() * 5) + 1);
} while (_global.nextPieceColor == pieceColor);
updatePreview();
} else {
_global.currentPiece = _global.nextPiece;
pieceColor = (_global.lastColor = _global.nextPieceColor);
_global.nextPiece = Math.floor(Math.random() * 7);
do {
_global.nextPieceColor = Number(Math.floor(Math.random() * 5) + 1);
} while (_global.nextPieceColor == pieceColor);
updatePreview();
}
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if (pieces[_global.currentPiece].getArray()[row][col] && (_global.stage_array[_global.currentPiece_row + row][_global.currentPiece_col + col])) {
_global.runGame = false;
_global.gameOver = true;
showGameOverWindow();
}
col++;
}
row++;
}
if (_global.runGame) {
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if (pieces[_global.currentPiece].getArray()[row][col]) {
mainWindow_mc.attachMovie("tile" + pieceColor, (("piece" + row.toString()) + "|") + col.toString(), _global.depth++);
mainWindow_mc[(("piece" + row.toString()) + "|") + col.toString()].saveColor = pieceColor;
mainWindow_mc[(("piece" + row.toString()) + "|") + col.toString()]._x = (col + _global.currentPiece_col) * 20;
mainWindow_mc[(("piece" + row.toString()) + "|") + col.toString()]._y = (row + _global.currentPiece_row) * 20;
}
col++;
}
row++;
}
updateHelpBar();
}
} else if ((_global.speedCnt >= _global.speed) || (moveDiag)) {
if (moveDownCheck()) {
if (!moveDiag) {
_global.currentPiece_row++;
_global.speedCnt = 0;
}
for (piece in mainWindow_mc) {
if (piece.toString().substr(0, 5) == "piece") {
mainWindow_mc[piece]._x = (Number(piece.toString().substr(7, 1)) * 20) + (_global.currentPiece_col * 20);
mainWindow_mc[piece]._y = (Number(piece.toString().substr(5, 1)) * 20) + (_global.currentPiece_row * 20);
}
}
} else {
_global.score = _global.score + 2;
drop_sound.start();
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if (pieces[_global.currentPiece].getArray()[row][col]) {
_global.stage_array[_global.currentPiece_row + row][col + _global.currentPiece_col] = pieces[_global.currentPiece].getArray()[row][col];
}
col++;
}
row++;
}
for (piece in mainWindow_mc) {
if (piece.toString().substr(0, 5) == "piece") {
mainWindow_mc[piece]._x = (Number(piece.toString().substr(7, 1)) * 20) + (_global.currentPiece_col * 20);
mainWindow_mc[piece]._y = (Number(piece.toString().substr(5, 1)) * 20) + (_global.currentPiece_row * 20);
}
}
_global.currentPiece = null;
_global.currentPiece_row = 0;
_global.currentPiece_col = 4;
for (piece in mainWindow_mc) {
if (piece.toString().substr(0, 5) == "piece") {
tempRow = mainWindow_mc[piece]._y / 20;
tempCol = mainWindow_mc[piece]._x / 20;
mainWindow_mc.attachMovie("tile" + mainWindow_mc[piece].saveColor, (("tile" + tempRow) + "|") + tempCol, _global.depth++);
mainWindow_mc[(("tile" + tempRow) + "|") + tempCol]._x = mainWindow_mc[piece]._x;
mainWindow_mc[(("tile" + tempRow) + "|") + tempCol]._y = mainWindow_mc[piece]._y;
mainWindow_mc[(("tile" + tempRow) + "|") + tempCol].saveColor = mainWindow_mc[piece].saveColor;
mainWindow_mc[piece].removeMovieClip();
}
}
updateHelpBar();
}
} else {
_global.speedCnt++;
}
}
function updateHelpBar() {
farCol = 0;
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if (pieces[_global.currentPiece].getArray()[row][col] && (farCol < col)) {
farCol = col;
}
col++;
}
row++;
}
helpBarWindow_mc.helpBar_mc._x = _global.currentPiece_col * 20;
helpBarWindow_mc.helpBar_mc._width = (farCol + 1) * 20;
}
function updatePreview() {
for (piece_mc in previewWindow_mc) {
previewWindow_mc[piece_mc].removeMovieClip();
}
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if (pieces[_global.nextPiece].getArray()[row][col]) {
previewWindow_mc.attachMovie("tile" + _global.nextPieceColor, (("piece" + row.toString()) + "|") + col.toString(), _global.depth++);
previewWindow_mc[(("piece" + row.toString()) + "|") + col.toString()].saveColor = pieceColor;
previewWindow_mc[(("piece" + row.toString()) + "|") + col.toString()]._x = col * 20;
previewWindow_mc[(("piece" + row.toString()) + "|") + col.toString()]._y = row * 20;
}
col++;
}
row++;
}
}
function dropPiece() {
while (moveDownCheck()) {
_global.currentPiece_row++;
for (piece in mainWindow_mc) {
if (piece.toString().substr(0, 5) == "piece") {
mainWindow_mc[piece]._x = (Number(piece.toString().substr(7, 1)) * 20) + (_global.currentPiece_col * 20);
mainWindow_mc[piece]._y = (Number(piece.toString().substr(5, 1)) * 20) + (_global.currentPiece_row * 20);
}
}
}
_global.speedCnt = 0;
drawPiece();
}
function moveDownCheck() {
var returnBool = true;
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if ((pieces[_global.currentPiece].getArray()[row][col] && (_global.stage_array[(_global.currentPiece_row + row) + 1][col + _global.currentPiece_col])) || (pieces[_global.currentPiece].getArray()[row][col] && (((_global.currentPiece_row + row) + 1) >= 20))) {
returnBool = false;
}
col++;
}
row++;
}
return(returnBool);
}
function moveLeftCheck() {
var returnBool = true;
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if ((pieces[_global.currentPiece].getArray()[row][col] && (_global.stage_array[_global.currentPiece_row + row][(col + _global.currentPiece_col) - 1])) || (_global.currentPiece_col <= 0)) {
returnBool = false;
}
col++;
}
row++;
}
return(returnBool);
}
function moveRightCheck() {
var returnBool = true;
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if ((pieces[_global.currentPiece].getArray()[row][col] && (_global.stage_array[_global.currentPiece_row + row][(col + _global.currentPiece_col) + 1])) || (pieces[_global.currentPiece].getArray()[row][col] && (((col + _global.currentPiece_col) + 1) > 9))) {
returnBool = false;
}
col++;
}
row++;
}
return(returnBool);
}
function pauseGame() {
if ((_global.currentPiece != null) && (!_global.gameOver)) {
_global.runGame = !_global.runGame;
pause_sound.start();
if (_global.runGame) {
stage_mc.pauseSign_mc.removeMovieClip();
} else {
stage_mc.attachMovie("pauseSign", "pauseSign_mc", depth++);
stage_mc.pauseSign_mc._x = 275;
stage_mc.pauseSign_mc._y = 200;
}
}
}
function playMusic() {
stage_mc.title_mc.removeMovieClip();
stage_mc.attachMovie("title" + _global.currentMusic, "title_mc", depth++);
stage_mc.title_mc._x = 12;
stage_mc.title_mc._y = 420;
if (_global.currentMusic == 1) {
music1_sound.start();
music1_sound.onSoundComplete = function () {
music1_sound.start();
};
} else if (_global.currentMusic == 2) {
music2_sound.start();
music2_sound.onSoundComplete = function () {
music2_sound.start();
};
} else if (_global.currentMusic == 3) {
music3_sound.start();
music3_sound.onSoundComplete = function () {
music3_sound.start();
};
}
}
function showGameOverWindow() {
if (!_global.windowUp) {
stage_mc.attachMovie("gameOverWindow", "gameOverWindow_mc", depth++);
stage_mc.gameOverWindow_mc._x = 175;
stage_mc.gameOverWindow_mc._y = 100;
_global.windowUp = true;
}
}
function stopMusic() {
if (_global.currentMusic == 1) {
music1_sound.stop("music1.wav");
} else if (_global.currentMusic == 2) {
music2_sound.stop("music2.wav");
} else if (_global.currentMusic == 3) {
music3_sound.stop("music3.wav");
}
}
_global.highScoresScript = "http://www.unf.edu/~voli0001/flash/tetris/tetris.php";
change_sound = new Sound();
change_sound.attachSound("change.wav");
drop_sound = new Sound();
drop_sound.attachSound("drop.wav");
pause_sound = new Sound();
pause_sound.attachSound("pause.wav");
start_sound = new Sound();
start_sound.attachSound("start.wav");
levelUp_sound = new Sound();
levelUp_sound.attachSound("levelUp.wav");
line1_sound = new Sound();
line1_sound.attachSound("line1.wav");
line2_sound = new Sound();
line2_sound.attachSound("line2.wav");
line3_sound = new Sound();
line3_sound.attachSound("line3.wav");
line4_sound = new Sound();
line4_sound.attachSound("line4.wav");
music1_sound = new Sound();
music1_sound.attachSound("music1.wav");
music2_sound = new Sound();
music2_sound.attachSound("music2.wav");
music3_sound = new Sound();
music3_sound.attachSound("music3.wav");
_global.currentMusic = 2;
_global.depth = 0;
_global.runGame = false;
_global.gameOver = false;
_global.score = 0;
_global.level = 0;
_global.levelChange = 20;
_global.clearedLines = 0;
_global.speed = 18;
_global.speedCnt = 0;
_global.currentPiece = null;
_global.nextPiece = null;
_global.nextPieceColor = 0;
_global.currentPiece_row = 0;
_global.currentPiece_col = 4;
_global.lastColor = 0;
_global.windowUp = false;
_global.stage_array = new Array();
_global.stage_array = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
Piece = function (newPiece) {
this.piece_array = newPiece;
};
Piece.prototype.setNext = function () {
temp_array = new Array();
temp_array = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
temp_array[col][3 - row] = this.piece_array[row][col];
col++;
}
row++;
}
this.piece_array = temp_array;
while (!(((this.piece_array[0][0] || (this.piece_array[1][0])) || (this.piece_array[2][0])) || (this.piece_array[3][0]))) {
row = 0;
while (row < 4) {
col = 1;
while (col < 4) {
this.piece_array[row][col - 1] = this.piece_array[row][col];
col++;
}
row++;
}
this.piece_array[0][3] = 0;
this.piece_array[1][3] = 0;
this.piece_array[2][3] = 0;
this.piece_array[3][3] = 0;
}
};
Piece.prototype.testNext = function () {
returnBool = true;
temp_array = new Array();
temp_array = [[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]];
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
temp_array[col][3 - row] = this.piece_array[row][col];
col++;
}
row++;
}
while (!(((temp_array[0][0] || (temp_array[1][0])) || (temp_array[2][0])) || (temp_array[3][0]))) {
row = 0;
while (row < 4) {
col = 1;
while (col < 4) {
temp_array[row][col - 1] = temp_array[row][col];
col++;
}
row++;
}
temp_array[0][3] = 0;
temp_array[1][3] = 0;
temp_array[2][3] = 0;
temp_array[3][3] = 0;
}
row = 0;
while (row < 4) {
col = 0;
while (col < 4) {
if (((temp_array[row][col] && (_global.stage_array[row + _global.currentPiece_row][col + _global.currentPiece_col])) || (temp_array[row][col] && ((col + _global.currentPiece_col) > 9))) || (temp_array[row][col] && ((row + _global.currentPiece_row) > 19))) {
returnBool = false;
}
col++;
}
row++;
}
return(returnBool);
};
Piece.prototype.getArray = function () {
return(this.piece_array);
};
pieces = new Array();
pieces.push(new Piece([[1, 1, 1, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]));
pieces.push(new Piece([[1, 1, 1, 0], [0, 0, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]));
pieces.push(new Piece([[0, 0, 1, 0], [1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]));
pieces.push(new Piece([[0, 1, 0, 0], [1, 1, 1, 0], [0, 0, 0, 0], [0, 0, 0, 0]]));
pieces.push(new Piece([[1, 1, 0, 0], [1, 1, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0]]));
pieces.push(new Piece([[1, 0, 0, 0], [1, 1, 0, 0], [0, 1, 0, 0], [0, 0, 0, 0]]));
pieces.push(new Piece([[0, 1, 0, 0], [1, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 0]]));
keyListener = new Object();
keyListener.onKeyDown = function () {
if (_global.runGame && (_global.currentPiece != null)) {
if (Key.isDown(37)) {
if (moveLeftCheck()) {
_global.currentPiece_col--;
}
drawPiece(true);
updateHelpBar();
} else if (Key.isDown(39)) {
if (moveRightCheck()) {
_global.currentPiece_col++;
}
drawPiece(true);
updateHelpBar();
} else if (Key.isDown(38)) {
if (pieces[_global.currentPiece].testNext()) {
changePiece();
}
} else if (Key.isDown(40)) {
dropPiece();
}
}
};
Key.addListener(keyListener);
playMusic();
stage_mc.createEmptyMovieClip("scoreWindow_mc", depth++);
stage_mc.scoreWindow_mc._x = 105;
stage_mc.scoreWindow_mc._y = 182;
stage_mc.scoreWindow_mc.score = -1;
stage_mc.createEmptyMovieClip("levelWindow_mc", depth++);
stage_mc.levelWindow_mc._x = 20;
stage_mc.levelWindow_mc._y = 182;
stage_mc.scoreWindow_mc.onEnterFrame = function () {
if (stage_mc.scoreWindow_mc.score < _global.score) {
stage_mc.scoreWindow_mc.score++;
for (num in stage_mc.scoreWindow_mc) {
stage_mc.scoreWindow_mc[num].removeMovieClip();
}
newNumString = "000000".concat(stage_mc.scoreWindow_mc.score.toString()).substring(stage_mc.scoreWindow_mc.score.toString().length + 1, stage_mc.scoreWindow_mc.score.toString().length + 6);
pos = 0;
while (pos < newNumString.length) {
stage_mc.scoreWindow_mc.attachMovie("num" + newNumString.substr(pos, 1), "num" + pos, depth++);
stage_mc.scoreWindow_mc["num" + pos]._x = pos * 25;
stage_mc.scoreWindow_mc["num" + pos]._y = 0;
pos++;
}
if ((_global.clearedLines >= _global.levelChange) || (_global.level == 0)) {
for (num in stage_mc.levelWindow_mc) {
stage_mc.levelWindow_mc[num].removeMovieClip();
}
_global.level++;
if (_global.level != 1) {
levelUp_sound.start();
}
_global.clearedLines = 0;
if (_global.speed >= 0) {
_global.speed--;
}
newNumString = "00".concat(_global.level.toString()).substring(_global.level.toString().length, _global.level.toString().length + 2);
pos = 0;
while (pos < newNumString.length) {
stage_mc.levelWindow_mc.attachMovie("num" + newNumString.substr(pos, 1), "num" + pos, depth++);
stage_mc.levelWindow_mc["num" + pos]._x = pos * 25;
stage_mc.levelWindow_mc["num" + pos]._y = 0;
pos++;
}
}
}
};
stage_mc.pauseGame_btn.onRelease = function () {
if (!_global.windowUp) {
pauseGame();
}
};
stage_mc.pause_mc.onPress = function () {
stopMusic();
};
stage_mc.play_mc.onPress = function () {
playMusic();
};
stage_mc.ff_mc.onPress = function () {
stopMusic();
if ((++_global.currentMusic) > 3) {
_global.currentMusic = 1;
}
playMusic();
};
stage_mc.rewind_mc.onPress = function () {
stopMusic();
if ((--_global.currentMusic) < 1) {
_global.currentMusic = 3;
}
playMusic();
};
stage_mc.highScores_btn.onPress = function () {
if (_global.runGame) {
pauseGame();
}
if (!_global.windowUp) {
stage_mc.attachMovie("highScoresWindow", "highScoresWindow_mc", depth++);
stage_mc.highScoresWindow_mc._x = 175;
stage_mc.highScoresWindow_mc._y = 100;
_global.windowUp = true;
}
};
stage_mc.newGame_btn.onRelease = function () {
if (!_global.windowUp) {
start_sound.start();
_global.runGame = true;
_global.gameOver = false;
_global.score = 0;
_global.level = 0;
_global.clearedLines = 0;
_global.speed = 18;
_global.speedCnt = 0;
stage_mc.scoreWindow_mc.score = -1;
for (piece in mainWindow_mc) {
mainWindow_mc[piece].removeMovieClip();
}
_global.currentPiece = null;
_global.currentPiece_row = 0;
_global.currentPiece_col = 4;
stage_mc.pauseSign_mc.removeMovieClip();
_global.stage_array = [[0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
}
};
stage_mc.onEnterFrame = function () {
if (_global.runGame) {
checkStage();
drawPiece();
}
};
Symbol 8 MovieClip Frame 1
if (this.sessionstarted != 1) {
this.arcade = new LoadVars();
this.sessionvars = new LoadVars();
this.arcade.gamename = "ivtetris";
this.arcade.sessdo = "sessionstart";
this.arcade.sendAndLoad("arcade.php", sessionvars, "POST");
this.sessionstarted = 1;
}
if (_root.gameover == 1) {
if ((this.askpermission != 1) && (this.sessionvars.connStatus == 1)) {
this.prequestvars = new LoadVars();
this.pranswer = new LoadVars();
this.prequestvars.gametime = this.sessionvars.gametime;
this.prequestvars.fakekey = this.sessionvars.initbar;
if (_root.score == 0) {
this.prequestvars.score = -1;
} else {
this.prequestvars.score = _root.score;
}
this.prequestvars.id = this.sessionvars.lastid;
this.prequestvars.sessdo = "permrequest";
this.prequestvars.note = (this.prequestvars.id * this.prequestvars.score) * this.prequestvars.fakekey;
this.prequestvars.sendAndLoad("./arcade.php", this.pranswer, "POST");
this.askpermission = 1;
}
if ((this.pranswer.validate == 1) && (this.finalsent != 1)) {
this.burnscore = new LoadVars();
this.burnscore.microone = this.pranswer.microone;
this.burnscore.gametime = this.prequestvars.gametime;
this.burnscore.id = this.prequestvars.id;
if (_root.score == 0) {
this.burnscore.noscore = 1;
}
this.burnscore.sessdo = "burn";
this.burnscore.send("./arcade.php", "_self", "POST");
this.finalsent = 1;
}
}
Symbol 57 MovieClip [gameOverWindow] Frame 1
_root.score = Number(score);
_root.gameover = 1;
stop();
Symbol 57 MovieClip [gameOverWindow] Frame 5
dataSender = new LoadVars();
dataReceiver = new LoadVars();
dataReceiver.onLoad = function () {
_global.windowUp = false;
gameOver_mc.removeMovieClip();
};
gameOver_mc.save_btn.onRelease = function () {
counter = 1;
while (counter <= 5) {
if (gameOver_mc.highScores_array[counter].name == "enter your name") {
if (gameOver_mc.inName_mc.inName == "enter your name") {
gameOver_mc.highScores_array[counter].name = "Anonymous";
} else {
gameOver_mc.highScores_array[counter].name = gameOver_mc.inName_mc.inName;
}
}
counter++;
}
dataSender.cacheKiller = new Date().getTime();
dataSender.action = "saveScores";
dataSender.name1 = gameOver_mc.highScores_array[5].name;
dataSender.name2 = gameOver_mc.highScores_array[4].name;
dataSender.name3 = gameOver_mc.highScores_array[3].name;
dataSender.name4 = gameOver_mc.highScores_array[2].name;
dataSender.name5 = gameOver_mc.highScores_array[1].name;
dataSender.score1 = gameOver_mc.highScores_array[5].score;
dataSender.score2 = gameOver_mc.highScores_array[4].score;
dataSender.score3 = gameOver_mc.highScores_array[3].score;
dataSender.score4 = gameOver_mc.highScores_array[2].score;
dataSender.score5 = gameOver_mc.highScores_array[1].score;
dataSender.sendAndLoad(_global.highScoresScript, dataReceiver, "GET");
gameOver_mc.gotoAndStop("saving");
};
stop();
Symbol 57 MovieClip [gameOverWindow] Frame 15
gameOver_mc.close_btn.onRelease = function () {
_global.windowUp = false;
gameOver_mc.removeMovieClip();
};
Symbol 74 MovieClip [highScoresWindow] Frame 1
highScores_mc = this;
highScores_mc.close_btn.onRelease = function () {
_global.windowUp = false;
highScores_mc.removeMovieClip();
};
dataSender = new LoadVars();
dataReceiver = new LoadVars();
dataReceiver.onLoad = function () {
highScores_mc.gotoAndStop("loaded");
highScores_mc.name1 = this.name1;
highScores_mc.name2 = this.name2;
highScores_mc.name3 = this.name3;
highScores_mc.name4 = this.name4;
highScores_mc.name5 = this.name5;
highScores_mc.score1 = this.score1;
highScores_mc.score2 = this.score2;
highScores_mc.score3 = this.score3;
highScores_mc.score4 = this.score4;
highScores_mc.score5 = this.score5;
};
dataSender.cacheKiller = new Date().getTime();
dataSender.action = "getScores";
dataSender.sendAndLoad(_global.highScoresScript, dataReceiver, "GET");
highScores_mc.gotoAndStop("loading");