Frame 1
lev_1_map_1 = [[[0, "0000"], [1, "0000"], [0, "0001"], [0, "0000"], [0, "0001"], [0, "0100"]], [[0, "0010"], [0, "1001"], [0, "0100"], [0, "0000"], [0, "0110"], [1, "1010"]], [[0, "0001"], [0, "0110"], [0, "1000"], [1, "0000"], [0, "0011"], [0, "1000"]], [[0, "1100"], [0, "0010"], [0, "1000"], [0, "0001"], [2, "0100"], [0, "0010"]], [[1, "1001"], [0, "0000"], [0, "0000"], [0, "0110"], [0, "1000"], [0, "0000"]], [[0, "0100"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "1011"], [1, "1001"]]];
lev_1_map_2 = [[[0, "0000"], [1, "0000"], [0, "0001"], [0, "0000"], [0, "0001"], [0, "0100"]], [[0, "0010"], [0, "1001"], [0, "0100"], [0, "0010"], [0, "1110"], [1, "1010"]], [[0, "0001"], [0, "0110"], [0, "1000"], [0, "0000"], [0, "0011"], [0, "1000"]], [[1, "1100"], [0, "0010"], [1, "1000"], [0, "0001"], [0, "0100"], [0, "0010"]], [[0, "1001"], [2, "0000"], [0, "0000"], [0, "0100"], [0, "0000"], [1, "0000"]], [[0, "0100"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0011"], [0, "1001"]]];
startPos_1_1 = [2, 4];
startPos_1_2 = [2, 4];
lev_2_map_1 = [[[0, "0001"], [0, "0000"], [0, "0001"], [0, "0000"], [0, "0001"], [2, "0000"]], [[0, "0100"], [0, "0001"], [0, "0100"], [0, "0000"], [0, "0100"], [0, "0001"]], [[0, "0001"], [0, "0100"], [1, "0000"], [1, "0000"], [0, "0001"], [0, "0100"]], [[0, "0100"], [0, "0001"], [1, "0000"], [1, "0000"], [0, "0100"], [0, "0001"]], [[0, "0001"], [0, "0100"], [0, "0001"], [0, "0000"], [0, "0001"], [0, "0100"]], [[0, "0100"], [0, "0001"], [0, "0100"], [0, "0001"], [0, "0100"], [0, "0001"]]];
lev_2_map_2 = [[[2, "0000"], [0, "1000"], [0, "0000"], [0, "1000"], [0, "0000"], [0, "1000"]], [[0, "0000"], [0, "0000"], [0, "1000"], [0, "0000"], [0, "1000"], [0, "0010"]], [[0, "0000"], [0, "1000"], [1, "0000"], [1, "0000"], [0, "0000"], [0, "1000"]], [[0, "0000"], [0, "0000"], [1, "0000"], [1, "0000"], [0, "0000"], [0, "0010"]], [[0, "0000"], [0, "1000"], [0, "0000"], [0, "1000"], [0, "0000"], [0, "1000"]], [[0, "0000"], [0, "0000"], [0, "1000"], [0, "0000"], [0, "1000"], [0, "0010"]]];
startPos_2_1 = [0, 5];
startPos_2_2 = [5, 5];
lev_3_map_1 = [[[1, "0000"], [0, "0100"], [0, "0100"], [1, "0100"], [0, "0100"], [1, "0000"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "0000"], [0, "0000"], [2, "0010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [1, "0000"], [0, "0100"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "0000"], [0, "0000"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [1, "0000"], [0, "0000"], [0, "1010"]], [[0, "1001"], [0, "0001"], [0, "1001"], [0, "0001"], [0, "0001"], [0, "0011"]]];
lev_3_map_2 = [[[0, "1100"], [0, "0100"], [0, "0100"], [0, "1100"], [0, "0100"], [0, "0110"]], [[0, "1000"], [0, "1100"], [0, "1000"], [0, "1000"], [2, "1100"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1010"]], [[0, "1001"], [0, "0001"], [0, "1001"], [0, "0001"], [0, "1001"], [0, "0011"]]];
startPos_3_1 = [0, 1];
startPos_3_2 = [1, 1];
lev_4_map_1 = [[[0, "1100"], [0, "0100"], [0, "0100"], [0, "0100"], [0, "0100"], [0, "0110"]], [[0, "1000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0010"]], [[0, "1000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0010"]], [[0, "1000"], [0, "0000"], [0, "0000"], [2, "0000"], [0, "0000"], [0, "0010"]], [[0, "1000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0010"]], [[0, "1001"], [0, "0001"], [0, "0001"], [0, "0001"], [0, "0001"], [0, "0011"]]];
lev_4_map_2 = [[[0, "1100"], [0, "0100"], [0, "0100"], [0, "0100"], [0, "0100"], [0, "0110"]], [[0, "1000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0010"]], [[0, "1000"], [0, "0000"], [2, "0000"], [0, "0000"], [0, "0000"], [0, "0010"]], [[0, "1000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0010"]], [[0, "1000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0010"]], [[0, "1001"], [0, "0001"], [0, "0001"], [0, "0001"], [0, "0001"], [0, "0011"]]];
startPos_4_1 = [5, 5];
startPos_4_2 = [0, 0];
lev_5_map_1 = [[[0, "1100"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0100"], [0, "0110"]], [[0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [1, "0000"], [2, "1000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0100"], [1, "1100"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0100"], [0, "1000"], [0, "0000"], [1, "0000"], [0, "0000"]], [[0, "1001"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0011"]]];
lev_5_map_2 = [[[0, "1100"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0110"]], [[0, "1000"], [0, "1100"], [0, "0000"], [0, "0000"], [1, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [2, "0000"], [1, "1000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [1, "0100"], [0, "1100"], [0, "0000"], [0, "0000"]], [[0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "1010"]], [[0, "1001"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0100"], [0, "0011"]]];
startPos_5_1 = [2, 3];
startPos_5_2 = [3, 3];
lev_6_map_1 = [[[1, "0000"], [0, "0100"], [0, "0100"], [1, "0100"], [0, "0100"], [1, "0000"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "0000"], [0, "0000"], [2, "0010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [1, "0000"], [0, "0100"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "0000"], [0, "0000"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [1, "0000"], [0, "0000"], [0, "1010"]], [[0, "1001"], [0, "0001"], [0, "1001"], [0, "0001"], [0, "0001"], [0, "0011"]]];
lev_6_map_2 = [[[0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0100"]], [[0, "0000"], [0, "1000"], [0, "0100"], [0, "0000"], [0, "1100"], [1, "1010"]], [[0, "0000"], [0, "0100"], [0, "1000"], [0, "0000"], [0, "0000"], [0, "1000"]], [[1, "1100"], [0, "0000"], [1, "1000"], [0, "0000"], [0, "0100"], [0, "0010"]], [[0, "1000"], [2, "0000"], [0, "0000"], [0, "0100"], [0, "0000"], [1, "0000"]], [[0, "0100"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0001"], [0, "1001"]]];
startPos_6_1 = [0, 1];
startPos_6_2 = [2, 4];
lev_7_map_1 = [[[0, "0100"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "1000"], [0, "0000"], [0, "0000"]], [[0, "1000"], [0, "0000"], [2, "0000"], [0, "0100"], [0, "1000"], [0, "0000"]], [[0, "0100"], [0, "1000"], [0, "0000"], [0, "0000"], [0, "0100"], [0, "1000"]], [[0, "0000"], [0, "0100"], [0, "1000"], [0, "0000"], [0, "0000"], [0, "0100"]], [[1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"]]];
lev_7_map_2 = [[[0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"], [0, "0000"]], [[0, "0000"], [1, "0000"], [0, "0000"], [2, "0000"], [0, "0000"], [1, "0000"]], [[0, "0000"], [0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0010"]]];
startPos_7_1 = [0, 0];
startPos_7_2 = [5, 5];
lev_8_map_1 = [[[1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"]], [[0, "0000"], [0, "0000"], [0, "1100"], [0, "1000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "1100"], [1, "0000"], [0, "0100"], [0, "1000"], [0, "0000"]], [[0, "0000"], [0, "0100"], [0, "1000"], [2, "1100"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0100"], [0, "0000"], [0, "0100"], [0, "0110"]], [[1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "1001"], [0, "0001"]]];
lev_8_map_2 = [[[1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "1100"], [2, "1000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "1100"], [1, "0000"], [0, "0100"], [0, "1000"]], [[0, "0000"], [0, "0000"], [0, "0100"], [0, "1000"], [0, "1100"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "0100"], [0, "0000"], [0, "0000"]], [[1, "0000"], [0, "0001"], [0, "1000"], [0, "0000"], [0, "1001"], [1, "0000"]]];
startPos_8_1 = [1, 1];
startPos_8_2 = [2, 3];
lev_9_map_1 = [[[0, "1100"], [0, "0100"], [0, "0100"], [0, "1100"], [0, "0100"], [0, "0110"]], [[0, "1000"], [0, "1100"], [0, "1000"], [0, "1000"], [2, "1100"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1010"]], [[0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "1010"]], [[0, "1001"], [0, "0001"], [0, "1001"], [0, "0001"], [0, "1001"], [0, "0011"]]];
lev_9_map_2 = [[[0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0100"]], [[0, "0000"], [0, "1000"], [0, "0100"], [0, "0000"], [0, "1100"], [1, "1010"]], [[0, "0000"], [0, "0100"], [0, "1000"], [0, "0000"], [0, "0000"], [0, "1000"]], [[1, "1100"], [0, "0000"], [1, "1000"], [0, "0000"], [0, "0100"], [0, "0010"]], [[0, "1000"], [2, "0000"], [0, "0000"], [0, "0100"], [0, "0000"], [1, "0000"]], [[0, "0100"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0001"], [0, "1001"]]];
startPos_9_1 = [1, 1];
startPos_9_2 = [2, 4];
lev_10_map_1 = [[[0, "0100"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "1000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [2, "0000"], [0, "0100"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0100"], [0, "1000"], [0, "0000"], [0, "0100"], [0, "1000"]], [[0, "0000"], [0, "0000"], [0, "0100"], [0, "1000"], [0, "0000"], [0, "0000"]], [[1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"]]];
lev_10_map_2 = [[[1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"]], [[0, "0000"], [0, "0000"], [0, "1100"], [0, "0000"], [0, "1000"], [0, "0000"]], [[0, "0000"], [0, "1100"], [0, "0000"], [0, "0000"], [0, "0100"], [0, "1000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [2, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0100"], [0, "1000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[1, "0000"], [0, "0000"], [0, "0100"], [0, "1000"], [0, "0000"], [0, "0010"]]];
startPos_10_1 = [0, 0];
startPos_10_2 = [5, 5];
lev_11_map_1 = [[[0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [1, "0000"], [0, "1000"], [0, "1000"], [1, "0000"], [0, "0000"]], [[0, "0000"], [0, "1000"], [0, "0000"], [0, "0000"], [0, "1000"], [2, "0000"]], [[0, "0000"], [0, "1100"], [0, "1000"], [0, "1000"], [0, "1000"], [0, "0000"]], [[0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"], [1, "0000"], [0, "0010"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "1000"], [0, "1000"], [0, "0000"]]];
lev_11_map_2 = [[[1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"]], [[0, "0000"], [0, "0000"], [0, "1000"], [0, "1100"], [0, "1000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "1000"], [0, "0000"], [0, "0000"], [0, "1000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "1000"], [0, "1000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [2, "0000"], [0, "1000"]], [[1, "0000"], [0, "0000"], [0, "1000"], [0, "0000"], [0, "1000"], [1, "0000"]]];
startPos_11_1 = [0, 2];
startPos_11_2 = [2, 3];
lev_12_map_1 = [[[0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"], [0, "0000"]], [[0, "0000"], [1, "0000"], [0, "0000"], [2, "0000"], [0, "0000"], [1, "0000"]], [[0, "0000"], [0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0010"]]];
lev_12_map_2 = [[[0, "0100"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"]], [[1, "0000"], [0, "0000"], [2, "0000"], [0, "0000"], [1, "0000"], [0, "0000"]], [[0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [1, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]], [[0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"], [0, "0000"]]];
startPos_12_1 = [5, 5];
startPos_12_2 = [0, 0];
function changeLevel(n) {
var newLevel = (currentLevel + n);
if (numOfLevels < newLevel) {
newLevel = 1;
}
if (newLevel < 1) {
newLevel = numOfLevels;
}
currentLevel = newLevel;
makeMap(currentLevel);
}
function reset() {
makeMap(currentLevel);
}
function undo() {
if (undoCount < 0) {
return(undefined);
}
var coords = undoArray.pop();
undoCount--;
var lasty1 = Ochar1.y;
var lastx1 = Ochar1.x;
var lasty2 = Ochar2.y;
var lastx2 = Ochar2.x;
Ochar1.x = coords[0];
Ochar1.y = coords[1];
Ochar2.x = coords[2];
Ochar2.y = coords[3];
this.con1.ball._x = Ochar1.x * tileSize;
this.con1.ball._y = Ochar1.y * tileSize;
this.con2.ball._x = Ochar2.x * tileSize;
this.con2.ball._y = Ochar2.y * tileSize;
if (map1[Ochar1.y][Ochar1.x][0] == 2) {
this.check1.gotoAndStop(2);
this.con1[(("t" + Ochar1.y) + "_") + Ochar1.x].tile.gotoAndStop(2);
} else if (map1[lasty1][lastx1][0] == 2) {
this.check1.gotoAndStop(1);
this.con1[(("t" + lasty1) + "_") + lastx1].tile.gotoAndStop(1);
}
if (map2[Ochar2.y][Ochar2.x][0] == 2) {
this.check2.gotoAndStop(2);
this.con2[(("t" + Ochar2.y) + "_") + Ochar2.x].tile.gotoAndStop(2);
} else if (map2[lasty2][lastx2][0] == 2) {
this.check2.gotoAndStop(1);
this.con2[(("t" + lasty2) + "_") + lastx2].tile.gotoAndStop(1);
}
}
function updateUndo() {
undoArray[++undoCount] = [Ochar1.x, Ochar1.y, Ochar2.x, Ochar2.y];
}
function control() {
if (_root.fall) {
return(undefined);
}
if (_root.dead) {
makeMap(currentLevel);
_root.dead = false;
return(undefined);
}
if (moving1) {
moveBall1();
}
if (moving2) {
moveBall2();
}
if (moving1 || (moving2)) {
return(undefined);
}
mx = (my = 0);
if (Key.isDown(Key.LEFT)) {
mx = -1;
updateUndo();
rollBall1();
rollBall2();
} else if (Key.isDown(Key.RIGHT)) {
mx = 1;
updateUndo();
rollBall1();
rollBall2();
} else if (Key.isDown(Key.UP)) {
my = -1;
updateUndo();
rollBall1();
rollBall2();
} else if (Key.isDown(Key.DOWN)) {
my = 1;
updateUndo();
rollBall1();
rollBall2();
}
if (Key.isDown(82)) {
reset();
}
if (Key.isDown(Key.SPACE) && ((lastSpace + 400) < getTimer())) {
lastSpace = getTimer();
undo();
}
if ((check1._currentframe == 2) && (check2._currentframe == 2)) {
clearArray[currentLevel - 1] = true;
done._visible = 1;
}
}
function rollBall1() {
moving1 = false;
if (0 < mx) {
var current = map1[Ochar1.y][Ochar1.x][1];
var next = map1[Ochar1.y][Ochar1.x + 1][1];
if ((Number(current.substr(2, 1)) == 0) && (Number(next.substr(0, 1)) == 0)) {
moving1 = true;
this.con1.ball.anim.gotoAndPlay("right");
}
}
if (mx < 0) {
var current = map1[Ochar1.y][Ochar1.x][1];
var next = map1[Ochar1.y][Ochar1.x - 1][1];
if ((Number(current.substr(0, 1)) == 0) && (Number(next.substr(2, 1)) == 0)) {
moving1 = true;
this.con1.ball.anim.gotoAndPlay("left");
}
}
if (0 < my) {
var current = map1[Ochar1.y][Ochar1.x][1];
var next = map1[Ochar1.y + 1][Ochar1.x][1];
if ((Number(current.substr(3, 1)) == 0) && (Number(next.substr(1, 1)) == 0)) {
moving1 = true;
this.con1.ball.anim.gotoAndPlay("down");
}
}
if (my < 0) {
var current = map1[Ochar1.y][Ochar1.x][1];
var next = map1[Ochar1.y - 1][Ochar1.x][1];
if ((Number(current.substr(1, 1)) == 0) && (Number(next.substr(3, 1)) == 0)) {
moving1 = true;
this.con1.ball.anim.gotoAndPlay("up");
}
}
var nextTile = map1[Ochar1.y + my][Ochar1.x + mx][0];
if (((nextTile == null) || (nextTile == 1)) && (moving1)) {
this.con1.ball.gotoAndPlay("fall");
}
lastmx1 = mx;
lastmy1 = my;
}
function rollBall2() {
moving2 = false;
if (0 < mx) {
var current = map2[Ochar2.y][Ochar2.x][1];
var next = map2[Ochar2.y][Ochar2.x + 1][1];
if ((Number(current.substr(2, 1)) == 0) && (Number(next.substr(0, 1)) == 0)) {
moving2 = true;
this.con2.ball.anim.gotoAndPlay("right");
}
}
if (mx < 0) {
var current = map2[Ochar2.y][Ochar2.x][1];
var next = map2[Ochar2.y][Ochar2.x - 1][1];
if ((Number(current.substr(0, 1)) == 0) && (Number(next.substr(2, 1)) == 0)) {
moving2 = true;
this.con2.ball.anim.gotoAndPlay("left");
}
}
if (0 < my) {
var current = map2[Ochar2.y][Ochar2.x][1];
var next = map2[Ochar2.y + 1][Ochar2.x][1];
if ((Number(current.substr(3, 1)) == 0) && (Number(next.substr(1, 1)) == 0)) {
moving2 = true;
this.con2.ball.anim.gotoAndPlay("down");
}
}
if (my < 0) {
var current = map2[Ochar2.y][Ochar2.x][1];
var next = map2[Ochar2.y - 1][Ochar2.x][1];
if ((Number(current.substr(1, 1)) == 0) && (Number(next.substr(3, 1)) == 0)) {
moving2 = true;
this.con2.ball.anim.gotoAndPlay("up");
}
}
var nextTile = map2[Ochar2.y + my][Ochar2.x + mx][0];
if (((nextTile == null) || (nextTile == 1)) && (moving2)) {
this.con2.ball.gotoAndPlay("fall");
}
lastmx2 = mx;
lastmy2 = my;
}
function moveBall1() {
this.con1.ball._x = this.con1.ball._x + mx;
this.con1.ball._y = this.con1.ball._y + my;
var bx = this.con1.ball._x;
var by = this.con1.ball._y;
var tx = (bx / tileSize);
var ty = (by / tileSize);
var offsetX = (Math.floor(tx) - tx);
var offsetY = (Math.floor(ty) - ty);
if ((offsetX == 0) && (offsetY == 0)) {
Ochar1.x = Math.floor(tx);
Ochar1.y = Math.floor(ty);
moving1 = false;
if (map1[Ochar1.y][Ochar1.x][0] == 2) {
this.check1.gotoAndStop(2);
this.con1[(("t" + Ochar1.y) + "_") + Ochar1.x].tile.gotoAndStop(2);
} else if (map1[Ochar1.y - lastmy1][Ochar1.x - lastmx1][0] == 2) {
this.check1.gotoAndStop(1);
this.con1[(("t" + (Ochar1.y - lastmy1)) + "_") + (Ochar1.x - lastmx1)].tile.gotoAndStop(1);
}
}
}
function moveBall2() {
this.con2.ball._x = this.con2.ball._x + mx;
this.con2.ball._y = this.con2.ball._y + my;
var bx = this.con2.ball._x;
var by = this.con2.ball._y;
var tx = (bx / tileSize);
var ty = (by / tileSize);
var offsetX = (Math.floor(tx) - tx);
var offsetY = (Math.floor(ty) - ty);
if ((offsetX == 0) && (offsetY == 0)) {
Ochar2.x = Math.floor(tx);
Ochar2.y = Math.floor(ty);
moving2 = false;
if (map2[Ochar2.y][Ochar2.x][0] == 2) {
this.check2.gotoAndStop(2);
this.con2[(("t" + Ochar2.y) + "_") + Ochar2.x].tile.gotoAndStop(2);
} else if (map2[Ochar2.y - lastmy2][Ochar2.x - lastmx2][0] == 2) {
this.check2.gotoAndStop(1);
this.con2[(("t" + (Ochar2.y - lastmy2)) + "_") + (Ochar2.x - lastmx2)].tile.gotoAndStop(1);
}
}
}
function makeMap(level) {
map1 = eval (("lev_" + level) + "_map_1");
map2 = eval (("lev_" + level) + "_map_2");
outLevel = "LEVEL " + level;
undoArray = [];
undoCount = 0;
check1.gotoAndStop(1);
check2.gotoAndStop(1);
mx = (my = (lastmx1 = (lastmy1 = 0)));
if (!clearArray[currentLevel - 1]) {
done._visible = 0;
} else {
done._visible = 1;
}
this.attachMovie("empty", "con1", 1);
this.attachMovie("empty", "con2", 2);
this.con1._x = 25;
this.con2._x = 265;
this.con1._y = 25;
this.con2._y = 25;
var y = 0;
while (y < map1.length) {
var x = 0;
while (x < map1[0].length) {
var n = ((("t" + y) + "_") + x);
this.con1.attachMovie("tile", n, ++depth);
this.con1[n]._x = x * tileSize;
this.con1[n]._y = y * tileSize;
var type = map1[y][x][0];
this.con1[n].gotoAndStop(type + 1);
if (type == 0) {
var num = Math.randomBetween(3, 10);
this.con1[n].tile.gotoAndStop(num);
}
var l = Number(map1[y][x][1].substr(0, 1));
var u = Number(map1[y][x][1].substr(1, 1));
var r = Number(map1[y][x][1].substr(2, 1));
var d = Number(map1[y][x][1].substr(3, 1));
this.con1[n].l._visible = l;
this.con1[n].u._visible = u;
this.con1[n].r._visible = r;
this.con1[n].d._visible = d;
x++;
}
y++;
}
this.con1.attachMovie("ball", "ball", ++depth);
var xb = eval (("startPos_" + level) + "_1")[0];
var yb = eval (("startPos_" + level) + "_1")[1];
this.con1.ball._x = xb * tileSize;
this.con1.ball._y = yb * tileSize;
Ochar1 = {x:xb, y:yb};
var y = 0;
while (y < map2.length) {
var x = 0;
while (x < map2[0].length) {
var n = ((("t" + y) + "_") + x);
this.con2.attachMovie("tile", n, ++depth);
this.con2[n]._x = x * tileSize;
this.con2[n]._y = y * tileSize;
var type = map2[y][x][0];
this.con2[n].gotoAndStop(type + 1);
if (type == 0) {
var num = Math.randomBetween(3, 10);
this.con2[n].tile.gotoAndStop(num);
}
var l = Number(map2[y][x][1].substr(0, 1));
var u = Number(map2[y][x][1].substr(1, 1));
var r = Number(map2[y][x][1].substr(2, 1));
var d = Number(map2[y][x][1].substr(3, 1));
this.con2[n].l._visible = l;
this.con2[n].u._visible = u;
this.con2[n].r._visible = r;
this.con2[n].d._visible = d;
x++;
}
y++;
}
this.con2.attachMovie("ball", "ball", ++depth);
var xb = eval (("startPos_" + level) + "_2")[0];
var yb = eval (("startPos_" + level) + "_2")[1];
this.con2.ball._x = xb * tileSize;
this.con2.ball._y = yb * tileSize;
this.con2.ball.color.gotoAndStop(2);
this.con2.ball.anim.num.gotoAndStop(2);
Ochar2 = {x:xb, y:yb};
undoArray[undoCount] = [Ochar1.x, Ochar1.y, Ochar2.x, Ochar2.y];
}
stop();
fscommand ("allowscale", false);
tileSize = 32;
currentLevel = 1;
numOfLevels = 12;
clearArray = new Array(numOfLevels);
Math.randomBetween = function (low_number, high_number) {
var this_number = (high_number - low_number);
var ran_unrounded = (Math.random() * this_number);
var ran_number = Math.round(ran_unrounded);
ran_number = ran_number + low_number;
return(ran_number);
};
makeMap(currentLevel);
Instance of Symbol 25 MovieClip [empty] in Frame 1
onClipEvent (enterFrame) {
_parent.control();
}
Symbol 5 MovieClip Frame 1
stop();
Symbol 14 MovieClip Frame 1
stop();
Symbol 19 MovieClip Frame 1
stop();
Symbol 20 MovieClip Frame 1
stop();
Symbol 20 MovieClip Frame 33
stop();
Symbol 20 MovieClip Frame 67
stop();
Symbol 20 MovieClip Frame 101
stop();
Symbol 20 MovieClip Frame 134
stop();
Symbol 24 MovieClip [ball] Frame 1
stop();
Symbol 24 MovieClip [ball] Frame 36
_root.fall = true;
Symbol 24 MovieClip [ball] Frame 48
_root.fall = false;
_root.dead = true;
stop();
Symbol 34 Button
on (release) {
changeLevel(1);
}
Symbol 38 Button
on (release) {
changeLevel(-1);
}
Symbol 46 MovieClip Frame 1
stop();