Frame 1
snd = new Sound();
snd.setVolume(0);
stop();
Instance of Symbol 125 MovieClip in Frame 1
onClipEvent (load) {
total = _root.getBytesTotal();
}
onClipEvent (enterFrame) {
sofar = _root.getBytesLoaded();
percent = int(100 * (sofar / total));
if (percent >= 100) {
_root.gotoAndPlay("play");
}
this.loading = ("Loading... " + percent) + "%";
}
Frame 3
function Init() {
level = 0;
gameScore = 0;
score = gameScore;
mcGetReady._visible = false;
mcGameOver._visible = false;
mcMeter._visible = false;
gameIsOver = false;
cols = 10;
rows = 8;
depth = 100;
grace = 8000;
flowTime = 1000;
if (sndPipe == undefined) {
sndPipe = new Sound();
sndPipe.attachSound("sndPipe");
sndPipe.setVolume(100);
sndLoop1 = new Sound();
sndLoop1.attachSound("sndLoop1");
sndBoom = new Sound();
sndBoom.attachSound("sndBoom");
sndBlast = new Sound();
sndBlast.attachSound("sndBlast");
sndDiesel = new Sound();
sndDiesel.attachSound("sndDiesel");
sndDunk = new Sound();
sndDunk.attachSound("sndDunk");
sndWaterLoop = new Sound();
sndWaterLoop.attachSound("sndWaterLoop");
sndFlush = new Sound();
sndFlush.attachSound("sndFlush");
sndAlarm = new Sound();
sndAlarm.attachSound("sndAlarm");
sndWaterBloop = new Sound();
sndWaterBloop.attachSound("sndWaterBloop");
sndLevelComplete = new Sound();
sndLevelComplete.attachSound("sndLevelComplete");
}
mcInstructions._visible = true;
}
function NextLevel() {
level++;
grace = 12000 - (level * 1000);
if (grace < 4000) {
grace = 4000;
}
flowTime = 6000 - ((level / 2) * 1000);
if (flowTime < 750) {
flowTime = 750;
}
flowing = false;
mcMeter._visible = true;
mcMeter.mcBar._xscale = 100;
levelScore = 0;
fullPipes = 0;
bombSet = false;
curPiece = int(Math.random() * 7) + 2;
mcPiece.gotoAndStop(curPiece);
mcPiece.swapDepths(99999);
mcGameOver.swapDepths(99997);
nextPiece = int(Math.random() * 7) + 2;
mcNext.gotoAndStop(nextPiece);
if (mcSpill != undefined) {
mcSpill.removeMovieClip();
}
if (flowArray != undefined) {
var i = 0;
while (i < flowArray.length) {
flowArray[i].removeMovieClip();
i++;
}
}
flowArray = new Array();
numBombs = 11 - level;
if (numBombs < 1) {
numBombs = 1;
}
mcBombsLeft.left = numBombs;
sndLevelComplete.stop("sndLevelComplete");
mcInstructions._visible = false;
CreateBoard();
}
function PlacePump() {
var r = int((Math.random() * (rows - 4)) + 2);
var c = int((Math.random() * (cols - 4)) + 2);
mcPumpBox = boardArray[(r * cols) + c];
mcPumpBox.gotoAndStop("pump");
var a = [90, 180, 270, 0];
var i = int(Math.random() * 4);
mcPumpBox.mcPump._rotation = a[i];
mcPumpBox.swapDepths(100);
mcPumpBox.flowTime = 0;
switch (a[i]) {
case 0 :
mcPumpBox.flowDir = "n";
return;
case 90 :
mcPumpBox.flowDir = "e";
return;
case 180 :
mcPumpBox.flowDir = "s";
return;
case 270 :
mcPumpBox.flowDir = "w";
}
}
function PlaceDrain() {
var ra = [0, rows - 1];
var r = ra[int(Math.random() * ra.length)];
var c = int(Math.random() * cols);
mcDrainBox = boardArray[(r * cols) + c];
mcDrainBox.gotoAndStop("drain");
mcDrainBox.drain = true;
}
function CreateBoard() {
if (boardArray != undefined) {
var i = 0;
while (i < boardArray.length) {
if (boardArray[i].mc100 != undefined) {
boardArray[i].mc100;
}
boardArray[i].removeMovieClip();
i++;
}
}
boardArray = new Array();
var y = 0;
while (y < rows) {
var x = 0;
while (x < cols) {
depth++;
attachMovie("mcBox", "mcBox" + depth, depth);
var clip = _root["mcBox" + depth];
clip._x = (x * clip._width) + 60;
clip._y = (y * clip._height) + 60;
clip.row = y;
clip.col = x;
clip.flowTime = flowTime;
clip.flowStartTime = 0;
clip.flow = false;
clip.drain = false;
clip.gotoAndStop("empty");
boardArray.push(clip);
x++;
}
y++;
}
PlacePump();
PlaceDrain();
}
function RollOverBox() {
var i = 0;
while (i < boardArray.length) {
var clip = boardArray[i];
if (clip.hitTest(_root._xmouse, _root._ymouse, false)) {
curBox = clip;
}
i++;
}
}
function AdvanceFlow() {
var elapsed = (getTimer() - mcFlowBox.flowStartTime);
if (elapsed > mcFlowBox.flowTime) {
var rot = 0;
switch (mcFlowBox.flowDir) {
case "n" :
rot = 180;
break;
case "s" :
rot = 0;
break;
case "e" :
rot = 270;
break;
case "w" :
rot = 90;
}
var adjClip = GetAdjacentBoxClip(mcFlowBox, mcFlowBox.flowDir);
if ((!adjClip) or (adjClip == mcPumpBox)) {
var x = mcFlowBox._x;
var y = mcFlowBox._y;
switch (mcFlowBox.flowDir) {
case "n" :
y = y - mcFlowBox._height;
break;
case "s" :
y = y + mcFlowBox._height;
break;
case "e" :
x = x + mcFlowBox._width;
break;
case "w" :
x = x - mcFlowBox._width;
}
Spill(x, y, rot);
}
if (adjClip._currentframe == 1) {
Spill(adjClip._x, adjClip._y, rot);
} else if ((adjClip._currentframe > 1) and (adjClip._currentframe < 9)) {
switch (mcFlowBox.flowDir) {
case "n" :
if ((((adjClip.pipe != "ns") && (adjClip.pipe != "nsew")) && (adjClip.pipe != "nw")) && (adjClip.pipe != "ne")) {
Spill(adjClip._x, adjClip._y, rot);
} else {
AddNewFlow(adjClip, mcFlowBox.flowDir);
}
break;
case "s" :
if ((((adjClip.pipe != "ns") && (adjClip.pipe != "nsew")) && (adjClip.pipe != "sw")) && (adjClip.pipe != "se")) {
Spill(adjClip._x, adjClip._y, rot);
} else {
AddNewFlow(adjClip, mcFlowBox.flowDir);
}
break;
case "e" :
if ((((adjClip.pipe != "ew") && (adjClip.pipe != "nsew")) && (adjClip.pipe != "nw")) && (adjClip.pipe != "sw")) {
Spill(adjClip._x, adjClip._y, rot);
} else {
AddNewFlow(adjClip, mcFlowBox.flowDir);
}
break;
case "w" :
if ((((adjClip.pipe != "ew") && (adjClip.pipe != "nsew")) && (adjClip.pipe != "ne")) && (adjClip.pipe != "se")) {
Spill(adjClip._x, adjClip._y, rot);
} else {
AddNewFlow(adjClip, mcFlowBox.flowDir);
}
}
} else if (adjClip.drain == true) {
switch (mcFlowBox.flowDir) {
case "n" :
mcDrainBox.mcDrain.gotoAndStop("s");
break;
case "s" :
mcDrainBox.mcDrain.gotoAndStop("n");
break;
case "e" :
mcDrainBox.mcDrain.gotoAndStop("w");
break;
case "w" :
mcDrainBox.mcDrain.gotoAndStop("e");
}
LevelComplete();
}
} else {
var frame = (int((50 * elapsed) / mcFlowBox.flowTime) + 1);
flowArray[flowArray.length - 1].goo.gotoAndStop(frame);
}
}
function AddNewFlow(clip, dir) {
depth++;
_root.attachMovie("mcGoo", "goo" + depth, depth);
var goo = _root["goo" + depth];
depth++;
goo._x = clip._x;
goo._y = clip._y;
switch (dir) {
case "n" :
switch (clip.pipe) {
case "nsew" :
case "ns" :
goo.gotoAndStop("n");
clip.flowDir = "n";
break;
case "nw" :
goo.gotoAndStop("nw");
clip.flowDir = "w";
break;
case "ne" :
goo.gotoAndStop("ne");
clip.flowDir = "e";
break;
}
break;
case "s" :
switch (clip.pipe) {
case "nsew" :
case "ns" :
goo.gotoAndStop("s");
clip.flowDir = "s";
break;
case "sw" :
goo.gotoAndStop("sw");
clip.flowDir = "w";
break;
case "se" :
goo.gotoAndStop("se");
clip.flowDir = "e";
break;
}
break;
case "e" :
switch (clip.pipe) {
case "nsew" :
case "ew" :
goo.gotoAndStop("e");
clip.flowDir = "e";
break;
case "sw" :
goo.gotoAndStop("en");
clip.flowDir = "n";
break;
case "nw" :
goo.gotoAndStop("es");
clip.flowDir = "s";
break;
}
break;
case "w" :
switch (clip.pipe) {
case "nsew" :
case "ew" :
goo.gotoAndStop("w");
clip.flowDir = "w";
break;
case "se" :
goo.gotoAndStop("wn");
clip.flowDir = "n";
break;
case "ne" :
goo.gotoAndStop("ws");
clip.flowDir = "s";
break;
}
}
flowArray.push(goo);
clip.flow = true;
mcPiece.bomb = false;
mcPiece.gotoAndStop(curPiece);
mcFlowBox = clip;
mcFlowBox.flowStartTime = getTimer();
if (fullPipes > 0) {
var amnt = 100;
if ((mcFlowBox.pipe == "nsew") and mcFlowBox.flow) {
amnt = 300;
}
AddToScore(amnt);
}
fullPipes++;
}
function Spill(x, y, rot) {
depth++;
attachMovie("mcSpill", "clip" + depth, depth);
mcSpill = _root["clip" + depth];
mcSpill._x = x;
mcSpill._y = y;
mcSpill._rotation = rot;
sndAlarm.start();
GameOver();
}
function GameOver() {
gameIsOver = true;
mcPiece.gotoAndStop("empty");
state = "end_level";
stateStart = getTimer();
}
function GetAdjacentBoxClip(originClip, dir) {
if (originClip == undefined) {
return(0);
}
var oRow = originClip.row;
var oCol = originClip.col;
switch (dir) {
case "n" :
if (oRow <= 0) {
return(0);
}
var i = (((oRow - 1) * cols) + oCol);
return(boardArray[i]);
case "s" :
if (oRow >= (rows - 1)) {
return(0);
}
var i = (((oRow + 1) * cols) + oCol);
return(boardArray[i]);
case "e" :
if (oCol >= (cols - 1)) {
return(0);
}
var i = (((oRow * cols) + oCol) + 1);
return(boardArray[i]);
case "w" :
if (oCol <= 0) {
return(0);
}
var i = (((oRow * cols) + oCol) - 1);
return(boardArray[i]);
}
return(0);
}
function AddToScore(n) {
levelScore = levelScore + n;
if (levelScore < 0) {
levelScore = 0;
}
gameScore = gameScore + n;
if (gameScore < 0) {
gameScore = 0;
}
score = gameScore;
}
function LevelComplete() {
AddToScore(600);
state = "end_level";
sndLoop1.stop("sndLoop1");
sndDiesel.stop("sndDiesel");
sndWaterLoop.stop("sndWaterLoop");
sndLevelComplete.start(0, 6);
}
function Blast() {
if ((mcFlowBox == undefined) or (state != "play")) {
return(undefined);
}
flowArray[flowArray.length - 1].goo.gotoAndStop(50);
mcFlowBox.flowTime = 10;
sndBlast.start();
mc50._x = mcPumpBox._x;
mc50._y = mcPumpBox._y;
mc50.swapDepths(++depth);
mc50._visible = true;
mc50.gotoAndPlay(2);
AddToScore(50);
}
Init();
stop();
_root.onEnterFrame = function () {
if (state == "end_level") {
var i = 0;
while (i < boardArray.length) {
var clip = boardArray[i];
if ((clip.pipe != undefined) and (clip.pipe != "")) {
if (!clip.flow) {
if (clip.mc100 == undefined) {
depth++;
clip.attachMovie("mc100", "mc100", depth);
clip.mc100._x = clip.mcPipe._x;
clip.mc100._y = clip.mcPipe._y;
clip.mc100._alpha = 50;
AddToScore(-100);
sndWaterBloop.start();
}
clip.mcPipe._xscale = clip.mcPipe._xscale - 10;
clip.mcPipe._yscale = clip.mcPipe._yscale - 10;
clip.mcPipe._rotation = clip.mcPipe._rotation - 20;
if (clip.mcPipe._xscale < 1) {
clip.mcPipe._visible = false;
clip.pipe = "";
}
return(undefined);
}
}
i++;
}
if (gameIsOver) {
if (getTimer() < (stateStart + 2000)) {
return(undefined);
}
mcGameOver.swapDepths(99999);
mcGameOver._visible = true;
sndLoop1.stop("sndLoop1");
sndDiesel.stop("sndDiesel");
sndWaterLoop.stop("sndWaterLoop");
sndFlush.start();
}
if (mcBeginBtn == undefined) {
}
mcBeginBtn._visible = true;
state = "begin";
return(undefined);
}
if (gameIsOver or (state != "play")) {
mcPiece._visible = false;
return(undefined);
}
if ((mcPumpBox.mcPump._currentframe == 1) and (getTimer() > (startTime + grace))) {
mcPumpBox.mcPump.gotoAndPlay("on");
flowing = true;
mcFlowBox = mcPumpBox;
mcFlowBox.flowStartTime = getTimer();
mcMeter._visible = false;
sndDiesel.start(0, 1000);
sndWaterLoop.start(0, 1000);
}
var x = _xmouse;
var y = _ymouse;
if ((((x < 40) or (y < 40)) or (x > 440)) or (y > 360)) {
mcPiece._visible = false;
} else {
mcPiece._visible = true;
mcPiece._x = x;
mcPiece._y = y;
}
if (flowing) {
AdvanceFlow();
} else {
var elapsed = (getTimer() - startTime);
var percent = int((elapsed / grace) * 100);
mcMeter.mcBar._xscale = 100 - percent;
}
};
_root.onMouseMove = function () {
if (gameIsOver or (state != "play")) {
return(undefined);
}
var x = _xmouse;
var y = _ymouse;
if (!mcPiece._visible) {
return(undefined);
}
mcPiece._x = x;
mcPiece._y = y;
if (mcPiece.bomb == true) {
if (!curBox.hitTest(x, y, false)) {
mcPiece.bomb = false;
mcPiece.gotoAndStop(curPiece);
}
}
};
_root.onMouseDown = function () {
if (gameIsOver or (!mcPiece._visible)) {
return(undefined);
}
RollOverBox();
if ((curBox._currentframe == 1) and ((mcPiece.bomb == false) or (mcPiece.bomb == undefined))) {
curBox.gotoAndStop(curPiece);
sndPipe.start();
switch (curPiece) {
case 2 :
curBox.pipe = "ns";
break;
case 3 :
curBox.pipe = "ew";
break;
case 4 :
curBox.pipe = "nsew";
break;
case 5 :
curBox.pipe = "nw";
break;
case 6 :
curBox.pipe = "ne";
break;
case 7 :
curBox.pipe = "sw";
break;
case 8 :
curBox.pipe = "se";
break;
}
curPiece = nextPiece;
mcPiece.gotoAndStop(curPiece);
if ((pieceArray == undefined) or (!pieceArray.length)) {
pieceArray = [2, 3, 4, 5, 6, 7, 8];
}
var i = int(Math.random() * pieceArray.length);
nextPiece = pieceArray[i];
pieceArray.splice(i, 1);
mcNext.gotoAndStop(nextPiece);
mcPiece.bomb = false;
} else if ((((((numBombs > 0) and (mcPiece.bomb == false)) and (curBox.flow == false)) and (bombSet == false)) and (curBox._currentframe > 1)) and (curBox._currentframe < 9)) {
mcPiece.gotoAndStop("bomb");
mcPiece.bomb = true;
mcPiece.mcBomb.gotoAndStop(1);
} else if (mcPiece.bomb == true) {
if (curBox.flow) {
mcPiece.bomb = false;
mcPiece.gotoAndStop(curPiece);
} else {
depth++;
attachMovie("mcBomb", "mcBomb" + depth, depth);
mcBomb = _root["mcBomb" + depth];
mcBomb._x = curBox._x + 5;
mcBomb._y = curBox._y + 5;
mcBomb.box = curBox;
bombSet = true;
depth++;
mcPiece.bomb = false;
mcPiece.gotoAndStop("empty");
curBox.pipe = "";
numBombs--;
mcBombsLeft.left = numBombs;
}
}
};
Symbol 2 MovieClip Frame 50
stop();
Symbol 5 MovieClip Frame 50
stop();
Symbol 68 MovieClip [mcPump] Frame 1
stop();
Symbol 68 MovieClip [mcPump] Frame 2
gotoAndPlay (2);
Symbol 68 MovieClip [mcPump] Frame 15
gotoAndPlay (2);
Symbol 71 MovieClip [mcSpill] Frame 31
gotoAndPlay (27);
Symbol 84 MovieClip [mcDrain] Frame 9
gotoAndPlay (1);
Symbol 84 MovieClip [mcDrain] Frame 10
stop();
Symbol 84 MovieClip [mcDrain] Frame 11
stop();
Symbol 84 MovieClip [mcDrain] Frame 13
stop();
Symbol 85 MovieClip [mcBox] Frame 1
stop();
Symbol 85 MovieClip [mcBox] Frame 9
stop();
Symbol 118 MovieClip [mcBomb] Frame 1
Symbol 118 MovieClip [mcBomb] Frame 22
if ((_root.state == "play") and (this.soundOn != false)) {
_root.sndBoom.start();
}
Symbol 118 MovieClip [mcBomb] Frame 28
box.gotoAndStop("empty");
_root.bombSet = false;
_root.mcPiece.gotoAndStop(_root.curPiece);
removeMovieClip(this);
Symbol 152 MovieClip Frame 1
stop();
Symbol 168 Button
on (release) {
_root.Blast();
}
Symbol 173 Button
on (release) {
_root.mcBeginBtn._visible = false;
if (_root.gameIsOver) {
_root.Init();
}
_root.NextLevel();
_root.mcGetReady._visible = true;
_root.mcGetReady.gotoAndPlay(2);
_root.mcGetReady.swapDepths(++_root.depth);
}
Symbol 174 MovieClip Frame 1
stop();
Symbol 174 MovieClip Frame 2
stop();
Symbol 174 MovieClip Frame 3
stop();
Symbol 174 MovieClip Frame 4
stop();
Symbol 174 MovieClip Frame 5
stop();
Symbol 174 MovieClip Frame 6
stop();
Symbol 174 MovieClip Frame 7
stop();
Symbol 174 MovieClip Frame 8
stop();
Instance of Symbol 174 MovieClip in Symbol 175 MovieClip Frame 1
onClipEvent (enterFrame) {
if (this._currentframe == 1) {
this.gotoAndStop(int(Math.random() * 7) + 1);
this._xscale = 50;
this._yscale = 50;
}
if (_parent.hitTest(_root._xmouse, _root._ymouse, false)) {
this._rotation = this._rotation - 10;
} else {
this._rotation = this._rotation + 10;
}
}
Instance of Symbol 174 MovieClip in Symbol 175 MovieClip Frame 1
onClipEvent (enterFrame) {
if (this._currentframe == 1) {
this.gotoAndStop(int(Math.random() * 7) + 1);
this._xscale = 50;
this._yscale = 50;
}
if (_parent.hitTest(_root._xmouse, _root._ymouse, false)) {
this._rotation = this._rotation - 10;
} else {
this._rotation = this._rotation + 10;
}
}
Instance of Symbol 118 MovieClip [mcBomb] in Symbol 178 MovieClip Frame 1
onClipEvent (load) {
gotoAndStop (1);
}
Symbol 185 MovieClip Frame 1
stop();
Symbol 185 MovieClip Frame 2
_root.sndDunk.start();
Symbol 185 MovieClip Frame 20
_root.sndDunk.start();
Symbol 185 MovieClip Frame 40
_root.sndDunk.start();
Symbol 185 MovieClip Frame 60
_root.state = "play";
gotoAndStop (1);
this._visible = false;
_root.startTime = getTimer();
_root.sndLoop1.start(0, 1000);
Instance of Symbol 68 MovieClip [mcPump] in Symbol 197 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay (2);
}
Instance of Symbol 118 MovieClip [mcBomb] in Symbol 197 MovieClip Frame 1
onClipEvent (enterFrame) {
if (!root.mcInstructions._visible) {
gotoAndStop (1);
} else if (this._currentframe == 1) {
gotoAndPlay (2);
}
}
Instance of Symbol 68 MovieClip [mcPump] "mcPumpOn" in Symbol 203 MovieClip Frame 1
onClipEvent (load) {
gotoAndPlay (2);
}
Symbol 205 MovieClip Frame 21
this._visible = false;