Frame 1
fscommand ("allowscale", "false");
_quality = "low";
Frame 35
stop();
Frame 36
function doLoad() {
rank = "please wait...";
init();
}
function doEnterFrame() {
gameLoop();
}
function doMouseMove() {
if ((arena.grid.hitTest(_xmouse, _ymouse) && (!completed)) && (!gameover)) {
dropperX = Math.ceil(((_xmouse - arena.grid._x) - screenX2) / tileWidth);
dropperY = Math.ceil(((_ymouse - arena.grid._y) - screenY2) / tileHeight);
Mouse.hide();
} else {
Mouse.show();
}
}
function doMouseDown() {
if ((arena.grid.hitTest(_xmouse, _ymouse) && (!completed)) && (!gameover)) {
drop = 2;
}
}
function doKeyDown() {
K = null;
if ((!completed) && (!gameover)) {
K = Key.getCode();
}
if (K == 38) {
up = 1;
}
if (K == 40) {
down = 1;
}
if (K == 37) {
left = 1;
}
if (K == 39) {
right = 1;
}
if (K == 32) {
rotate = 1;
}
if (K == 90) {
drop = 1;
}
if (((((K && (K != 38)) && (K != 40)) && (K != 37)) && (K != 39)) && (K != 32)) {
drop = 1;
}
}
function doKeyUp() {
K = null;
if ((!completed) && (!gameover)) {
K = Key.getCode();
}
if (K == 38) {
up = 0;
}
if (K == 40) {
down = 0;
}
if (K == 37) {
left = 0;
}
if (K == 39) {
right = 0;
}
if (K == 32) {
rotate = 0;
}
if (K == 90) {
drop = 0;
}
if (((((K && (K != 38)) && (K != 40)) && (K != 37)) && (K != 39)) && (K != 32)) {
drop = 0;
}
}
function init() {
droppertimerMC._visible = true;
score = 0;
displayscore = 0;
completed = false;
gameover = false;
bonus = 10000;
scoreup = new Sound();
scoreup.attachSound("scoreup");
scoreup.setVolume(50);
singlelinescore = 100;
screenX2 = screenX / 2;
screenY2 = screenY / 2;
attachMovie("flasher", "flasher", 10000);
flasher._x = screenX2;
flasher._y = screenY2;
nextShape = 7;
tileWidth = 20;
tileHeight = 20;
myGrid = new grid(12, 12);
attachMovie("arena", "arena", 1000);
arena._x = screenX2;
arena._y = screenY2;
displayGrid(myGrid);
displayPreview();
}
function gameLoop() {
if (up) {
dropperY--;
}
if (down) {
dropperY++;
}
if (left) {
dropperX--;
}
if (right) {
dropperX++;
}
if (dropperY < (-(myGrid.gridY / 2))) {
dropperY = -(myGrid.gridY / 2);
}
if ((myGrid.gridY / 2) < dropperY) {
dropperY = myGrid.gridY / 2;
}
if (dropperX < (-(myGrid.gridX / 2))) {
dropperX = -(myGrid.gridX / 2);
}
if ((myGrid.gridX / 2) < dropperX) {
dropperX = myGrid.gridX / 2;
}
if (rotate) {
playSFX("rotate");
dropperRot++;
rotate = 0;
}
if (3 < dropperRot) {
dropperRot = 0;
}
if (drop) {
dropShape(myGrid, shape, dropperX, dropperY, dropperRot);
}
if (bingoFlag) {
bingoTimer--;
if (bingoTimer == 5) {
yellowin = false;
moveTiles(myGrid);
displayGrid(myGrid);
if (yellowin) {
playSFX("yellowin");
} else {
playSFX("slide");
}
if (completed) {
flasher.gotoAndPlay(1);
playSFX("winner");
_root.arena.preview.removeMovieClip();
_root.arena.grid.current.removeMovieClip();
droppertimerMC._visible = false;
_root.arena.grid.attachMovie("winner", "winner", 11000);
}
}
if (bingoTimer == 0) {
bingoFlag = false;
}
} else {
if ((!completed) && (!gameover)) {
displayDropper(myGrid, shape, dropperX, dropperY, dropperRot);
bonus = Math.floor(bonus * 0.9999);
if (0 >= bonus) {
gameover = true;
flasher.gotoAndPlay(1);
playSFX("loser");
_root.arena.preview.removeMovieClip();
_root.arena.grid.current.removeMovieClip();
droppertimerMC._visible = false;
_root.arena.grid.attachMovie("loser", "loser", 11000);
}
}
if (displayScore < score) {
if (completed) {
score = score + Math.ceil(bonus / 5);
bonus = bonus - Math.ceil(bonus / 5);
}
displayScore = displayScore + Math.floor((score - displayScore) / 5);
if (Math.abs(score - displayScore) < 10) {
displayScore = score;
}
scoreup.start();
}
}
}
function grid(x, y) {
this.gridX = x;
this.gridY = y;
this.alpha = 100;
this.tiles = new Array("");
this.totalTiles = this.gridX * this.gridY;
myTest = new Array(0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0);
i = 0;
y = 1;
while (this.gridY >= y) {
x = 1;
while (this.gridX >= x) {
this.tiles.push(new tile(x, y, 1));
i++;
x++;
}
y++;
}
this.tiles[1].frame = 3;
this.tiles[this.gridX].frame = 3;
this.tiles[(this.gridX * (this.gridY - 1)) + 1].frame = 3;
this.tiles[this.gridX * this.gridY].frame = 3;
}
function tile(x, y, frame) {
this.frame = frame;
this.cache = frame;
this.x = x;
this.y = y;
this.dx = 0;
this.dy = 0;
}
function displayGrid(grid) {
_root.arena.attachMovie("blank", "grid", 2);
_root.arena.grid._x = (screenX2 / 2) - 10;
_root.arena.grid.attachMovie("border", "border", 10000);
_root.arena.grid.border._xscale = grid.gridX * _root.tileWidth;
_root.arena.grid.border._yscale = grid.gridY * _root.tileHeight;
_root.arena.grid.attachMovie("target", "target", 10);
_root.arena.grid.target._xscale = grid.gridX * _root.tileWidth;
_root.arena.grid.target._yscale = grid.gridX * _root.tileHeight;
with (grid) {
i = 1;
while (i < tiles.length) {
if (tiles[i].frame == 3) {
extradepth = 1000;
} else {
extradepth = 0;
}
_root.arena.grid.attachMovie("tile", "tile" + i, (i + 100) + extradepth);
myTile = _root.arena.grid["tile" + i];
myTile._xscale = _root.tileWidth;
myTile._yscale = _root.tileHeight;
myTile._x = ((tiles[i].x * _root.tileWidth) - ((_root.tileWidth * gridX) / 2)) - (_root.tileWidth / 2);
myTile._y = ((tiles[i].y * _root.tileHeight) - ((_root.tileHeight * gridY) / 2)) - (_root.tileHeight / 2);
myTile.gotoAndStop(tiles[i].frame);
if (tiles[i].frame == 3) {
if (((gridX / 2) >= tiles[i].x) && ((gridY / 2) >= tiles[i].y)) {
myTile.special.gotoAndStop(1);
}
if (((gridX / 2) < tiles[i].x) && ((gridY / 2) >= tiles[i].y)) {
myTile.special.gotoAndStop(2);
}
if (((gridX / 2) >= tiles[i].x) && ((gridY / 2) < tiles[i].y)) {
myTile.special.gotoAndStop(3);
}
if (((gridX / 2) < tiles[i].x) && ((gridY / 2) < tiles[i].y)) {
myTile.special.gotoAndStop(4);
}
}
myTile._alpha = tiles[i].alpha;
myTile.dx = tiles[i].dx;
myTile.dy = tiles[i].dy;
i++;
}
}
}
function displayPreview() {
shape = nextShape;
droppertimer = 0;
if (!shape) {
shape = random(9) + 1;
}
nextShape = random(9) + 1;
_root.arena.attachMovie("blank", "preview", 1);
_root.arena.preview._x = ((2 * _root.tileWidth) - (screenX2 / 2)) + 10;
_root.arena.preview._y = 30;
_root.arena.preview.attachMovie("border", "border", 10000);
_root.arena.preview.border._xscale = 4 * _root.tileWidth;
_root.arena.preview.border._yscale = 4 * _root.tileHeight;
y = 1;
while (4 >= y) {
x = 1;
while (4 >= x) {
i = x + (4 * (y - 1));
_root.arena.preview.attachMovie("tile", "tile" + i, i + 100);
myTile = _root.arena.preview["tile" + i];
myTile._xscale = _root.tileWidth;
myTile._yscale = _root.tileHeight;
myTile._x = (x * _root.tileWidth) - (2.5 * _root.tileWidth);
myTile._y = (y * _root.tileHeight) - (2.5 * _root.tileHeight);
myTile.gotoAndStop(_root.shapes[nextShape][i] + 1);
x++;
}
y++;
}
}
function dropShape(grid, shape, tx, ty, rot) {
if (invalidDrop) {
playSFX("invalid");
drop = 0;
return(undefined);
}
playSFX("drop");
myCurrentShape = rotateShape(shapes[shape], rot);
y = 1;
while (4 >= y) {
x = 1;
while (4 >= x) {
i = x + (4 * (y - 1));
realX = (x + tx) + 4;
realY = (y + ty) + 4;
realI = realX + (grid.gridX * (realY - 1));
if (myCurrentShape[i]) {
grid.tiles[realI].frame = 2;
}
x++;
}
y++;
}
if (drop == 1) {
dropperX = 0;
dropperY = 0;
}
bingo(grid);
displayGrid(grid);
displayPreview();
drop = 0;
dropScale = 5;
}
function playSFX(label) {
sfx.gotoAndStop(label);
}
function displayDropper(grid, shape, tx, ty, rot) {
droppertimer++;
if (100 < droppertimer) {
playSFX("failedtodrop");
bonus = bonus * 0.5;
displayPreview();
dropScale = 5;
}
_root.droppertimerMC.gotoAndStop(droppertimer);
if (!dropScale) {
dropScale = 5;
}
if (1 < dropScale) {
dropScale = dropScale * 0.75;
}
if (dropScale < 1) {
dropScale = 1;
}
_root.arena.grid.attachMovie("blank", "current", 5000);
_root.arena.grid.current._x = tx * tileWidth;
_root.arena.grid.current._y = ty * tileHeight;
_root.arena.grid.current._xscale = dropScale * 100;
_root.arena.grid.current._yscale = dropScale * 100;
myCurrentShape = rotateShape(shapes[shape], rot);
invalidDrop = false;
y = 1;
while (4 >= y) {
x = 1;
while (4 >= x) {
i = x + (4 * (y - 1));
_root.arena.grid.current.attachMovie("tile", "tile" + i, i + 100);
myTile = _root.arena.grid.current["tile" + i];
myTile._xscale = _root.tileWidth;
myTile._yscale = _root.tileHeight;
myTile._x = (x * _root.tileWidth) - (2.5 * _root.tileWidth);
myTile._y = (y * _root.tileHeight) - (2.5 * _root.tileHeight);
if (myCurrentShape[i]) {
myTile.gotoAndStop(4);
}
realX = (x + tx) + 4;
realY = (y + ty) + 4;
realI = realX + (grid.gridX * (realY - 1));
if (myCurrentShape[i] && (((((1 < grid.tiles[realI].frame) || (realX < 1)) || (grid.gridX < realX)) || (realY < 1)) || (grid.gridY < realY))) {
myTile.gotoAndStop(5);
invalidDrop = true;
}
myTile.shadow._alpha = 100;
x++;
}
y++;
}
}
function rotateShape(thisShape, rot) {
while (0 < rot) {
cache = thisShape;
thisShape = new Array();
thisShape[1] = cache[13];
thisShape[2] = cache[9];
thisShape[3] = cache[5];
thisShape[4] = cache[1];
thisShape[5] = cache[14];
thisShape[6] = cache[10];
thisShape[7] = cache[6];
thisShape[8] = cache[2];
thisShape[9] = cache[15];
thisShape[10] = cache[11];
thisShape[11] = cache[7];
thisShape[12] = cache[3];
thisShape[13] = cache[16];
thisShape[14] = cache[12];
thisShape[15] = cache[8];
thisShape[16] = cache[4];
rot--;
}
return(thisShape);
}
function bingo(grid) {
bingosx = 0;
bingosy = 0;
bingos = 0;
bingoFlag = false;
y = 1;
while (grid.gridY >= y) {
bingoCount = 0;
validBingo = true;
x = 1;
while (grid.gridX >= x) {
i = x + ((y - 1) * grid.gridX);
if (grid.tiles[i].frame == 3) {
validBingo = false;
}
if (1 < grid.tiles[i].frame) {
bingoCount++;
}
x++;
}
if ((bingoCount == grid.gridX) && (validBingo)) {
bingoFlag = true;
bingos++;
bingosx++;
xx = 1;
while (grid.gridX >= xx) {
ii = xx + ((y - 1) * grid.gridX);
grid.tiles[ii].frame = 10;
xx++;
}
if ((grid.gridY / 2) >= y) {
while (i >= 1) {
grid.tiles[i].dy = grid.tiles[i].dy + 1;
i--;
}
} else {
i++;
while (grid.totalTiles >= i) {
grid.tiles[i].dy = grid.tiles[i].dy - 1;
grid.tiles[ii].frame = 10;
i++;
}
}
}
y++;
}
x = 1;
while (grid.gridX >= x) {
bingoCount = 0;
validBingo = true;
y = 1;
while (grid.gridY >= y) {
i = x + ((y - 1) * grid.gridX);
if (grid.tiles[i].frame == 3) {
validBingo = false;
}
if (1 < grid.tiles[i].frame) {
bingoCount++;
}
y++;
}
if ((bingoCount == grid.gridY) && (validBingo)) {
if (invalidBingo) {
playSFX("invalid");
drop = 0;
return(undefined);
}
bingoFlag = true;
bingos++;
bingosy++;
yy = 1;
while (grid.gridY >= yy) {
ii = x + ((yy - 1) * grid.gridX);
grid.tiles[ii].frame = 10;
yy++;
}
if ((grid.gridX / 2) >= x) {
tempx = x;
while (tempx >= 1) {
y = 1;
while (grid.gridY >= y) {
i = tempx + ((y - 1) * grid.gridX);
grid.tiles[i].dx = grid.tiles[i].dx + 1;
y++;
}
tempx--;
}
} else {
tempx = x + 1;
while (grid.gridX >= tempx) {
y = 1;
while (grid.gridY >= y) {
i = tempx + ((y - 1) * grid.gridX);
grid.tiles[i].dx = grid.tiles[i].dx - 1;
y++;
}
tempx++;
}
}
}
x++;
}
if (bingoFlag) {
multiplier = 0;
bingoTimer = 15;
if (bingos == 1) {
playSFX("bingo");
score = score + singlelinescore;
} else {
playSFX("megabingo");
multiplier = bingos * bingos;
score = score + (singlelinescore * multiplier);
}
if ((0 < bingosx) && (0 < bingosy)) {
playSFX("megamegabingo");
multiplier = ((bingos * bingos) * bingos) * bingos;
score = score + (singlelinescore * multiplier);
}
if (0 < multiplier) {
multiplier = "x" + multiplier;
_root.arena.attachMovie("multiplierMC", "multiplierMC", 12000);
_root.arena.multiplierMC._x = _root.arena.grid._x;
}
}
}
function moveTiles(grid) {
i = 1;
while (grid.totalTiles >= i) {
if (grid.tiles[i].frame == 10) {
grid.tiles[i].frame = 1;
}
grid.tiles[i].cache = grid.tiles[i].frame;
grid.tiles[i].frame = 1;
i++;
}
i = 1;
while (grid.totalTiles >= i) {
if (!(((grid.tiles[i].dx == 0) && (grid.tiles[i].dy == 0)) && (grid.tiles[i].cache == 1))) {
shiftTile(i, grid);
}
grid.tiles[i].dx = 0;
grid.tiles[i].dy = 0;
i++;
}
if ((((grid.tiles[66].frame == 3) && (grid.tiles[67].frame == 3)) && (grid.tiles[78].frame == 3)) && (grid.tiles[79].frame == 3)) {
completed = true;
}
}
function shiftTile(i, grid) {
thisX = grid.tiles[i].x;
thisY = grid.tiles[i].y;
newX = thisX + grid.tiles[i].dx;
newY = thisY + grid.tiles[i].dy;
foundit = false;
z = 1;
while (grid.totalTiles >= z) {
if ((grid.tiles[z].x == newX) && (grid.tiles[z].y == newY)) {
foundit = true;
break;
}
z++;
}
if (foundit) {
grid.tiles[z].frame = grid.tiles[i].cache;
if ((z != i) && (grid.tiles[z].frame == 3)) {
if ((grid.tiles[z].x == 6) && (grid.tiles[z].y == 6)) {
yellowin = true;
}
if ((grid.tiles[z].x == 6) && (grid.tiles[z].y == 7)) {
yellowin = true;
}
if ((grid.tiles[z].x == 7) && (grid.tiles[z].y == 6)) {
yellowin = true;
}
if ((grid.tiles[z].x == 7) && (grid.tiles[z].y == 7)) {
yellowin = true;
}
}
}
}
function encrypt(input) {
theScore = new String(input);
score_length = theScore.length;
outPut = new String();
i = 0;
while (score_length >= i) {
currentChar = "";
currentChar = theScore.charAt(i);
if (currentChar == "1") {
outPut = outPut add "by";
} else if (currentChar == "2") {
outPut = outPut add "cx";
} else if (currentChar == "3") {
outPut = outPut add "dw";
} else if (currentChar == "4") {
outPut = outPut add "ev";
} else if (currentChar == "5") {
outPut = outPut add "fu";
} else if (currentChar == "6") {
outPut = outPut add "gt";
} else if (currentChar == "7") {
outPut = outPut add "hs";
} else if (currentChar == "8") {
outPut = outPut add "ir";
} else if (currentChar == "9") {
outPut = outPut add "jq";
} else if (currentChar == "0") {
outPut = outPut add "az";
} else if (currentChar == ".") {
outPut = outPut add "kp";
}
i++;
}
outPut = outPut add "mn";
i = 0;
while (score_length >= i) {
currentChar = "";
currentChar = theScore.charAt(i);
if (currentChar == "1") {
outPut = outPut add "jq";
} else if (currentChar == "2") {
outPut = outPut add "ir";
} else if (currentChar == "3") {
outPut = outPut add "hs";
} else if (currentChar == "4") {
outPut = outPut add "gt";
} else if (currentChar == "5") {
outPut = outPut add "fu";
} else if (currentChar == "6") {
outPut = outPut add "ev";
} else if (currentChar == "7") {
outPut = outPut add "dw";
} else if (currentChar == "8") {
outPut = outPut add "cx";
} else if (currentChar == "9") {
outPut = outPut add "by";
} else if (currentChar == "0") {
outPut = outPut add "kp";
} else if (currentChar == ".") {
outPut = outPut add "az";
}
i++;
}
return(outPut);
}
function submitscore() {
if (http_host.length < 1) {
http_host = "217.199.181.161";
}
url = ((((((((("http://" + http_host) + "/games/quad/scores/act:save/score:") + escape(encrypt(score))) + "/name:") + escape(name)) + "/email:") + escape(email)) + "/decache:") + random(100)) + "/";
loadVariables (url, _root);
}
fscommand ("allowscale", "false");
fscommand ("trapallkeys", "true");
_quality = "low";
screenX = 530;
screenY = 280;
stop();
shapes = new Array();
shapes[1] = new Array(9, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0);
shapes[2] = new Array(9, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0);
shapes[3] = new Array(9, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0);
shapes[4] = new Array(9, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1, 1, 0);
shapes[5] = new Array(9, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0);
shapes[6] = new Array(9, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 1, 0, 0);
shapes[7] = new Array(9, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0);
shapes[8] = new Array(9, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0);
shapes[9] = new Array(9, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
Array.prototype.copy = Array.prototype.slice;
Instance of Symbol 96 MovieClip in Frame 36
onClipEvent (load) {
_root.doLoad();
}
onClipEvent (enterFrame) {
_root.doEnterFrame();
}
onClipEvent (keyDown) {
_root.doKeyDown();
}
onClipEvent (keyUp) {
_root.doKeyUp();
}
onClipEvent (mouseMove) {
_root.doMouseMove();
}
onClipEvent (mouseDown) {
_root.doMouseDown();
}
Symbol 18 MovieClip [tile] Frame 1
stop();
Symbol 28 MovieClip [flasher] Frame 1
play();
Symbol 28 MovieClip [flasher] Frame 6
stop();
Symbol 33 MovieClip [loser] Frame 30
stop();
Symbol 43 Button
on (release) {
if ((2 < _root.name.length) && (4 < _root.email.length)) {
_root.playSFX("yellowin");
play();
} else {
_root.playSFX("invalid");
}
}
Symbol 53 Button
on (release) {
getURL (((((("http://" + _root.http_host) + "/games/quad/scores/email:") + escape(_root.email)) + "/decache:") + random(100)) + "/");
}
Symbol 54 MovieClip [winner] Frame 30
stop();
Symbol 54 MovieClip [winner] Frame 31
_root.submitscore();
Symbol 54 MovieClip [winner] Frame 100
stop();
Symbol 56 MovieClip [multiplierMC] Frame 10
this.removeMovieClip();
Symbol 86 MovieClip Frame 1
stop();
Symbol 86 MovieClip Frame 8
gotoAndStop (1);
Symbol 86 MovieClip Frame 22
gotoAndStop (1);
Symbol 86 MovieClip Frame 30
gotoAndStop (1);
Symbol 86 MovieClip Frame 40
gotoAndStop (1);
Symbol 86 MovieClip Frame 62
gotoAndStop (1);
Symbol 86 MovieClip Frame 71
gotoAndStop (1);
Symbol 86 MovieClip Frame 81
gotoAndStop (1);
Symbol 86 MovieClip Frame 92
gotoAndStop (1);
Symbol 86 MovieClip Frame 107
gotoAndStop (1);
Symbol 86 MovieClip Frame 118
gotoAndStop (1);
Symbol 86 MovieClip Frame 150
gotoAndStop (1);
Symbol 94 Button
on (release) {
play();
}
Symbol 98 Button
on (release) {
init();
}