Frame 1
_root.startgame.onPress = function () {
_root.gotoAndPlay(2);
};
stop();
Frame 2
function loadstatus() {
var i = 0;
while (i < NUMLEVELS) {
levelstatus[i] = flash.external.ExternalInterface.call("ReadCookie", "vizgyujto_lvl" + (i + 1));
if ((levelstatus[i] == undefined) || (levelstatus[i] == "")) {
if (i == 0) {
levelstatus[i] = 1;
} else {
levelstatus[i] = 0;
}
}
i++;
}
statusloaded = 1;
}
function savestatus() {
var i = 0;
while (i < NUMLEVELS) {
flash.external.ExternalInterface.call("SetCookie", "vizgyujto_lvl" + (i + 1), levelstatus[i], 1000);
i++;
}
}
if (this == _level0) {
play();
} else {
stop();
}
var NUMLEVELS = 20;
var currlevel;
var levelstatus;
if (statusloaded != 1) {
levelstatus = Array(NUMLEVELS);
loadstatus();
}
var i = 0;
while (i < NUMLEVELS) {
var m = ("btn_lvl" + (i + 1));
_root.attachMovie(m, m, _root.getNextHighestDepth());
_root[m].onPress = function () {
_root.currlevel = this.tolevel;
for (c in _root) {
removeMovieClip(_root[c]);
}
_root.gotoAndPlay(3);
};
_root[m]._x = 100 + (65 * (i % 5));
_root[m]._y = 230 + (65 * Math.floor(i / 5));
_root[m].tolevel = i + 1;
if (levelstatus[i] == 0) {
_root[m].enabled = false;
var n = (m + "lock");
_root.attachMovie("lock", n, _root.getNextHighestDepth());
_root[n]._x = _root[m]._x + 20;
_root[n]._y = _root[m]._y + 20;
}
i++;
}
stop();
Frame 3
function startwater() {
_root.dummy.onEnterFrame = inclevel;
removeMovieClip(_root.btn_start);
_root.attachMovie("btn_stop", "btn_stop", _root.getNextHighestDepth());
_root.btn_stop._x = START_X;
_root.btn_stop._y = START_Y;
_root.btn_stop.onPress = stopwater;
}
function stopwater() {
removeMovieClip(_root.btn_stop);
removeMovieClip(_root.btn_start);
_root.attachMovie("btn_start", "btn_start", _root.getNextHighestDepth());
_root.btn_start.onPress = startwater;
_root.btn_start._x = START_X;
_root.btn_start._y = START_Y;
_root.dummy.onEnterFrame = updatelevel;
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var k = 0;
while (k < MAXLAYERS) {
var m = ((("w" + i) + j) + k);
var e = eprops[_root[m].element];
_root[m].wfrom = 0;
_root[m].wto = 0;
_root[m].ownedby = "";
if (e.type == E_TANK) {
_root[m].wamount = e.capacity;
} else {
_root[m].wamount = 0;
if (_root[m].element == 0) {
_root[m].gotoAndStop(1 + _root[m].element);
}
}
k++;
}
j++;
}
i++;
}
}
function quit() {
for (c in _root) {
removeMovieClip(_root[c]);
}
_root.gotoAndPlay(1);
}
function resetlevel() {
initlevel(currlevel);
}
function initlevel(level) {
var map = _root["map" + level];
_root.leveltxt = "LEVEL " + level;
switch (level) {
case 1 :
_root.tiptext = "Click the pot above, than drag it to the game area (grey), to have it under the tank full of water. Then click START!";
break;
case 2 :
_root.tiptext = "There are pots and tanks of different sizes. You can sum the content of two tanks by well placed pot!";
break;
case 3 :
_root.tiptext = "You can also use pipes to direct water. Note: once the water leaves the pipe, it cannot be guided back.";
break;
default :
_root.tiptext = "";
}
var i = 0;
while (i < GRIDW) {
currmap[i] = Array();
var j = 0;
while (j < GRIDH) {
_root.currmap[i][j] = map[j][i];
if (map[j][i] > 100) {
_root.currmap[i][j] = _root.currmap[i][j] - 100;
}
j++;
}
i++;
}
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var k = 0;
while (k < MAXLAYERS) {
if (k == 0) {
setcell(i, j, k, ((map[j][i] > 100) ? (map[j][i] - 100) : (map[j][i])), ((map[j][i] > 100) ? true : false));
} else {
setcell(i, j, k, 0, false);
}
k++;
}
j++;
}
i++;
}
var i = 1;
while (i <= 6) {
elementtofront(i);
i++;
}
elementtofront(8);
elementtofront(7);
var i = 10;
while (i <= 17) {
elementtofront(i);
i++;
}
}
function elementtofront(element) {
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var m = ((("w" + i) + j) + "0");
if (_root[m].element == element) {
_root[m].swapDepths(_root.getNextHighestDepth());
}
j++;
}
i++;
}
}
function ispot(i, j) {
if ((i < 0) || (j < 0)) {
return(false);
}
if (_root.currmap[i][j] >= 10) {
return(true);
}
return(false);
}
function isanypot(i, j) {
if (((((((ispot(i, j) || (ispot(i - 1, j))) || (ispot(i - 2, j))) || (ispot(i - 3, j))) || (ispot(i, j - 1))) || (ispot(i - 1, j - 1))) || (ispot(i - 2, j - 1))) || (ispot(i, j - 2))) {
return(true);
}
return(false);
}
function findpot(i, j) {
if (isanypot(i, j)) {
var ee = 10;
while (ee <= 17) {
var potprop = eprops[ee];
var ii = 0;
while (ii < potprop.width) {
var jj = 0;
while (jj < potprop.height) {
if (_root.currmap[i - ii][j - jj] == ee) {
return({poti:i - ii, potj:j - jj});
}
jj++;
}
ii++;
}
ee++;
}
}
return(false);
}
function dbgcell(i, j, layer) {
m = (("w" + i) + j) + layer;
trace((((((((((m + ": ") + _root[m].element) + "|") + _root[m].wfrom) + "|") + _root[m].wto) + "|") + _root[m].wamount) + " own:") + _root[m].ownedby);
}
function dbgcurrmap() {
var j = 0;
while (j < GRIDH) {
var line = "";
var i = 0;
while (i < GRIDW) {
line = line + currmap[i][j];
i++;
}
trace(line);
j++;
}
trace("-------");
}
function dbgcurrmap2() {
var j = 0;
while (j < GRIDH) {
var line = "";
var i = 0;
while (i < GRIDW) {
line = line + (((((_root[(("w" + i) + j) + "0"].wamount + ",") + _root[(("w" + i) + j) + "1"].wamount) + "_") + _root[(("w" + i) + j) + "2"].wamount) + "|");
i++;
}
trace(line);
j++;
}
trace("-------");
}
function getmatchingelement(i, j, l, todir) {
var m;
var retm = "";
var retlayer;
var owner = ((("" + i) + j) + l);
var origelement = _root[(("w" + i) + j) + l].element;
switch (todir) {
case 1 :
j--;
break;
case 2 :
i++;
break;
case 3 :
j++;
break;
case 4 :
i--;
}
if ((((j < 0) || (j >= GRIDWATERLIMIT)) || (i < 0)) || (i >= GRIDW)) {
return({out:true});
}
layer = 0;
while (layer < MAXLAYERS) {
m = (("w" + i) + j) + layer;
if (((_root[m].element == 0) && (_root[m].wfrom == 0)) && (retm == "")) {
retm = m;
retlayer = layer;
}
if ((_root[m].element == 0) && (_root[m].ownedby == owner)) {
return({todir:3, m:m, i:i, j:j, layer:layer, out:false});
}
if (_root[m].element != 0) {
var e = eprops[_root[m].element];
if (e.type == E_BLOCK) {
return({todir:3, m:m, i:i, j:j, layer:layer, blocked:true});
}
if (origelement != 0) {
if (int(e.dirs.charAt(0)) == oppdir(todir)) {
return({todir:int(e.dirs.charAt(1)), m:m, i:i, j:j, layer:layer, out:false});
}
if (int(e.dirs.charAt(2)) == oppdir(todir)) {
return({todir:int(e.dirs.charAt(3)), m:m, i:i, j:j, layer:layer, out:false});
}
}
}
layer++;
}
_root[retm].ownedby = owner;
return({todir:3, m:retm, i:i, j:j, layer:retlayer, out:false});
}
function oppdir(dir) {
switch (dir) {
case 1 :
return(3);
case 2 :
return(4);
case 3 :
return(1);
case 4 :
return(2);
}
}
function setcell(i, j, layer, element, movable) {
var m = ((("w" + i) + j) + layer);
var e = eprops[element];
_root[m].removeMovieClip();
if (j == (GRIDH - 1)) {
return(undefined);
}
switch (element) {
case 7 :
_root.attachMovie("balloon1", m, _root.getNextHighestDepth());
break;
case 8 :
_root.attachMovie("balloon2", m, _root.getNextHighestDepth());
break;
case 9 :
_root.attachMovie("balloon4", m, _root.getNextHighestDepth());
break;
case 10 :
_root.attachMovie("pot1", m, _root.getNextHighestDepth());
break;
case 11 :
_root.attachMovie("pot2", m, _root.getNextHighestDepth());
break;
case 12 :
_root.attachMovie("pot2b", m, _root.getNextHighestDepth());
break;
case 13 :
_root.attachMovie("pot3", m, _root.getNextHighestDepth());
break;
case 14 :
_root.attachMovie("pot3b", m, _root.getNextHighestDepth());
break;
case 15 :
_root.attachMovie("pot4", m, _root.getNextHighestDepth());
break;
case 16 :
_root.attachMovie("pot4b", m, _root.getNextHighestDepth());
break;
case 17 :
_root.attachMovie("pot6", m, _root.getNextHighestDepth());
break;
default :
_root.attachMovie("water", m, _root.getNextHighestDepth());
}
_root[m]._x = GRIDX + (i * CELLW);
_root[m]._y = GRIDY + (j * CELLH);
_root[m]._xscale = 100;
_root[m]._yscale = 100;
_root[m].cacheAsBitmap = true;
_root[m].element = element;
if (e.type == E_TANK) {
_root[m].wamount = e.capacity;
} else {
_root[m].wamount = 0;
}
_root[m].wfrom = 0;
_root[m].wto = 0;
_root[m].wlast = 1;
_root[m].ownedby = "";
if ((element < 7) || (element >= 18)) {
_root[m].gotoAndStop(1 + element);
}
if (movable && (element != 0)) {
_root[m].filters = [gl];
_root[m].movable = true;
} else {
_root[m].filters = undefined;
_root[m].movable = false;
}
if (layer == 0) {
currmap[i][j] = element;
}
}
function mousemove() {
var celli = (Math.floor((_root._xmouse - GRIDX) / CELLW) + cellioff);
var cellj = (Math.floor((_root._ymouse - GRIDY) / CELLH) + celljoff);
var e = eprops[hand];
var ii;
var jj;
if ((cellj + e.height) > (GRIDH - 1)) {
cellj = (GRIDH - e.height) - 1;
}
if ((celli + e.width) > GRIDW) {
celli = GRIDW - e.width;
}
if (celli < 0) {
celli = 0;
}
if (cellj < 0) {
cellj = 0;
}
var collision = false;
var tmpmap = Array();
var i = 0;
while (i < GRIDW) {
tmpmap[i] = Array();
i++;
}
var tmp = currmap[lasthandi][lasthandj];
currmap[lasthandi][lasthandj] = 0;
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
if (currmap[i][j]) {
var ee = eprops[currmap[i][j]];
ii = 0;
while (ii < ee.width) {
jj = 0;
while (jj < ee.height) {
tmpmap[i + ii][j + jj] = 1;
jj++;
}
ii++;
}
}
j++;
}
i++;
}
ii = 0;
while (ii < e.width) {
jj = 0;
while (jj < e.height) {
if (tmpmap[celli + ii][cellj + jj]) {
collision = true;
}
jj++;
}
ii++;
}
currmap[lasthandi][lasthandj] = tmp;
if (((((((hand != E_EMPTY) && (celli >= 0)) && (cellj >= 0)) && ((celli + e.width) <= GRIDW)) && ((cellj + e.height) <= GRIDH)) && (!collision)) && ((lasthandi != celli) || (lasthandj != cellj))) {
setcell(lasthandi, lasthandj, 0, 0, true);
setcell(celli, cellj, 0, hand, true);
lasthandi = celli;
lasthandj = cellj;
}
}
function mousedown() {
var celli = (Math.floor((_root._xmouse - GRIDX) / CELLW) + cellioff);
var cellj = (Math.floor((_root._ymouse - GRIDY) / CELLH) + celljoff);
if (_root.dummy.onEnterFrame == inclevel) {
return(undefined);
}
if ((((celli >= 0) && (cellj >= 0)) && (celli < GRIDW)) && (cellj < GRIDH)) {
if (hand == E_EMPTY) {
if (_root[(("w" + celli) + cellj) + "0"].movable) {
hand = currmap[celli][cellj];
origi = celli;
origj = cellj;
lasthandi = celli;
lasthandj = cellj;
cellioff = 0;
celljoff = 0;
}
var fp = findpot(celli, cellj);
if (fp && (_root[(("w" + fp.poti) + fp.potj) + "0"].movable)) {
hand = currmap[fp.poti][fp.potj];
origi = fp.poti;
origj = fp.potj;
lasthandi = fp.poti;
lasthandj = fp.potj;
cellioff = fp.poti - celli;
celljoff = fp.potj - cellj;
}
} else {
hand = E_EMPTY;
cellioff = 0;
celljoff = 0;
}
}
}
function mouseup() {
var celli = (Math.floor((_root._xmouse - GRIDX) / CELLW) + cellioff);
var cellj = (Math.floor((_root._ymouse - GRIDY) / CELLH) + celljoff);
if ((hand != E_EMPTY) && ((origi != celli) || (origj != cellj))) {
hand = E_EMPTY;
cellioff = 0;
celljoff = 0;
}
}
function inclevel() {
var layer = 0;
var totalstream = 0;
var totaltanks = 0;
var totalinpot = 0;
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var m = ((("w" + i) + j) + layer);
var e = eprops[_root[m].element];
if (e.type == E_POT) {
totalinpot = totalinpot + Math.min(e.capacity, _root[m].wamount);
}
if (e.type == E_TANK) {
var curri = i;
var currj = j;
var currlayer = layer;
var currdir = 3;
var stream;
var count33 = 0;
totaltanks = totaltanks + e.capacity;
if (_root[m].wamount > 0) {
_root[m].wamount--;
stream = true;
} else {
stream = false;
}
while (true) {
var nexte = getmatchingelement(curri, currj, currlayer, currdir);
if (nexte.blocked) {
i = i;
}
if (nexte.out) {
break;
}
if (((nexte.todir == 3) && (currdir == 1)) && (stream)) {
var nn = ("drop" + Math.random());
_root.attachMovie("drop", nn, _root.getNextHighestDepth());
_root[nn]._x = (GRIDX + (curri * CELLW)) + (Math.random() * CELLW);
_root[nn]._y = GRIDY + (currj * CELLH);
_root[nn].cacheAsBitmap = true;
break;
}
if ((nexte.todir == 3) && (currdir == 3)) {
count33++;
} else {
count33 = 0;
}
var nextprop = eprops[_root[nexte.m].element];
_root[nexte.m].wfrom = oppdir(currdir);
_root[nexte.m].wto = nexte.todir;
curri = nexte.i;
currj = nexte.j;
currdir = nexte.todir;
currlayer = nexte.layer;
if (stream && (isanypot(curri, currj - 1))) {
var found = false;
var ee = 10;
while (ee <= 17) {
var potprop = eprops[ee];
var ii = 0;
while (ii < potprop.width) {
if ((_root.currmap[curri - ii][currj - potprop.height] == ee) && (count33 > potprop.height)) {
var n = ((("w" + (curri - ii)) + (currj - potprop.height)) + "0");
_root[n].wamount++;
if (_root[n].wamount > potprop.capacity) {
var nn = ("drop" + Math.random());
_root.attachMovie("drop", nn, _root.getNextHighestDepth());
_root[nn]._x = (GRIDX + ((curri - ii) * CELLW)) + ((Math.random() * CELLW) * potprop.width);
_root[nn]._y = GRIDY + ((currj - potprop.height) * CELLH);
_root[nn].cacheAsBitmap = true;
}
found = true;
break;
}
ii++;
}
ee++;
}
if (found) {
break;
}
}
if (nexte.blocked) {
break;
}
_root[nexte.m].wlast = _root[nexte.m].wamount;
if (stream) {
_root[nexte.m].wamount++;
if (_root[nexte.m].wamount <= nextprop.capacity) {
break;
}
_root[nexte.m].wamount = nextprop.capacity;
} else if (_root[nexte.m].wamount > 0) {
stream = true;
_root[nexte.m].wamount--;
if (_root[nexte.m].wamount == 0) {
_root[nexte.m].wfrom = 0;
_root[nexte.m].wto = 0;
_root[nexte.m].ownedby = "";
_root[nexte.m].gotoAndStop(1);
}
}
}
if (stream) {
totalstream++;
}
}
j++;
}
i++;
}
if (totaltanks == totalinpot) {
_root.levelstatus[currlevel] = 1;
_root.savestatus();
if (currlevel == 20) {
showdialog("Congratulations!\n\nYOU SOLVED ALL THE LEVELS!", true, function () {
quit();
});
} else {
showdialog("\nSUCCESS!\nClick to continue!", true, function () {
stopwater();
currlevel++;
initlevel(currlevel);
hidedialog();
});
}
} else if (totalstream == 0) {
showdialog("\nWHAT A WASTE!\nPlease try again!", true, function () {
stopwater();
hidedialog();
});
}
updatelevel();
}
function updatelevel() {
_root.currframe++;
var layer = 0;
while (layer < MAXLAYERS) {
var i = 0;
while (i < GRIDW) {
var j = 0;
while (j < GRIDH) {
var mname = ((("w" + i) + j) + layer);
var e = eprops[_root[mname].element];
if ((e.type == E_EMPTY) && (_root[mname].wamount == 0)) {
} else {
if (_root[mname].movable && (j >= (GRIDWATERLIMIT - 1))) {
if ((_root.currframe % 20) < 10) {
_root[mname].filters = [gl];
} else {
_root[mname].filters = [gl2];
}
}
if ((_root[mname].wamount > 0) && (j >= (GRIDWATERLIMIT - 1))) {
} else if (((_root[mname].wamount == 0) || (e.type == E_TANK)) || (e.type == E_POT)) {
_root[mname]._xscale = 100;
_root[mname]._yscale = 100;
_root[mname]._rotation = 0;
_root[mname]._x = GRIDX + (i * CELLW);
_root[mname]._y = GRIDY + (j * CELLH);
switch (e.type) {
case E_TANK :
_root[mname].balloonmask._y = 50 - ((e.pixh * _root[mname].wamount) / e.capacity);
break;
case E_POT :
if (_root[mname].wamount <= e.capacity) {
_root[mname].potmask._y = (e.height * CELLH) * (1 - (_root[mname].wamount / e.capacity));
}
break;
default :
_root[mname].gotoAndStop(_root[mname].element + 1);
}
} else {
var dir = ((10 * _root[mname].wfrom) + _root[mname].wto);
switch (dir) {
case 12 :
sf = 30;
xs = 100;
ys = -100;
ro = 90;
xo = 0;
yo = 0;
break;
case 21 :
sf = 30;
xs = 100;
ys = 100;
ro = 180;
xo = CELLW;
yo = CELLH;
break;
case 23 :
sf = 30;
xs = 100;
ys = -100;
ro = 180;
xo = CELLW;
yo = 0;
break;
case 32 :
sf = 30;
xs = 100;
ys = 100;
ro = 270;
xo = 0;
yo = CELLH;
break;
case 34 :
sf = 30;
xs = 100;
ys = -100;
ro = 270;
xo = CELLW;
yo = CELLH;
break;
case 43 :
sf = 30;
xs = 100;
ys = 100;
ro = 0;
xo = 0;
yo = 0;
break;
case 41 :
sf = 30;
xs = 100;
ys = -100;
ro = 0;
xo = 0;
yo = CELLH;
break;
case 14 :
sf = 30;
xs = 100;
ys = 100;
ro = 90;
xo = CELLW;
yo = 0;
break;
case 13 :
sf = 80;
xs = 100;
ys = 100;
ro = 0;
xo = 0;
yo = 0;
break;
case 31 :
sf = 80;
xs = 100;
ys = -100;
ro = 0;
xo = 0;
yo = CELLH;
break;
case 42 :
sf = 80;
xs = 100;
ys = 100;
ro = 270;
xo = 0;
yo = CELLH;
break;
case 24 :
sf = 80;
xs = 100;
ys = 100;
ro = 90;
xo = CELLW;
yo = 0;
}
if (_root[mname].element == 0) {
sf = sf + 100;
}
if (_root[mname].wamount < _root[mname].wlast) {
_root[mname].gotoAndStop(((sf + 20) + e.capacity) - _root[mname].wamount);
} else if (_root[mname].wamount == _root[mname].wlast) {
if ((_root[mname]._currentFrame < (sf + 40)) || (_root[mname]._currentFrame >= (sf + 50))) {
_root[mname].gotoAndPlay(sf + 40);
}
} else {
_root[mname].gotoAndStop(sf + _root[mname].wamount);
}
_root[mname]._xscale = xs;
_root[mname]._yscale = ys;
_root[mname]._rotation = ro;
_root[mname]._x = (GRIDX + (i * CELLW)) + xo;
_root[mname]._y = (GRIDY + (j * CELLH)) + yo;
}
}
j++;
}
i++;
}
layer++;
}
}
function showdialog(txt, button, okcallback) {
hidedialog();
if (_root.genericdialog == undefined) {
_root.attachMovie("genericdialog", "genericdialog", _root.getNextHighestDepth());
_root.genericdialog._x = 73;
_root.genericdialog._y = 229;
_root.genericdialog.cacheAsBitmap = true;
}
_root.btn_start.enabled = false;
_root.btn_stop.enabled = false;
_root.btn_reset.enabled = false;
_root.btn_quit.enabled = false;
_root.genericdialog.ok.onPress = okcallback;
_root.genericdialog.dlgtxt = txt;
_root.dialogvisible = true;
if (button) {
_root.genericdialog.ok.enabled = true;
_root.genericdialog.ok._visible = true;
} else {
_root.genericdialog.ok.enabled = false;
_root.genericdialog.ok._visible = false;
}
}
function hidedialog() {
_root.btn_start.enabled = true;
_root.btn_stop.enabled = true;
_root.btn_reset.enabled = true;
_root.btn_quit.enabled = true;
_root.genericdialog.removeMovieClip();
_root.dialogvisible = false;
}
map1 = [[0, 0, 0, 9, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 18], [0, 0, 0, 0, 0, 18, 18], [0, 0, 0, 0, 0, 0, 0], [0, 115, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map2 = [[0, 8, 0, 8, 0, 7, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 113, 0, 0, 0, 111, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map3 = [[0, 8, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 3, 0, 0, 0, 0, 0], [19, 0, 0, 0, 0, 0, 0], [19, 19, 0, 0, 0, 0, 0], [19, 19, 0, 12, 0, 0, 19], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 102, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map4 = [[0, 7, 0, 7, 0, 7, 0], [0, 1, 0, 1, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 104, 113, 0, 0, 103, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map5 = [[0, 0, 0, 0, 8, 0, 0], [0, 0, 0, 0, 1, 0, 0], [0, 0, 5, 2, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 11, 0, 0, 18, 0], [0, 0, 0, 0, 0, 18, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 104, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map6 = [[0, 7, 7, 7, 7, 0, 0], [0, 1, 1, 1, 1, 0, 0], [0, 1, 1, 1, 0, 0, 0], [0, 1, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 11, 0, 11, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 103, 0, 103, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map7 = [[0, 7, 0, 8, 0, 7, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 4, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 11, 0, 0], [0, 12, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 103, 0, 102, 0, 102, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map8 = [[8, 0, 0, 0, 9, 8, 7], [1, 0, 0, 0, 0, 0, 1], [3, 0, 0, 0, 0, 0, 1], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 114, 0, 102, 0, 104, 0], [0, 0, 0, 117, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map9 = [[0, 7, 7, 8, 9, 8, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [117, 0, 0, 0, 0, 115, 0], [0, 0, 0, 0, 104, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map10 = [[0, 7, 7, 8, 7, 7, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 0, 0, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 114, 0, 104, 104, 103, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 113, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map11 = [[8, 0, 8, 0, 7, 0, 8], [1, 0, 1, 0, 1, 0, 1], [0, 2, 0, 0, 0, 2, 0], [1, 0, 1, 0, 1, 0, 1], [0, 2, 0, 2, 0, 2, 0], [0, 17, 0, 0, 10, 0, 0], [18, 0, 0, 0, 18, 18, 18], [0, 0, 0, 0, 0, 0, 0], [0, 103, 104, 0, 105, 104, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map12 = [[0, 8, 8, 18, 9, 0, 0], [0, 1, 1, 18, 1, 0, 0], [0, 0, 1, 18, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [17, 0, 0, 0, 0, 11, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 101, 103, 106, 102, 102, 0], [0, 0, 103, 104, 102, 102, 0], [0, 0, 0, 0, 0, 0, 0]];
map13 = [[0, 8, 9, 7, 9, 8, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 0, 1, 0, 1, 0], [0, 1, 0, 0, 0, 0, 0], [19, 0, 0, 0, 0, 0, 19], [19, 0, 0, 0, 0, 0, 19], [19, 0, 0, 0, 0, 0, 19], [0, 0, 114, 117, 0, 0, 0], [0, 102, 0, 0, 0, 0, 0], [0, 103, 0, 116, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map14 = [[0, 8, 0, 0, 0, 0, 0], [0, 0, 2, 2, 2, 0, 0], [0, 0, 2, 2, 2, 0, 0], [18, 18, 18, 18, 18, 1, 1], [0, 0, 2, 2, 2, 0, 0], [0, 0, 2, 2, 2, 0, 0], [12, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 103, 0, 104, 0, 106, 0], [0, 103, 0, 102, 0, 106, 0], [0, 0, 0, 0, 0, 0, 0]];
map15 = [[0, 7, 7, 7, 7, 8, 0], [0, 1, 1, 1, 1, 1, 0], [0, 1, 1, 1, 1, 1, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 18, 18, 0, 0, 0], [0, 13, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 114], [0, 104, 104, 104, 102, 101, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map16 = [[0, 7, 8, 7, 7, 0, 0], [0, 1, 0, 0, 1, 0, 0], [0, 0, 0, 0, 1, 0, 0], [0, 0, 0, 0, 4, 0, 0], [0, 0, 0, 14, 0, 0, 0], [0, 0, 0, 0, 11, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 103, 103, 0, 106, 106, 0], [0, 103, 103, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map17 = [[8, 8, 7, 9, 0, 9, 8], [1, 1, 1, 1, 0, 1, 1], [0, 0, 0, 0, 0, 0, 0], [2, 6, 5, 2, 2, 2, 2], [0, 3, 4, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 19, 19], [104, 102, 0, 117, 0, 0, 114], [112, 0, 0, 0, 0, 0, 0], [0, 116, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map18 = [[0, 8, 7, 7, 8, 7, 8], [0, 0, 0, 0, 0, 0, 1], [19, 19, 0, 0, 0, 0, 1], [19, 19, 0, 0, 0, 0, 1], [19, 19, 0, 0, 0, 0, 1], [19, 19, 0, 0, 0, 0, 0], [19, 19, 0, 0, 0, 0, 19], [0, 113, 0, 0, 0, 114, 0], [103, 0, 0, 0, 104, 0, 0], [0, 110, 112, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map19 = [[0, 0, 0, 0, 0, 0, 0], [0, 7, 7, 0, 8, 8, 0], [0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 18, 0, 0], [0, 0, 18, 0, 0, 0, 0], [104, 102, 0, 0, 0, 101, 101], [0, 0, 0, 0, 0, 0, 0], [113, 0, 0, 0, 113, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
map20 = [[9, 8, 7, 7, 8, 7, 9], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 19, 19, 0, 0], [19, 19, 19, 19, 19, 0, 0], [0, 0, 0, 0, 113, 0, 0], [0, 0, 115, 0, 117, 0, 0], [112, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
mapX = [[0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]];
var ds = (new flash.filters.DropShadowFilter(0, 45, 0, 50, 10, 10, 2, 1, false, false, false));
var gl = (new flash.filters.GlowFilter(0, 0.5, 10, 10, 2, 1, false, false));
var gl2 = (new flash.filters.GlowFilter(5592405, 0.5, 10, 10, 2, 1, false, false));
var currmap = Array();
var currframe = 0;
GRIDX = 35;
GRIDY = 63;
GRIDW = 7;
GRIDH = 11;
GRIDWATERLIMIT = 8;
MAXLAYERS = 4;
CELLW = 50;
CELLH = 50;
E_EMPTY = 0;
E_PIPE = 1;
E_TANK = 2;
E_POT = 3;
E_BLOCK = 4;
START_X = 419;
START_Y = 70;
RESET_X = 421;
RESET_Y = 170;
QUIT_X = 421;
QUIT_Y = 290;
var hand = E_EMPTY;
var lasthandi;
var lasthandj;
var origi;
var origj;
var cellioff = 0;
var celljoff = 0;
eprops = Array();
eprops[0] = {type:E_EMPTY, dirs:"", width:1, height:1, capacity:10};
eprops[1] = {type:E_PIPE, dirs:"1331", width:1, height:1, capacity:9};
eprops[2] = {type:E_PIPE, dirs:"2442", width:1, height:1, capacity:9};
eprops[3] = {type:E_PIPE, dirs:"1221", width:1, height:1, capacity:10};
eprops[4] = {type:E_PIPE, dirs:"1441", width:1, height:1, capacity:10};
eprops[5] = {type:E_PIPE, dirs:"2332", width:1, height:1, capacity:10};
eprops[6] = {type:E_PIPE, dirs:"3443", width:1, height:1, capacity:10};
eprops[7] = {type:E_TANK, dirs:"", width:1, height:1, capacity:28, pixh:57};
eprops[8] = {type:E_TANK, dirs:"", width:1, height:1, capacity:56, pixh:108.1};
eprops[9] = {type:E_TANK, dirs:"", width:1, height:1, capacity:112, pixh:158.1};
eprops[10] = {type:E_POT, dirs:"", width:1, height:1, capacity:28};
eprops[11] = {type:E_POT, dirs:"", width:1, height:2, capacity:56};
eprops[12] = {type:E_POT, dirs:"", width:2, height:1, capacity:56};
eprops[13] = {type:E_POT, dirs:"", width:3, height:1, capacity:84};
eprops[14] = {type:E_POT, dirs:"", width:1, height:3, capacity:84};
eprops[15] = {type:E_POT, dirs:"", width:2, height:2, capacity:112};
eprops[16] = {type:E_POT, dirs:"", width:4, height:1, capacity:112};
eprops[17] = {type:E_POT, dirs:"", width:3, height:2, capacity:168};
eprops[18] = {type:E_BLOCK, dirs:"", width:1, height:1, capacity:10};
eprops[19] = {type:E_BLOCK, dirs:"", width:1, height:1, capacity:10};
_root.dummy.onEnterFrame = updatelevel;
_root.dummy.onMouseMove = mousemove;
_root.dummy.onMouseDown = mousedown;
_root.dummy.onMouseUp = mouseup;
_root.attachMovie("btn_start", "btn_start", _root.getNextHighestDepth());
_root.btn_start.onPress = startwater;
_root.btn_start._x = START_X;
_root.btn_start._y = START_Y;
_root.attachMovie("btn_reset", "btn_reset", _root.getNextHighestDepth());
_root.btn_reset.onPress = resetlevel;
_root.btn_reset._x = RESET_X;
_root.btn_reset._y = RESET_Y;
_root.attachMovie("btn_quit", "btn_quit", _root.getNextHighestDepth());
_root.btn_quit.onPress = quit;
_root.btn_quit._x = QUIT_X;
_root.btn_quit._y = QUIT_Y;
initlevel(currlevel);
stop();
Symbol 243 MovieClip [water] Frame 72
gotoAndPlay (70);
Symbol 243 MovieClip [water] Frame 122
gotoAndPlay (120);
Symbol 243 MovieClip [water] Frame 179
gotoAndPlay (170);
Symbol 243 MovieClip [water] Frame 229
gotoAndPlay (220);
Symbol 309 MovieClip [drop] Frame 20
this.removeMovieClip();
Symbol 461 MovieClip Frame 15
tellTarget ("/ripple5") {
play();
};
Symbol 482 MovieClip Frame 1
stop();
Symbol 482 MovieClip Frame 75
gotoAndStop (1);