Frame 1
stop();
Stage.showMenu = false;
Frame 2
Frame 4
stop();
snd1.bgsound.start(0, 10000);
snd1.bgsound.setVolume(70);
Frame 5
function setTime() {
if (count > 0) {
count--;
counter = count;
if (scoreCount == 10) {
scoreCount = 0;
Score = Score + 25;
}
if (count == 0) {
car.spaceKeyPressed = true;
car.initialCount++;
car.checkParking(23, 18);
clearInterval(intervalId);
if (percent >= 90) {
gameClip.gotoAndStop(2);
} else if (percent < 90) {
gameClip.gotoAndStop(3);
}
if (percent > 0) {
updateScore();
}
}
}
}
function updateScore() {
if (counter < 10) {
bonusPoints = 1000;
} else if ((counter >= 10) && (counter <= 15)) {
bonusPoints = 2000;
} else if ((counter > 15) && (counter <= 20)) {
bonusPoints = 3000;
} else if ((counter > 20) && (counter <= 30)) {
bonusPoints = 4000;
} else if ((counter > 30) && (counter <= 40)) {
bonusPoints = 5000;
} else if ((counter > 40) && (counter <= 50)) {
bonusPoints = 6000;
} else if ((counter > 50) && (counter <= 60)) {
bonusPoints = 7000;
}
recalculateBonus = bonusPoints * (percent / 100);
score = (counter * 100) + bonusPoints;
level1Score = score;
trace("level1Score = " + level1Score);
if (score > minuspoints) {
score = score - minuspoints;
if (score < 0) {
score = 0;
}
}
}
stop();
counter = 60;
score = 0;
level1Score = 0;
count = counter;
bonusPoints = 0;
minuspoints = 0;
if (this._currentframe == 5) {
intervalId = setInterval(setTime, 1000);
}
var i = 3;
while (i <= 4) {
this[("kerb" + i) + "_mc"]._alpha = 0;
i++;
}
Instance of Symbol 100 MovieClip "car" in Frame 5
onClipEvent (load) {
function checkParking(numhitpoints, numhitpointsCaravan) {
clearInterval(_parent.intervalId);
var _local4 = 0;
var _local3 = 0;
var _local11 = _parent.target_mc;
var _local6 = _local11._x;
var _local8 = _local6 + _local11._width;
var _local5 = _local11._y;
var _local7 = _local5 + _local11._height;
var _local2 = 1;
while (_local2 <= numhitpoints) {
point.x = _parent.car["hit" + _local2]._x;
point.y = _parent.car["hit" + _local2]._y;
localToGlobal(point);
if ((((point.x > _local6) && (point.x < _local8)) && (point.y > _local5)) && (point.y < _local7)) {
_local4 = _local4 + 1;
}
_local2++;
}
_local2 = 1;
while (_local2 <= numhitpointsCaravan) {
point1.x = _parent.caravan["hit" + _local2]._x;
point1.y = _parent.caravan["hit" + _local2]._y;
localToGlobal(point1);
if ((((point1.x > _local6) && (point1.x < _local8)) && (point1.y > _local5)) && (point1.y < _local7)) {
_local3 = _local3 + 1;
}
_local2++;
}
var _local13 = Math.round((_local3 / numhitpointsCaravan) * 100);
var _local12 = Math.round((_local4 / numhitpoints) * 100);
_parent.percent = Math.round(_local12);
if (_parent.percent >= 90) {
_parent.gameClip.gotoAndStop(2);
} else if (_parent.percent < 90) {
_parent.gameClip.gotoAndStop(3);
}
if (_parent.percent > 0) {
_parent.updateScore();
}
trace("pointsCaravan = " + _local3);
trace("pointsCar = " + _local4);
trace("percentCaravan = " + _local13);
trace("percentCar = " + _local12);
trace("_parent.percent = " + _parent.percent);
}
function init(numcars, numkerbs, numhitpoints) {
incy = 0;
incx = 0;
speed = 0;
wheelRotation = 0;
widthScene = 600;
speedDecay = 0.85;
incSpeed = 0;
maxSpeed = 5;
incRotation = 0;
maxWheelAngle = 38;
carLength = 90;
rightWheel._rotation = wheelRotation;
leftWheel._rotation = wheelRotation;
point = new Object();
point1 = new Object();
numparkedcars = numcars;
numberkerbs = numkerbs;
onkerb = false;
_parent.target_mc._visible = false;
}
function checkKerbCollision() {
if (numberkerbs > 0) {
var _local3 = 0;
while (_local3 < numberkerbs) {
var _local5 = 23;
var _local4 = 1;
while (_local4 <= _local5) {
point.x = this["hit" + _local4]._x;
point.y = this["hit" + _local4]._y;
localToGlobal(point);
if (_parent[("kerb" + (_local3 + 1)) + "_mc"].hitTest(point.x, point.y)) {
if (_parent[("car" + (_local3 + 1)) + "_mc"].playOnce == false) {
_parent[("car" + (_local3 + 1)) + "_mc"].playOnce = true;
_parent[("car" + (_local3 + 1)) + "_mc"].gotoAndPlay("alarm");
_parent.snd2.alarmsound.start(0, 1);
}
_parent.minuspoints++;
return(true);
}
_local4++;
}
_local3++;
}
}
}
function side(v, po) {
return((po.y * v.x) - (po.x * v.y));
}
function hit(clip) {
return(inShape({x:clip._x, y:clip._y}) || (_parent.caravan.inShape({x:clip._x, y:clip._y})));
}
function inShape(p) {
toreturn = true;
oldPoint = {x:colShape[0].x, y:colShape[0].y};
localToGlobal(oldPoint);
i = 0;
while (i < 4) {
newPoint = {x:colShape[i + 1].x, y:colShape[i + 1].y};
localToGlobal(newPoint);
vShape = {x:newPoint.x - oldPoint.x, y:newPoint.y - oldPoint.y};
testPoint = {x:p.x - oldPoint.x, y:p.y - oldPoint.y};
if (side(vShape, testPoint) < 0) {
toreturn = false;
break;
}
oldPoint = newPoint;
i++;
}
return(toreturn);
}
function undoMove() {
_x = memoX;
_y = memoY;
_rotation = memoRot;
}
_parent.percent = 0;
initialCount = 0;
spaceKeyPressed = false;
leftKeyPressed = false;
rightKeyPressed = false;
upKeyPressed = false;
downKeyPressed = false;
colShape = new Array();
colShape[0] = {x:-15, y:-30};
colShape[1] = {x:110, y:-30};
colShape[2] = {x:110, y:30};
colShape[3] = {x:-15, y:30};
colShape[4] = colShape[0];
init(5, 13, 23);
_parent.caravan.init(5, 13, 21);
}
onClipEvent (enterFrame) {
if (initialCount == 0) {
memoX = _x;
memoY = _y;
memoRot = _rotation;
incRotation = 0;
incSpeed = 0;
leftKeyPressed = false;
rightKeyPressed = false;
upKeyPressed = false;
downKeyPressed = false;
spaceKeyPressed = false;
if (Key.isDown(32)) {
spaceKeyPressed = true;
}
if (Key.isDown(39)) {
rightKeyPressed = true;
}
if (Key.isDown(37)) {
leftKeyPressed = true;
}
if (Key.isDown(38)) {
upKeyPressed = true;
}
if (Key.isDown(40)) {
downKeyPressed = true;
}
if (leftKeyPressed == true) {
if (incRotation != 5) {
incRotation = 5;
toreturn = true;
}
}
if (rightKeyPressed == true) {
if (incRotation != -5) {
incRotation = -5;
toreturn = true;
}
}
if (upKeyPressed == true) {
if (incSpeed != -1) {
incSpeed = -1;
toreturn = true;
}
}
if (downKeyPressed == true) {
if (incSpeed != 1) {
incSpeed = 1;
toreturn = true;
}
}
if (spaceKeyPressed == true) {
initialCount++;
checkParking(23, 18);
}
oldRot = wheelRotation;
oldSpeed = speed;
speed = speed + incSpeed;
if (speed > maxSpeed) {
speed = maxSpeed;
} else if (speed < (-maxSpeed)) {
speed = -maxSpeed;
}
if (incSpeed == 0) {
speed = speed * speedDecay;
backLight.gotoAndStop(1);
} else {
backLight.gotoAndStop(2);
speed = speed + incSpeed;
if (speed > maxSpeed) {
speed = maxSpeed;
} else if (speed < (-maxSpeed)) {
speed = -maxSpeed;
}
}
wheelRotation = wheelRotation + incRotation;
if (wheelRotation > maxWheelAngle) {
wheelRotation = maxWheelAngle;
} else if (wheelRotation < (-maxWheelAngle)) {
wheelRotation = -maxWheelAngle;
}
if (oldRot != wheelRotation) {
rightWheel._rotation = -wheelRotation;
leftWheel._rotation = -wheelRotation;
}
incx = Math.sin(wheelRotation * 0.017453) * speed;
_rotation = (_rotation + (((incx / carLength) * 180) / 3.141593));
incy = Math.cos(wheelRotation * 0.017453) * speed;
_y = (_y + (Math.sin((_rotation + 0) * 0.017453) * incy));
_x = (_x + (Math.cos((_rotation + 0) * 0.017453) * incy));
if (checkKerbCollision()) {
if (!onkerb) {
onkerb = true;
}
} else {
onkerb = false;
}
if (onkerb == true) {
undoMove();
speed = 0;
}
_parent.caravan.compute();
restrictAngle = Math.abs(_rotation - _parent.caravan._rotation) % 360;
if (restrictAngle > 180) {
restrictAngle = 360 - restrictAngle;
}
if (restrictAngle > 75) {
D = true;
} else {
D = false;
}
if (D) {
if (Math.abs(speed) > 7) {
chocs = chocs + 1;
forceChocs = forceChocs + Math.abs(speed);
}
_x = memoX;
_y = memoY;
_rotation = memoRot;
speed = 0;
}
}
}
Frame 7
function setTime() {
if (count > 0) {
count--;
counter = count;
if (scoreCount == 10) {
scoreCount = 0;
Score = Score + 25;
}
if (count == 0) {
car.spaceKeyPressed = true;
car.initialCount++;
car.checkParking(23, 18);
clearInterval(intervalId);
if (percent >= 90) {
gameClip.gotoAndStop(2);
} else if (percent < 90) {
gameClip.gotoAndStop(3);
}
if (percent > 0) {
updateLevel2Score();
}
}
}
}
function updateLevel2Score() {
if (counter < 20) {
bonusPoints = 1000;
} else if ((counter >= 20) && (counter <= 40)) {
bonusPoints = 2000;
} else if ((counter > 40) && (counter <= 60)) {
bonusPoints = 3000;
} else if ((counter > 60) && (counter <= 80)) {
bonusPoints = 4000;
} else if ((counter > 80) && (counter <= 100)) {
bonusPoints = 5000;
} else if ((counter > 100) && (counter <= 110)) {
bonusPoints = 6000;
} else if ((counter > 110) && (counter <= 120)) {
bonusPoints = 7000;
}
recalculateBonus = bonusPoints * (percent / 100);
score = score + ((counter * 100) + bonusPoints);
level2Score = score;
trace("level2Score = " + level2Score);
if (score > minuspoints) {
score = score - minuspoints;
if (score < 0) {
score = 0;
}
}
}
stop();
counter = 120;
score = score + level1Score;
level2Score = 0;
count = counter;
bonusPoints = 0;
minuspoints = 0;
if (this._currentframe == 7) {
intervalId = setInterval(setTime, 1000);
}
var i = 4;
while (i <= 10) {
this[("kerb" + i) + "_mc"]._alpha = 0;
i++;
}
Instance of Symbol 134 MovieClip "car" in Frame 7
onClipEvent (load) {
function checkParking(numhitpoints, numhitpointsCaravan) {
clearInterval(_parent.intervalId);
var _local4 = 0;
var _local3 = 0;
var _local11 = _parent.target_mc;
var _local6 = _local11._x;
var _local8 = _local6 + _local11._width;
var _local5 = _local11._y;
var _local7 = _local5 + _local11._height;
var _local2 = 1;
while (_local2 <= numhitpoints) {
point.x = _parent.car["hit" + _local2]._x;
point.y = _parent.car["hit" + _local2]._y;
localToGlobal(point);
if ((((point.x > _local6) && (point.x < _local8)) && (point.y > _local5)) && (point.y < _local7)) {
_local4 = _local4 + 1;
}
_local2++;
}
_local2 = 1;
while (_local2 <= numhitpointsCaravan) {
point1.x = _parent.caravan["hit" + _local2]._x;
point1.y = _parent.caravan["hit" + _local2]._y;
localToGlobal(point1);
if ((((point1.x > _local6) && (point1.x < _local8)) && (point1.y > _local5)) && (point1.y < _local7)) {
_local3 = _local3 + 1;
}
_local2++;
}
var _local13 = Math.round((_local3 / numhitpointsCaravan) * 100);
var _local12 = Math.round((_local4 / numhitpoints) * 100);
_parent.percent = Math.round(_local12);
if (_parent.percent >= 90) {
_parent.gameClip.gotoAndStop(2);
} else if (_parent.percent < 90) {
_parent.gameClip.gotoAndStop(3);
}
if (_parent.percent > 0) {
_parent.updateLevel2Score();
}
trace("pointsCaravan = " + _local3);
trace("pointsCar = " + _local4);
trace("percentCaravan = " + _local13);
trace("percentCar = " + _local12);
trace("_parent.percent = " + _parent.percent);
}
function init(numcars, numkerbs, numhitpoints) {
incy = 0;
incx = 0;
speed = 0;
wheelRotation = 0;
widthScene = 600;
speedDecay = 0.85;
incSpeed = 0;
maxSpeed = 5;
incRotation = 0;
maxWheelAngle = 38;
carLength = 90;
rightWheel._rotation = wheelRotation;
leftWheel._rotation = wheelRotation;
point = new Object();
point1 = new Object();
numparkedcars = numcars;
numberkerbs = numkerbs;
onkerb = false;
_parent.target_mc._visible = false;
}
function checkKerbCollision() {
if (numberkerbs > 0) {
var _local3 = 0;
while (_local3 < numberkerbs) {
var _local5 = 23;
var _local4 = 1;
while (_local4 <= _local5) {
point.x = this["hit" + _local4]._x;
point.y = this["hit" + _local4]._y;
localToGlobal(point);
if (_parent[("kerb" + (_local3 + 1)) + "_mc"].hitTest(point.x, point.y)) {
if (_parent[("car" + (_local3 + 1)) + "_mc"].playOnce == false) {
_parent[("car" + (_local3 + 1)) + "_mc"].playOnce = true;
_parent[("car" + (_local3 + 1)) + "_mc"].gotoAndPlay("alarm");
_parent.snd2.alarmsound.start(0, 1);
}
_parent.minuspoints++;
return(true);
}
_local4++;
}
_local3++;
}
}
}
function side(v, po) {
return((po.y * v.x) - (po.x * v.y));
}
function hit(clip) {
return(inShape({x:clip._x, y:clip._y}) || (_parent.caravan.inShape({x:clip._x, y:clip._y})));
}
function inShape(p) {
toreturn = true;
oldPoint = {x:colShape[0].x, y:colShape[0].y};
localToGlobal(oldPoint);
i = 0;
while (i < 4) {
newPoint = {x:colShape[i + 1].x, y:colShape[i + 1].y};
localToGlobal(newPoint);
vShape = {x:newPoint.x - oldPoint.x, y:newPoint.y - oldPoint.y};
testPoint = {x:p.x - oldPoint.x, y:p.y - oldPoint.y};
if (side(vShape, testPoint) < 0) {
toreturn = false;
break;
}
oldPoint = newPoint;
i++;
}
return(toreturn);
}
function undoMove() {
_x = memoX;
_y = memoY;
_rotation = memoRot;
}
_parent.percent = 0;
initialCount = 0;
spaceKeyPressed = false;
leftKeyPressed = false;
rightKeyPressed = false;
upKeyPressed = false;
downKeyPressed = false;
colShape = new Array();
colShape[0] = {x:-15, y:-30};
colShape[1] = {x:110, y:-30};
colShape[2] = {x:110, y:30};
colShape[3] = {x:-15, y:30};
colShape[4] = colShape[0];
init(5, 10, 23);
_parent.caravan.init(5, 13, 21);
}
onClipEvent (enterFrame) {
if (initialCount == 0) {
memoX = _x;
memoY = _y;
memoRot = _rotation;
incRotation = 0;
incSpeed = 0;
leftKeyPressed = false;
rightKeyPressed = false;
upKeyPressed = false;
downKeyPressed = false;
spaceKeyPressed = false;
if (Key.isDown(32)) {
spaceKeyPressed = true;
}
if (Key.isDown(39)) {
rightKeyPressed = true;
}
if (Key.isDown(37)) {
leftKeyPressed = true;
}
if (Key.isDown(38)) {
upKeyPressed = true;
}
if (Key.isDown(40)) {
downKeyPressed = true;
}
if (leftKeyPressed == true) {
if (incRotation != 5) {
incRotation = 5;
toreturn = true;
}
}
if (rightKeyPressed == true) {
if (incRotation != -5) {
incRotation = -5;
toreturn = true;
}
}
if (upKeyPressed == true) {
if (incSpeed != -1) {
incSpeed = -1;
toreturn = true;
}
}
if (downKeyPressed == true) {
if (incSpeed != 1) {
incSpeed = 1;
toreturn = true;
}
}
if (spaceKeyPressed == true) {
initialCount++;
checkParking(23, 18);
}
oldRot = wheelRotation;
oldSpeed = speed;
speed = speed + incSpeed;
if (speed > maxSpeed) {
speed = maxSpeed;
} else if (speed < (-maxSpeed)) {
speed = -maxSpeed;
}
if (incSpeed == 0) {
speed = speed * speedDecay;
backLight.gotoAndStop(1);
} else {
backLight.gotoAndStop(2);
speed = speed + incSpeed;
if (speed > maxSpeed) {
speed = maxSpeed;
} else if (speed < (-maxSpeed)) {
speed = -maxSpeed;
}
}
wheelRotation = wheelRotation + incRotation;
if (wheelRotation > maxWheelAngle) {
wheelRotation = maxWheelAngle;
} else if (wheelRotation < (-maxWheelAngle)) {
wheelRotation = -maxWheelAngle;
}
if (oldRot != wheelRotation) {
rightWheel._rotation = -wheelRotation;
leftWheel._rotation = -wheelRotation;
}
incx = Math.sin(wheelRotation * 0.017453) * speed;
_rotation = (_rotation + (((incx / carLength) * 180) / 3.141593));
incy = Math.cos(wheelRotation * 0.017453) * speed;
_y = (_y + (Math.sin((_rotation + 0) * 0.017453) * incy));
_x = (_x + (Math.cos((_rotation + 0) * 0.017453) * incy));
if (checkKerbCollision()) {
if (!onkerb) {
onkerb = true;
}
} else {
onkerb = false;
}
if (onkerb == true) {
undoMove();
speed = 0;
}
_parent.caravan.compute();
restrictAngle = Math.abs(_rotation - _parent.caravan._rotation) % 360;
if (restrictAngle > 180) {
restrictAngle = 360 - restrictAngle;
}
if (restrictAngle > 75) {
D = true;
} else {
D = false;
}
if (D) {
if (Math.abs(speed) > 7) {
chocs = chocs + 1;
forceChocs = forceChocs + Math.abs(speed);
}
_x = memoX;
_y = memoY;
_rotation = memoRot;
speed = 0;
}
}
}
Frame 9
function setTime() {
if (count > 0) {
count--;
counter = count;
if (scoreCount == 10) {
scoreCount = 0;
Score = Score + 25;
}
if (count == 0) {
car.spaceKeyPressed = true;
car.initialCount++;
car.checkParking(23, 18);
clearInterval(intervalId);
if (percent >= 90) {
gameClip.gotoAndStop(2);
} else if (percent < 90) {
gameClip.gotoAndStop(3);
}
if (percent > 0) {
updateLevel3Score();
}
}
}
}
function updateLevel3Score() {
if (counter < 40) {
bonusPoints = 1000;
} else if ((counter >= 40) && (counter <= 60)) {
bonusPoints = 2000;
} else if ((counter > 60) && (counter <= 80)) {
bonusPoints = 3000;
} else if ((counter > 80) && (counter <= 100)) {
bonusPoints = 4000;
} else if ((counter > 100) && (counter <= 120)) {
bonusPoints = 5000;
} else if ((counter > 120) && (counter <= 140)) {
bonusPoints = 5500;
} else if ((counter > 140) && (counter <= 160)) {
bonusPoints = 6000;
} else if ((counter > 160) && (counter <= 180)) {
bonusPoints = 6500;
} else if ((counter > 180) && (counter <= 200)) {
bonusPoints = 7000;
}
recalculateBonus = bonusPoints * (percent / 100);
score = score + ((counter * 100) + bonusPoints);
if (score > minuspoints) {
score = score - minuspoints;
if (score < 0) {
score = 0;
}
}
}
stop();
counter = 200;
score = score + level2Score;
trace(score);
count = counter;
bonusPoints = 0;
minuspoints = 0;
if (this._currentframe == 9) {
intervalId = setInterval(setTime, 1000);
}
var i = 4;
while (i <= 10) {
this[("kerb" + i) + "_mc"]._alpha = 0;
i++;
}
Instance of Symbol 168 MovieClip "caravan" in Frame 9
onClipEvent (load) {
function getNewCoord(vx, vy, vax, vay, vbx, vby) {
return({a:((vy * vbx) - (vx * vby)) / ((vay * vbx) - (vax * vby)), b:((vy * vax) - (vx * vay)) / ((vby * vax) - (vbx * vay))});
}
function init(numcars, numkerbs, numhitpoints) {
onkerb = false;
point = new Object();
_rotation = -90;
setMemoTracteur();
r = -60;
numparkedcars = numcars;
numberkerbs = numkerbs;
}
function checkKerbCollision(numberkerbs) {
if (numberkerbs > 0) {
var _local4 = 0;
while (_local4 < numberkerbs) {
var _local5 = 18;
var _local3 = 1;
while (_local3 <= _local5) {
point.x = this["hit" + _local3]._x;
point.y = this["hit" + _local3]._y;
localToGlobal(point);
if (_parent[("kerb" + (_local4 + 1)) + "_mc"].hitTest(point.x, point.y)) {
return(true);
}
_local3++;
}
_local4++;
}
}
}
function caravanMemo(x, y) {
old_caravan_x = old_caravan_x + x;
old_caravan_y = old_caravan_y + y;
}
function setMemoTracteur() {
old_caravan = {x:10, y:0};
_parent.car.localToGlobal(old_caravan);
old_caravan_x = old_caravan.x;
old_caravan_y = old_caravan.y;
_x = old_caravan_x;
_y = old_caravan_y;
_parent.shadowCaravan._x = _x + 25;
_parent.shadowCaravan._y = _y + 25;
_parent.shadowCaravan._rotation = _rotation;
_parent.maskCaravan._x = _x;
_parent.maskCaravan._y = _y;
_parent.maskCaravan._rotation = _rotation;
}
function side(v, po) {
return((po.y * v.x) - (po.x * v.y));
}
function inShape(p) {
toreturn = true;
oldPoint = {x:colShape[0].x, y:colShape[0].y};
localToGlobal(oldPoint);
i = 0;
while (i < 4) {
newPoint = {x:colShape[i + 1].x, y:colShape[i + 1].y};
localToGlobal(newPoint);
vShape = {x:newPoint.x - oldPoint.x, y:newPoint.y - oldPoint.y};
testPoint = {x:p.x - oldPoint.x, y:p.y - oldPoint.y};
if (side(vShape, testPoint) < 0) {
toreturn = false;
break;
}
oldPoint = newPoint;
i++;
}
return(toreturn);
}
function compute() {
new_tracteur = {x:10, y:0};
_parent.car.localToGlobal(new_tracteur);
new_tracteur_x = new_tracteur.x;
new_tracteur_y = new_tracteur.y;
new_tracteur_rotation = _rotation;
centre = {x:-r, y:0};
localToGlobal(centre);
toutdroit_x = old_caravan_x - centre.x;
toutdroit_y = old_caravan_y - centre.y;
deptracteur_x = new_tracteur_x - old_caravan_x;
deptracteur_y = new_tracteur_y - old_caravan_y;
deptracteur = getNewCoord(deptracteur_x, deptracteur_y, toutdroit_x, toutdroit_y, -toutdroit_y, toutdroit_x);
new_tracteur_rotation = new_tracteur_rotation + ((deptracteur.b * 180) / 3.141593);
_x = new_tracteur.x;
_y = new_tracteur.y;
_rotation = new_tracteur_rotation;
old_caravan_x = _x;
old_caravan_y = _y;
_root.shadowCaravan._x = _x + 25;
_root.shadowCaravan._y = _y + 25;
_root.shadowCaravan._rotation = _rotation;
_root.maskCaravan._x = _x;
_root.maskCaravan._y = _y;
_root.maskCaravan._rotation = _rotation;
}
colShape = new Array();
colShape[0] = {x:-195, y:-60};
colShape[1] = {x:-40, y:-45};
colShape[2] = {x:-40, y:45};
colShape[3] = {x:-195, y:60};
colShape[4] = colShape[0];
}
onClipEvent (enterFrame) {
if (_parent.caravan.checkKerbCollision(13)) {
if (!onkerb) {
onkerb = true;
}
} else {
onkerb = false;
}
if (onkerb == true) {
_parent.car.undoMove();
_parent.car.speed = 0;
}
}
Instance of Symbol 170 MovieClip "car" in Frame 9
onClipEvent (load) {
function checkParking(numhitpoints, numhitpointsCaravan) {
clearInterval(_parent.intervalId);
var _local11 = 0;
var _local3 = 0;
var _local9 = _parent.target_mc;
var _local5 = _local9._x;
var _local7 = _local5 + _local9._width;
var _local4 = _local9._y;
var _local6 = _local4 + _local9._height;
var _local2 = 1;
_local2 = 1;
while (_local2 <= numhitpointsCaravan) {
point1.x = _parent.caravan["hit" + _local2]._x;
point1.y = _parent.caravan["hit" + _local2]._y;
localToGlobal(point1);
if ((((point1.x > _local5) && (point1.x < _local7)) && (point1.y > _local4)) && (point1.y < _local6)) {
_local3 = _local3 + 1;
}
_local2++;
}
var _local10 = Math.round((_local3 / numhitpointsCaravan) * 100);
_parent.percent = Math.round(_local10);
if (_parent.percent >= 90) {
_parent.gameClip.gotoAndStop(2);
} else if (_parent.percent < 90) {
_parent.gameClip.gotoAndStop(3);
}
if (_parent.percent > 0) {
_parent.updateLevel3Score();
}
trace("pointsCaravan = " + _local3);
trace("pointsCar = " + _local11);
trace("percentCaravan = " + _local10);
trace("percentCar = " + percentCar);
trace("_parent.percent = " + _parent.percent);
}
function init(numcars, numkerbs, numhitpoints) {
incy = 0;
incx = 0;
speed = 0;
wheelRotation = 0;
widthScene = 600;
speedDecay = 0.85;
incSpeed = 0;
maxSpeed = 5;
incRotation = 0;
maxWheelAngle = 38;
carLength = 90;
rightWheel._rotation = wheelRotation;
leftWheel._rotation = wheelRotation;
point = new Object();
point1 = new Object();
numparkedcars = numcars;
numberkerbs = numkerbs;
onkerb = false;
_parent.target_mc._visible = false;
}
function checkKerbCollision() {
if (numberkerbs > 0) {
var _local3 = 0;
while (_local3 < numberkerbs) {
var _local5 = 21;
var _local4 = 1;
while (_local4 <= _local5) {
point.x = this["hit" + _local4]._x;
point.y = this["hit" + _local4]._y;
localToGlobal(point);
if (_parent[("kerb" + (_local3 + 1)) + "_mc"].hitTest(point.x, point.y)) {
if (_parent[("car" + (_local3 + 1)) + "_mc"].playOnce == false) {
_parent[("car" + (_local3 + 1)) + "_mc"].playOnce = true;
_parent[("car" + (_local3 + 1)) + "_mc"].gotoAndPlay("alarm");
_parent.snd2.alarmsound.start(0, 1);
}
_parent.minuspoints++;
return(true);
}
_local4++;
}
_local3++;
}
}
}
function side(v, po) {
return((po.y * v.x) - (po.x * v.y));
}
function hit(clip) {
return(inShape({x:clip._x, y:clip._y}) || (_parent.caravan.inShape({x:clip._x, y:clip._y})));
}
function inShape(p) {
toreturn = true;
oldPoint = {x:colShape[0].x, y:colShape[0].y};
localToGlobal(oldPoint);
i = 0;
while (i < 4) {
newPoint = {x:colShape[i + 1].x, y:colShape[i + 1].y};
localToGlobal(newPoint);
vShape = {x:newPoint.x - oldPoint.x, y:newPoint.y - oldPoint.y};
testPoint = {x:p.x - oldPoint.x, y:p.y - oldPoint.y};
if (side(vShape, testPoint) < 0) {
toreturn = false;
break;
}
oldPoint = newPoint;
i++;
}
return(toreturn);
}
function undoMove() {
_x = memoX;
_y = memoY;
_rotation = memoRot;
}
_parent.percent = 0;
initialCount = 0;
spaceKeyPressed = false;
leftKeyPressed = false;
rightKeyPressed = false;
upKeyPressed = false;
downKeyPressed = false;
colShape = new Array();
colShape[0] = {x:-15, y:-30};
colShape[1] = {x:110, y:-30};
colShape[2] = {x:110, y:30};
colShape[3] = {x:-15, y:30};
colShape[4] = colShape[0];
init(5, 13, 21);
_parent.caravan.init(5, 13, 21);
}
onClipEvent (enterFrame) {
if (initialCount == 0) {
memoX = _x;
memoY = _y;
memoRot = _rotation;
incRotation = 0;
incSpeed = 0;
leftKeyPressed = false;
rightKeyPressed = false;
upKeyPressed = false;
downKeyPressed = false;
spaceKeyPressed = false;
if (Key.isDown(32)) {
spaceKeyPressed = true;
}
if (Key.isDown(39)) {
rightKeyPressed = true;
}
if (Key.isDown(37)) {
leftKeyPressed = true;
}
if (Key.isDown(38)) {
upKeyPressed = true;
}
if (Key.isDown(40)) {
downKeyPressed = true;
}
if (leftKeyPressed == true) {
if (incRotation != 5) {
incRotation = 5;
toreturn = true;
}
}
if (rightKeyPressed == true) {
if (incRotation != -5) {
incRotation = -5;
toreturn = true;
}
}
if (upKeyPressed == true) {
if (incSpeed != -1) {
incSpeed = -1;
toreturn = true;
}
}
if (downKeyPressed == true) {
if (incSpeed != 1) {
incSpeed = 1;
toreturn = true;
}
}
if (spaceKeyPressed == true) {
initialCount++;
checkParking(21, 18);
}
oldRot = wheelRotation;
oldSpeed = speed;
speed = speed + incSpeed;
if (speed > maxSpeed) {
speed = maxSpeed;
} else if (speed < (-maxSpeed)) {
speed = -maxSpeed;
}
if (incSpeed == 0) {
speed = speed * speedDecay;
backLight.gotoAndStop(1);
} else {
backLight.gotoAndStop(2);
speed = speed + incSpeed;
if (speed > maxSpeed) {
speed = maxSpeed;
} else if (speed < (-maxSpeed)) {
speed = -maxSpeed;
}
}
wheelRotation = wheelRotation + incRotation;
if (wheelRotation > maxWheelAngle) {
wheelRotation = maxWheelAngle;
} else if (wheelRotation < (-maxWheelAngle)) {
wheelRotation = -maxWheelAngle;
}
if (oldRot != wheelRotation) {
rightWheel._rotation = -wheelRotation;
leftWheel._rotation = -wheelRotation;
}
incx = Math.sin(wheelRotation * 0.017453) * speed;
_rotation = (_rotation + (((incx / carLength) * 180) / 3.141593));
incy = Math.cos(wheelRotation * 0.017453) * speed;
_y = (_y + (Math.sin((_rotation + 0) * 0.017453) * incy));
_x = (_x + (Math.cos((_rotation + 0) * 0.017453) * incy));
if (checkKerbCollision()) {
if (!onkerb) {
onkerb = true;
}
} else {
onkerb = false;
}
if (onkerb == true) {
undoMove();
speed = 0;
}
_parent.caravan.compute();
restrictAngle = Math.abs(_rotation - _parent.caravan._rotation) % 360;
if (restrictAngle > 180) {
restrictAngle = 360 - restrictAngle;
}
if (restrictAngle > 75) {
D = true;
} else {
D = false;
}
if (D) {
if (Math.abs(speed) > 7) {
chocs = chocs + 1;
forceChocs = forceChocs + Math.abs(speed);
}
_x = memoX;
_y = memoY;
_rotation = memoRot;
speed = 0;
}
}
}
Symbol 23 MovieClip Frame 1
stop();
Symbol 27 Button
on (release) {
getURL ("http://www.freegames911.com", "_self");
}
Symbol 28 MovieClip Frame 1
LoaderBlk.useHandCursor = false;
Instance of Symbol 23 MovieClip in Symbol 28 MovieClip Frame 72
onClipEvent (load) {
total = _parent._parent.getBytesTotal();
}
onClipEvent (enterFrame) {
loaded = _parent._parent.getBytesLoaded();
percent = int((loaded / total) * 100);
gotoAndStop(percent);
perText = percent + "%";
if (percent >= 100) {
_parent._parent.gotoAndPlay("startgame");
}
}
Symbol 28 MovieClip Frame 73
stop();
LoaderBlk.useHandCursor = false;
Symbol 30 MovieClip Frame 1
bgsound = new Sound(this);
bgsound.attachSound("bgsound");
Symbol 31 MovieClip Frame 1
alarmsound = new Sound(this);
alarmsound.attachSound("alarm");
Symbol 42 MovieClip Frame 1
stop();
this.playOnce = false;
Symbol 46 MovieClip Frame 1
stop();
this.playOnce = false;
Symbol 51 MovieClip Frame 1
stop();
this.playOnce = false;
Symbol 69 Button
on (release) {
gotoAndStop ("level1");
}
Symbol 94 MovieClip Frame 1
stop();
this.playOnce = false;
Symbol 111 Button
on (release) {
_parent._parent.gotoAndStop("level2");
}
Symbol 118 MovieClip Frame 9
stop();
score = _parent._parent.score;
percent = _parent._parent.percent + "%";
Symbol 120 Button
on (release) {
_parent._parent.snd1.bgsound.stop();
_parent._parent.gotoAndPlay("startgame");
}
Symbol 125 Button
on (release) {
getURL ("http://www.freegames911.com", "_self");
}
Symbol 126 MovieClip Frame 9
stop();
score = _parent._parent.score;
percent = _parent._parent.percent + "%";
Symbol 127 MovieClip Frame 1
stop();
Symbol 134 MovieClip Frame 1
stop();
Symbol 141 MovieClip Frame 1
stop();
this.playOnce = false;
Symbol 142 MovieClip Frame 1
stop();
this.playOnce = false;
Symbol 144 MovieClip Frame 1
stop();
this.playOnce = false;
Symbol 152 Button
on (release) {
_parent._parent.gotoAndStop("level3");
}
Symbol 155 MovieClip Frame 9
stop();
score = _parent._parent.score;
percent = _parent._parent.percent + "%";
Symbol 156 Button
on (release) {
_parent._parent.score = _parent._parent.level1Score;
trace("_parent._parent.level1Score = " + _parent._parent.level1Score);
trace("score = " + _parent._parent.score);
_parent._parent.gotoAndPlay("resetlevel2");
}
Symbol 159 MovieClip Frame 9
stop();
score = _parent._parent.score;
percent = _parent._parent.percent + "%";
Symbol 160 MovieClip Frame 1
stop();
Symbol 170 MovieClip Frame 1
stop();
Symbol 174 MovieClip Frame 1
stop();
this.playOnce = false;
Instance of Symbol 172 MovieClip "hitarea" in Symbol 174 MovieClip Frame 1
onClipEvent (load) {
_visible = false;
}
Symbol 189 Button
on (release) {
_parent._parent.snd1.bgsound.stop();
_parent._parent.gotoAndPlay("startgame");
}
Symbol 190 MovieClip Frame 9
stop();
score = _parent._parent.score;
percent = _parent._parent.percent + "%";
Symbol 191 Button
on (release) {
_parent._parent.score = _parent._parent.level2Score;
trace("score = " + score);
_parent._parent.gotoAndPlay("resetlevel3");
}
Symbol 194 MovieClip Frame 9
stop();
score = _parent._parent.score;
percent = _parent._parent.percent + "%";
Symbol 195 MovieClip Frame 1
stop();