Frame 1
function prepareBoard(boardNum, resetMoves) {
msg.swapDepths(13600);
msg.gotoAndPlay("stagePass");
var i = 0;
while (i <= 5) {
var j = 1;
while (j <= 5) {
this[("bridge" + i) + j]._visible = false;
j++;
}
i++;
}
bridgesArray = this["bridges" + boardNum].split(",");
var i = 0;
while (i < bridgesArray.length) {
if (bridgesArray[i].substr(0, 1) > bridgesArray[i].substr(1, 1)) {
bridgesArray[i] = bridgesArray[i].substr(1, 1) + bridgesArray[i].substr(0, 1);
}
this["bridge" + bridgesArray[i]]._visible = true;
this["bridge" + bridgesArray[i]].swapDepths(1000 + (i * 100));
i++;
}
positionsArray = this["positions" + boardNum].split(",");
carOnParking = new Array();
var i = 1;
while (i <= 5) {
this["car" + positionsArray[i - 1]]._x = this["parking" + i]._x;
this["car" + positionsArray[i - 1]]._y = this["parking" + i]._y;
carOnParking[i] = positionsArray[i - 1];
i++;
}
if (resetMoves == true) {
moves = 0;
}
freeParking = 0;
checkPositions();
rotateAllConnectedCars();
}
function clearBoard() {
var i = 0;
while (i <= 5) {
var j = 1;
while (j <= 5) {
this[("bridge" + i) + j]._visible = false;
j++;
}
i++;
}
var i = 1;
while (i <= 5) {
this["car" + i].gotoAndStop(6);
i++;
}
var i = 1;
while (i <= 6) {
this["parking" + i].gotoAndStop(7);
i++;
}
msg.gotoAndStop(1);
}
function connectionExists(fromTo) {
if (fromTo.substr(0, 1) > fromTo.substr(1, 1)) {
fromTo = fromTo.substr(1, 1) + fromTo.substr(0, 1);
}
var i = 0;
while (i < bridgesArray.length) {
if (fromTo == bridgesArray[i]) {
return(true);
}
i++;
}
return(false);
}
function rotateAllConnectedCars() {
var i = 0;
while (i <= 5) {
if (connectionExists(i.toString() + freeParking)) {
this["car" + carOnParking[i]].rotateCarToFree();
} else {
carStoppedRotating();
}
i++;
}
}
function crossBridge(parkingNum) {
carToMove = carOnParking[parkingNum];
if (animation) {
buttonsBlocked(true);
if (parkingNum > freeParking) {
bridgeToCross = freeParking.toString() + parkingNum;
} else {
bridgeToCross = parkingNum.toString() + freeParking;
}
_root["car" + carToMove].swapDepths(_root["bridge" + bridgeToCross].getDepth() + 1);
this["car" + carToMove]._rotation = this["car" + carToMove].targetAngle;
this["car" + carToMove].gas.play();
xStartDistance = _root["parking" + freeParking]._x - _root["car" + carToMove]._x;
yStartDistance = _root["parking" + freeParking]._y - _root["car" + carToMove]._y;
carMover.onEnterFrame = function () {
xDistance = _root["parking" + freeParking]._x - _root["car" + carToMove]._x;
yDistance = _root["parking" + freeParking]._y - _root["car" + carToMove]._y;
_root["car" + carToMove]._x = _root["car" + carToMove]._x + (xStartDistance / 30);
_root["car" + carToMove]._y = _root["car" + carToMove]._y + (yStartDistance / 30);
if ((Math.abs(xDistance) < 5) and (Math.abs(yDistance) < 5)) {
_root["car" + carToMove]._x = _root["parking" + freeParking]._x;
_root["car" + carToMove]._y = _root["parking" + freeParking]._y;
carOnParking[parkingNum] = 0;
carOnParking[freeParking] = carToMove;
freeParking = parkingNum;
moves++;
checkPositions();
stoppedRotatingCars = 0;
rotateAllConnectedCars();
delete this.onEnterFrame;
}
};
} else {
_root["car" + carToMove]._x = _root["parking" + freeParking]._x;
_root["car" + carToMove]._y = _root["parking" + freeParking]._y;
carOnParking[parkingNum] = 0;
carOnParking[freeParking] = carToMove;
freeParking = parkingNum;
moves++;
checkPositions();
stoppedRotatingCars = 0;
rotateAllConnectedCars();
}
}
function checkPositions() {
totalCorrects = 0;
var i = 1;
while (i <= 5) {
if (carOnParking[i] == i) {
this["parking" + i].correctCar._visible = true;
totalCorrects++;
} else {
this["parking" + i].correctCar._visible = false;
}
i++;
}
if (totalCorrects == 5) {
BoardFinished();
}
}
function BoardFinished() {
boardScore = (maxMoves - moves) * 10;
if (boardScore < 0) {
boaedScore = 0;
}
addScore(boardScore);
boardScoreBlinker.gotoAndPlay("blink");
blowup.gotoAndPlay("blow");
currentBoard++;
prepareBoard(currentBoard, true);
}
function buttonsBlocked(bulian) {
var i = 0;
while (i <= 5) {
this["parking" + i].btn._visible = !bulian;
i++;
}
}
function carStoppedRotating() {
stoppedRotatingCars++;
if (stoppedRotatingCars == 6) {
buttonsBlocked(false);
stoppedRotatingCars = 0;
var i = 0;
while (i <= 5) {
if (connectionExists(i.toString() + freeParking)) {
this["parking" + i].btn._visible = true;
} else {
this["parking" + i].btn._visible = false;
}
i++;
}
}
}
function addScore(points) {
score = score + points;
scoreText = thousandsDot(score);
}
function thousandsDot(scoreNum) {
textualNum = scoreNum.toString();
if (scoreNum > 1000) {
last3figures = textualNum.substr(-3);
Thousendsfigures = textualNum.substring(0, textualNum.length - 3);
textualNum = (Thousendsfigures + ".") + last3figures;
}
return(textualNum);
}
function gameOver() {
buttonsBlocked(true);
msg.gotoAndPlay("enterScore");
}
function submitScore() {
myScore = Number(_root.scoreText);
if (scoreText.indexOf(".") > -1) {
myScore = myScore * 1000;
}
top10Vars.send((((("submitScore.asp?name=" + msg.myName) + "&carNum =") + msg.myCar) + "&score=") + myScore);
}
positions1 = "2,3,5,1,4";
bridges1 = "10,12,23,34,45,50,30,14,25";
positions2 = "5,4,2,3,1";
bridges2 = "10,20,40,50,15,23,34";
positions3 = "3,4,5,1,2";
bridges3 = "20,30,40,13,14,25,35";
positions4 = "4,3,5,2,1";
bridges4 = "30,10,50,15,14,25,24,23,34";
positions5 = "5,4,2,1,3";
bridges5 = "10,50,12,13,14,23,24,25,34,35,45";
positions6 = "5,3,4,2,1";
bridges6 = "10,12,14,15,23,24,25,34,45,50";
positions7 = "4,5,1,2,3";
bridges7 = "13,14,15,20,24,25,30,35,40";
positions8 = "3,5,4,2,1";
bridges8 = "10,12,15,23,24,34,30,45,50";
positions9 = "4,5,1,2,3";
bridges9 = "12,13,14,20,25,35,30,45,40";
positions10 = "2,4,5,1,3";
bridges10 = "10,12,23,24,30,34,45,50";
positions11 = "3,4,2,5,1";
bridges11 = "12,13,14,20,25,35,45,40";
positions12 = "3,4,5,2,1";
bridges12 = "10,12,13,20,23,31,34,35,45,40,50";
positions13 = "3,5,4,1,2";
bridges13 = "10,12,15,20,23,34,45,40,50";
positions14 = "5,3,4,1,2";
bridges14 = "10,12,13,23,30,34,35,45,50";
positions15 = "3,5,2,1,4";
bridges15 = "10,12,20,23,24,34,40,45,50";
positions16 = "4,1,5,3,2";
bridges16 = "10,13,20,23,34,35,40,50";
positions17 = "5,4,2,3,1";
bridges17 = "12,13,15,20,24,30,35,40,45";
positions18 = "3,5,4,1,2";
bridges18 = "10,12,13,15,20,23,24,34,35,40,45,50";
positions19 = "4,3,2,5,1";
bridges19 = "13,14,15,20,25,30,35,40";
positions20 = "2,5,4,1,3";
bridges20 = "10,12,14,23,25,34,45,50";
positions21 = "2,4,1,5,3";
bridges21 = "01,05,12,13,14,25,35,45";
positions22 = "5,4,2,1,3";
bridges22 = "01,03,05,12,15,23,34,45";
positions23 = "2,3,4,5,1";
bridges23 = "01,03,05,14,23,24,25,34";
positions24 = "5,4,1,2,3";
bridges24 = "01,02,04,05,12,13,35,45";
positions25 = "4,3,5,1,2";
bridges25 = "02,04,13,14,15,24,25,35";
positions26 = "5,1,4,3,2";
bridges26 = "01,02,03,04,05,12,23,34,45";
positions27 = "4,3,5,2,1";
bridges27 = "02,03,04,12,13,24,35,45";
positions28 = "5,1,4,2,3";
bridges28 = "01,03,05,14,15,23,25,34";
positions29 = "3,1,2,5,4";
bridges29 = "02,03,04,13,14,24,25,35";
positions30 = "3,4,5,1,2";
bridges30 = "01,05,14,15,23,24,25,34";
positions31 = "3,5,2,1,4";
bridges31 = "01,05,12,15,23,34,45";
positions32 = "4,3,5,2,1";
bridges32 = "01,03,05,12,23,34,45";
positions33 = "5,4,3,2,1";
bridges33 = "01,05,12,15,23,24,34,45";
positions34 = "5,4,1,3,2";
bridges34 = "02,03,04,12,13,15,35,45";
positions35 = "5,4,2,3,1";
bridges35 = "01,05,12,13,23,34,35,45";
positions36 = "2,3,4,5,1";
bridges36 = "02,04,12,13,15,24,35,45";
positions37 = "3,4,2,5,1";
bridges37 = "01,03,05,14,23,25,34";
positions38 = "4,3,5,2,1";
bridges38 = "01,05,12,23,24,34,45";
positions39 = "3,4,5,1,2";
bridges39 = "01,05,13,14,24,25,35";
positions40 = "5,3,2,1,4";
bridges40 = "01,05,14,15,23,25,34";
totalBoards = 40;
this.createEmptyMovieClip("carMover", 2000);
top10Vars = new LoadVars();
stop();
Frame 9
instructions.gotoAndPlay("open");
stop();
Frame 20
top10.gotoAndPlay("open");
stop();
Instance of Symbol 164 MovieClip "msg" in Frame 29
onClipEvent (load) {
this.swapDepths(15000);
}
Frame 30
var i = 1;
while (i <= 5) {
this["parking" + i].gotoAndStop(i);
this["car" + i].gotoAndStop(i);
this["car" + i].swapDepths(500 + i);
i++;
}
parking0.gotoAndStop(6);
currentBoard = 1;
score = 0;
maxMoves = 50;
animation = true;
prepareBoard(1, true);
stop();
Symbol 9 Button
on (press) {
_root.gotoAndPlay("game");
}
Symbol 12 Button
on (press) {
_root.gotoAndPlay("top10");
}
Symbol 15 Button
on (press) {
_root.gotoAndPlay("instructions");
}
Symbol 32 Button
on (press) {
gotoAndPlay (39);
}
Symbol 44 MovieClip Frame 1
stop();
Symbol 44 MovieClip Frame 31
stop();
Symbol 51 Button
on (press) {
gotoAndPlay (39);
}
Symbol 53 MovieClip Frame 1
spacing = 30;
var i = 2;
while (i <= 10) {
duplicateMovieClip ("highScore1", "highScore" + i, 100 + i);
this["highScore" + i]._x = this["highScore" + (i - 1)]._x;
this["highScore" + i]._y = this["highScore" + (i - 1)]._y + spacing;
i++;
}
Symbol 59 MovieClip Frame 1
stop();
Symbol 59 MovieClip Frame 26
Symbol 59 MovieClip Frame 31
stop();
Symbol 67 Button
on (release) {
_root.crossBridge(this._name.substr(-1));
}
Symbol 72 MovieClip Frame 1
stop();
Instance of Symbol 62 MovieClip "correctCar" in Symbol 72 MovieClip Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 72 MovieClip Frame 2
stop();
Symbol 72 MovieClip Frame 3
stop();
Symbol 72 MovieClip Frame 4
stop();
Symbol 72 MovieClip Frame 5
stop();
Symbol 72 MovieClip Frame 6
stop();
Symbol 72 MovieClip Frame 7
stop();
Symbol 84 MovieClip Frame 1
stop();
Symbol 89 MovieClip Frame 1
function rotateCarToFree() {
yDistance = _root["parking" + _root.freeParking]._y - this._y;
xDistance = _root["parking" + _root.freeParking]._x - this._x;
targetAngle = (Math.atan2(yDistance, xDistance) * 180) / Math.PI;
rotator.onEnterFrame = function () {
deltaAngle = targetAngle - _rotation;
if (Math.abs(deltaAngle) > 10) {
if (((deltaAngle > 0) and (deltaAngle < 180)) or ((deltaAngle > -360) and (deltaAngle < -180))) {
_rotation = (_rotation + 10);
} else {
_rotation = (_rotation - 10);
}
} else {
_rotation = targetAngle;
_root.carStoppedRotating();
delete this.onEnterFrame;
}
};
}
stop();
this.createEmptyMovieClip("rotator", 100);
Symbol 89 MovieClip Frame 2
stop();
Symbol 89 MovieClip Frame 3
stop();
Symbol 89 MovieClip Frame 4
stop();
Symbol 89 MovieClip Frame 5
stop();
Symbol 89 MovieClip Frame 6
stop();
Symbol 104 MovieClip Frame 1
stop();
Symbol 104 MovieClip Frame 9
Symbol 104 MovieClip Frame 20
boardScoreText = "+" + _root.boardScore;
Symbol 109 Button
on (press) {
_root.animation = false;
gotoAndStop (7);
}
Symbol 110 Button
on (press) {
_root.animation = true;
gotoAndStop (1);
}
Symbol 111 MovieClip Frame 1
stop();
Symbol 111 MovieClip Frame 7
stop();
Symbol 120 Button
on (release) {
getURL ("javascript:window.location=window.location");
}
Symbol 127 Button
on (release) {
prepareBoard(currentBoard, false);
}
Symbol 128 Button
on (press) {
BoardFinished();
}
Symbol 152 Button
on (release) {
_root.submitScore();
}
Symbol 153 Button
on (press) {
markCar(1);
}
Symbol 154 Button
on (press) {
markCar(2);
}
Symbol 155 Button
on (press) {
markCar(3);
}
Symbol 156 Button
on (press) {
markCar(4);
}
Symbol 157 Button
on (press) {
markCar(5);
}
Symbol 164 MovieClip Frame 1
stop();
Symbol 164 MovieClip Frame 14
boardNum = _root.currentBoard;
Symbol 164 MovieClip Frame 63
stop();
Instance of Symbol 89 MovieClip "car1" in Symbol 164 MovieClip Frame 78
onClipEvent (load) {
gotoAndStop (1);
}
Instance of Symbol 89 MovieClip "car2" in Symbol 164 MovieClip Frame 78
onClipEvent (load) {
gotoAndStop (2);
}
Instance of Symbol 89 MovieClip "car3" in Symbol 164 MovieClip Frame 78
onClipEvent (load) {
gotoAndStop (3);
}
Instance of Symbol 89 MovieClip "car4" in Symbol 164 MovieClip Frame 78
onClipEvent (load) {
gotoAndStop (4);
}
Instance of Symbol 89 MovieClip "car5" in Symbol 164 MovieClip Frame 78
onClipEvent (load) {
gotoAndStop (5);
}
Symbol 164 MovieClip Frame 82
function markCar(carNum) {
carMarker._x = this["car" + carNum]._x;
carMarker._y = this["car" + carNum]._y;
myCar = carNum;
}
stop();
Symbol 164 MovieClip Frame 96
stop();
_parent.gotoAndPlay("top10");