Frame 1
stop();
Instance of Symbol 8 MovieClip "mcPreloader" in Frame 1
onClipEvent (load) {
loadInterval = setInterval(function () {
nBytesLoaded = _root.getBytesLoaded();
nBytesTotal = _root.getBytesTotal();
if ((nBytesLoaded == nBytesTotal) && (nBytesTotal > 5000)) {
_visible = false;
_parent.gotoAndPlay("start");
clearInterval(loadInterval);
}
}, 100);
}
Instance of Symbol 25 MovieClip "mcStack" in Frame 2
onClipEvent (load) {
function startGame() {
fCrash = false;
nCurRow = 1;
nCurCol = 1;
nCurPiece = 1;
sCurPiece = "left";
nDepth = 100;
nStackHeight = 0;
fFullRow = true;
nCurSway = 1;
aPieces = new Array();
aRow1 = new Array();
_parent.mcBlocker._visible = true;
buildInterval = setInterval(function () {
_parent.mcStack.mcPiece.duplicateMovieClip("mcPiece" + nDepth, nDepth);
_parent.mcStack["mcPiece" + nDepth].nRow = nCurRow;
_parent.mcStack["mcPiece" + nDepth].nCol = nCurCol;
_parent.mcStack["mcPiece" + nDepth].nOriginDepth = nDepth;
_parent.mcStack["mcPiece" + nDepth].fSelect = false;
_parent.mcStack["mcPiece" + nDepth].onRelease = chooseBlock;
_parent.mcStack["aRow" + nCurRow][nCurCol - 1] = 1;
if (sCurPiece == "left") {
_parent.mcStack["mcPiece" + nDepth]._x = qStartLeftX - ((nCurCol - 1) * qLeftDX);
_parent.mcStack["mcPiece" + nDepth]._y = (qStartLeftY - ((nCurCol - 1) * qLeftDY)) - ((nCurRow - 1) * qHeight);
} else {
_parent.mcStack["mcPiece" + nDepth].gotoAndStop(2);
_parent.mcStack["mcPiece" + nDepth]._x = qStartRightX - ((nCurCol - 1) * qRightDX);
_parent.mcStack["mcPiece" + nDepth]._y = (qStartRightY - ((nCurCol - 1) * qRightDY)) - ((nCurRow - 1) * qHeight);
}
_parent.mcStack["mcPiece" + nDepth].sDir = sCurPiece;
_parent.mcStack["mcPiece" + nDepth].nOriginX = _parent.mcStack["mcPiece" + nDepth]._x;
_parent.mcStack["mcPiece" + nDepth].nOriginY = _parent.mcStack["mcPiece" + nDepth]._y;
_parent.mcStack["mcPiece" + nDepth].mcHighLight._visible = false;
sndClunk.start();
nCurCol++;
nDepth++;
if (nCurCol > qCols) {
nCurCol = 1;
_parent.mcStack.aPieces[nCurRow - 1] = _parent.mcStack["aRow" + nCurRow];
nCurRow++;
_parent.mcStack["aRow" + nCurRow] = new Array();
nStackHeight = nStackHeight + qHeight;
if (sCurPiece == "left") {
sCurPiece = "right";
} else {
sCurPiece = "left";
}
}
if (nCurRow > qRows) {
_parent.mcBlocker._visible = false;
aPieces[nCurRow - 1] = new Array();
clearInterval(buildInterval);
}
}, qBuildSpeed);
}
function resetGame() {
fCrash = false;
nDepth = 100;
cPiece = 0;
while (cPiece < qTotalPieces) {
this["mcPiece" + (nDepth + cPiece)].removeMovieClip();
cPiece++;
}
_parent.mcNav.resetNav();
_parent.gotoAndStop("gamePlay");
}
function chooseBlock() {
if (!fSelect) {
if (checkGrab(this)) {
if (sCurPiece == "left") {
this.gotoAndStop(1);
} else {
this.gotoAndStop(2);
}
sndSlide.start();
fSelect = true;
this.startDrag(true);
this.swapDepths(qDragDepth);
this.mcHighLight._visible = true;
this.mcHighLight.gotoAndStop(sCurPiece + "Red");
checkDropArea(this);
}
} else {
fSelect = false;
setBlock(this);
}
}
function checkDropArea(mcPiece) {
checkDropAreaInterval = setInterval(function () {
if (checkBounds(mcPiece)) {
nPieceCol = getPieceCol(mcPiece);
if (!aPieces[nCurRow - 1][nPieceCol - 1]) {
mcPiece.mcHightLight._visible = true;
mcPiece.mcHighLight.gotoAndStop(sCurPiece + "Green");
} else {
mcPiece.mcHightLight._visible = true;
mcPiece.mcHighLight.gotoAndStop(sCurPiece + "Red");
}
} else {
mcPiece.mcHightLight._visible = true;
mcPiece.mcHighLight.gotoAndStop(sCurPiece + "Red");
}
}, 50);
}
function setBlock(mcPiece) {
mcPiece.stopDrag();
mcPiece.mcHighLight._visible = false;
clearInterval(checkDropAreaInterval);
if (checkBounds(mcPiece)) {
nPieceCol = getPieceCol(mcPiece);
if (!aPieces[nCurRow - 1][nPieceCol - 1]) {
mcPiece.swapDepths(nDepth + nPieceCol);
if (sCurPiece == "left") {
mcPiece._x = qStartLeftX - ((nPieceCol - 1) * qLeftDX);
mcPiece._y = (qStartLeftY - ((nPieceCol - 1) * qLeftDY)) - ((nCurRow - 1) * qHeight);
} else {
mcPiece._x = qStartRightX - ((nPieceCol - 1) * qRightDX);
mcPiece._y = (qStartRightY - ((nPieceCol - 1) * qRightDY)) - ((nCurRow - 1) * qHeight);
}
sndClunk.start();
mcPiece.nOriginX = mcPiece._x;
mcPiece.nOriginY = mcPiece._y;
mcPiece.nOriginDepth = mcPiece.getDepth();
aPieces[mcPiece.nRow - 1][mcPiece.nCol - 1] = 0;
aPieces[nCurRow - 1][nPieceCol - 1] = 1;
mcPiece.nRow = nCurRow;
mcPiece.nCol = nPieceCol;
mcPiece.sDir = sCurPiece;
fFullRow = false;
nCurCol++;
if (nCurCol > qCols) {
nCurRow++;
fFullRow = true;
aPieces[nCurRow - 1] = new Array();
nDepth = nDepth + (qCols + 1);
nCurCol = 1;
checkSway();
if (sCurPiece == "left") {
sCurPiece = "right";
} else {
sCurPiece = "left";
}
}
} else {
resetPiece(mcPiece);
}
} else {
resetPiece(mcPiece);
}
}
function resetPiece(mcPiece) {
if (mcPiece.sDir == "left") {
mcPiece.gotoAndStop(1);
} else {
mcPiece.gotoAndStop(2);
}
mcPiece._x = mcPiece.nOriginX;
mcPiece._y = mcPiece.nOriginY;
mcPiece.swapDepths(mcPiece.nOriginDepth);
sndSlide.start();
}
function getPieceCol(mcPiece) {
if (sCurPiece == "left") {
if (mcPiece._x <= qSpan) {
return(3);
}
if (mcPiece._x <= (qSpan * 2)) {
return(2);
}
return(1);
}
if (mcPiece._x >= (-qSpan)) {
return(3);
}
if (mcPiece._x >= ((-qSpan) * 2)) {
return(2);
}
return(1);
}
function checkGrab(mcPiece) {
if (fFullRow) {
if (mcPiece.nRow < (nCurRow - 1)) {
checkCollapse(mcPiece);
return(true);
}
return(false);
}
if (mcPiece.nRow < nCurRow) {
checkCollapse(mcPiece);
return(true);
}
return(false);
}
function checkSway() {
if ((nCurRow >= qStartSway) && (nCurRow < qMaxRows)) {
nOdds = Math.floor(Math.random() * qSwayOdds) + 1;
if (nOdds == Math.round(qSwayOdds / 2)) {
if (nCurSway <= qSways) {
_parent.gotoAndPlay("sway" + nCurSway);
nCurSway++;
} else {
fCrash = true;
_parent.gotoAndPlay("collapse");
}
}
} else if (nCurRow == qMaxRows) {
fCrash = true;
_parent.gotoAndPlay("collapse");
}
}
function checkCollapse(mcPiece) {
nRow = mcPiece.nRow;
nCol = mcPiece.nCol;
switch (nCol) {
case 1 :
if (!aPieces[nRow - 1][1]) {
fCrash = true;
_parent.gotoAndPlay("collapse");
}
return;
case 2 :
if ((!aPieces[nRow - 1][0]) || (!aPieces[nRow - 1][2])) {
fCrash = true;
_parent.gotoAndPlay("collapse");
}
return;
case 3 :
if (!aPieces[nRow - 1][1]) {
fCrash = true;
_parent.gotoAndPlay("collapse");
}
return;
}
}
function checkBounds(mcPiece) {
if (((mcPiece._x >= qMinX) && (mcPiece._x <= qMaxX)) && (mcPiece._y <= (-nStackHeight))) {
return(true);
}
return(false);
}
function printArray() {
cRow = aPieces.length - 1;
while (cRow >= 0) {
_parent.output = _parent.output + (("ROW " + (cRow + 1)) + ": ");
cCol = 0;
while (cCol < 3) {
_parent.output = _parent.output + (aPieces[cRow][cCol] + " ");
cCol++;
}
_parent.output = _parent.output + newline;
cRow--;
}
}
qRows = 15;
qMaxRows = 27;
qStartSway = 18;
qSways = 3;
qSwayOdds = 2;
qCols = 3;
qTotalPieces = qRows * qCols;
qBuildSpeed = 20;
qRightDX = -24.7;
qRightDY = -12.3;
qLeftDX = 24.4;
qLeftDY = -12.3;
qHeight = 16.6;
qStartLeftX = qLeftDX * (qCols - 1);
qStartLeftY = qLeftDY * (qCols - 1);
qStartRightX = qRightDX * (qCols - 1);
qStartRightY = qRightDY * (qCols - 1);
qDragDepth = 1000;
qMinX = -100;
qMaxX = 100;
qSpan = 24.5;
fCrash = false;
sndSlide = new Sound(this);
sndSlide.attachSound("slide");
sndSlide.setVolume(50);
sndClunk = new Sound(this);
sndClunk.attachSound("clunk");
}
Instance of Symbol 78 MovieClip "mcFeatures" in Frame 2
onClipEvent (load) {
_visible = false;
}
Instance of Symbol 99 MovieClip "mcNav" in Frame 2
onClipEvent (load) {
function showNav() {
this.gotoAndPlay("start");
}
function crash() {
this._x = qCrashX;
this._y = qCrashY;
this.mcCrash.gotoAndPlay("start");
}
function resetNav() {
this.mcCrash.gotoAndStop(1);
this._x = qOriginX;
this._y = qOriginY;
}
qOriginX = this._x;
qOriginY = this._y;
qCrashX = 256;
qCrashY = 241;
}
Frame 5
mcIntro.gotoAndPlay("start");
Frame 8
stop();
Frame 18
mcBlocker._visible = true;
stopDrag();
Frame 32
mcDust.gotoAndPlay("start");
Frame 57
mcNav.crash();
mcBlocker._visible = false;
stop();
Frame 59
mcBlocker._visible = true;
trace("SWAY1");
Frame 79
mcBlocker._visible = false;
gotoAndStop (8);
Frame 83
mcBlocker._visible = true;
trace("SWAY2");
Frame 115
mcBlocker._visible = false;
gotoAndStop (8);
Frame 119
mcBlocker._visible = true;
trace("SWAY3");
Frame 159
mcBlocker._visible = false;
gotoAndStop (8);
Symbol 21 MovieClip Frame 1
stop();
Symbol 21 MovieClip Frame 7
stop();
Symbol 21 MovieClip Frame 14
stop();
Symbol 21 MovieClip Frame 21
stop();
Symbol 24 MovieClip Frame 1
stop();
Symbol 24 MovieClip Frame 2
stop();
Symbol 64 MovieClip Frame 1
stop();
Symbol 64 MovieClip Frame 33
gotoAndStop (1);
Symbol 66 MovieClip Frame 1
stop();
Symbol 66 MovieClip Frame 16
stop();
Symbol 71 Button
on (release) {
getURL ("javascript:close()");
}
Symbol 77 Button
on (release) {
_visible = false;
if (_parent.mcStack.fCrash) {
_parent.mcStack.resetGame();
_parent.mcStack.startGame();
_parent.mcFeatures._visible = false;
}
}
Symbol 79 MovieClip Frame 1
stop();
Symbol 79 MovieClip Frame 16
stop();
Symbol 90 Button
on (release) {
resetNav();
_parent.mcFeatures._visible = true;
}
Symbol 94 Button
on (release) {
_parent.mcStack.resetGame();
_parent.mcStack.startGame();
_parent.mcFeatures._visible = false;
}
Symbol 98 Button
on (release) {
if (_parent.mcFeatures._visible) {
_parent.mcFeatures._visible = false;
if (_parent.mcStack.fCrash) {
_parent.mcStack.resetGame();
_parent.mcStack.startGame();
}
} else {
getURL ("javascript:close()");
}
}
Symbol 99 MovieClip Frame 1
stop();
Symbol 99 MovieClip Frame 20
stop();
Symbol 110 Button
on (release) {
_parent.mcNav.showNav();
_parent.mcStack.startGame();
this.gotoAndStop(1);
}
Symbol 111 MovieClip Frame 1
stop();
Symbol 111 MovieClip Frame 3
Symbol 111 MovieClip Frame 111
stop();