Frame 1
function startCompetition() {
bg.gotoAndStop(3);
bg.but_next._visible = false;
bg.but_back.onRelease = backToStart;
bg.but_reset.gotoAndStop(2);
bg.but_start.onRelease = function () {
bg.but_next._visible = true;
board.loadCompetition();
};
getHighscore();
}
function startTraining() {
bg.gotoAndStop(2);
bg.but_next._visible = false;
bg.but_back.onRelease = backToStart;
bg.but_start.onRelease = function () {
board.loadTraining();
};
bg.but_reset.gotoAndStop(2);
bg.createEmptyMovieClip("container", 1);
bg.container._x = 426;
bg.container._y = 211;
loadLevelMenu(1);
loadLevelMenu(2);
loadLevelMenu(3);
loadLevelMenu(4);
}
function backToStart() {
bg.container.removeMovieClip();
bg.gotoAndStop(1);
bg.but_competition.onRelease = startCompetition;
bg.but_training.onRelease = startTraining;
}
function loadLevelMenu(num) {
var _local4 = new Level().getDifficultyLevels(num);
var _local2 = 0;
while (_local2 < _local4.length) {
var _local3 = bg.container.attachMovie("menupoint" + num, "level" + _local4[_local2], bg.container.getNextHighestDepth());
_local3._x = _local2 * 18;
_local3._y = num * 20;
_local3.txt.text = _local4[_local2];
_local3.onRelease = function () {
this._parent["level" + board.level].gotoAndStop(1);
board.loadLevel(this.txt.text);
this.gotoAndStop(2);
};
_local2++;
}
}
function competitionPopUp(time) {
if (time < worstscore) {
var _local2 = this.attachMovie("competitionpopup", "popup", this.getNextHighestDepth());
_local2.gotoAndStop(1);
_local2.thename.restrict = "A-Z a-z 0-9";
_local2.submit_but.onRelease = function () {
if (this._parent.thename.text != "") {
this._parent._parent.saveHighscore(this._parent.thename.text, time);
this._parent.removeMovieClip();
bg.but_start.onRelease = function () {
board.loadCompetition();
};
bg.but_back.onRelease = backToStart;
}
};
_local2.cancel_but.onRelease = function () {
this._parent.removeMovieClip();
bg.but_start.onRelease = function () {
board.loadCompetition();
};
bg.but_back.onRelease = backToStart;
};
} else {
var _local2 = this.attachMovie("competitionpopup", "popup", this.getNextHighestDepth());
_local2.gotoAndStop(2);
_local2.cancel_but.onRelease = function () {
this._parent.removeMovieClip();
bg.but_start.onRelease = function () {
board.loadCompetition();
};
bg.but_back.onRelease = backToStart;
};
}
}
function getHighscore() {
var _local1 = "connection.php";
var vars = new LoadVars();
vars.command = "getHighscore";
vars.onLoad = function (success) {
if (success) {
loadHighscore(vars);
} else {
trace("Error reading the php page");
}
};
vars.sendAndLoad(_local1, vars, "POST");
}
function saveHighscore(name, time) {
var _local1 = "connection.php";
var vars = new LoadVars();
vars.command = "saveHighscore";
vars.name = name;
vars.time = time;
vars.onLoad = function (success) {
if (success) {
loadHighscore(vars);
} else {
trace("Error reading the php page");
}
};
vars.sendAndLoad(_local1, vars, "POST");
}
function loadHighscore(vars) {
bg.createEmptyMovieClip("container", 1);
bg.container._x = 400;
bg.container._y = 215;
timelines = new Array();
var _local1 = 0;
while (_local1 < vars.num) {
var _local3 = vars["msg" + _local1].split(";");
var _local2 = bg.container.attachMovie("highscore", "highscore" + _local1, _local1);
_local2.score.text = _local1 + 1;
_local2.name.text = _local3[0];
_local2.time.text = bg.timer.translateTimer(_local3[1]);
_local2._y = _local1 * 10;
if (_local1 == 9) {
worstscore = _local3[1];
}
_local1++;
}
}
function adjustDepth(car) {
car.swapDepths(car._x + (((car._y + 80) * 6) * 32));
}
stop();
bg.stop();
bg.but_competition.onRelease = startCompetition;
bg.but_training.onRelease = startTraining;
var worstscore = 10000000000;
Symbol 3 MovieClip [car2] Frame 1
#initclip 25
Object.registerClass("car2", Car2);
#endinitclip
Symbol 6 MovieClip [truck22] Frame 1
#initclip 11
Object.registerClass("truck22", ChildCar);
#endinitclip
Symbol 9 MovieClip [truck21] Frame 1
#initclip 12
Object.registerClass("truck21", ChildCar);
#endinitclip
Symbol 12 MovieClip [truck12] Frame 1
#initclip 13
Object.registerClass("truck12", ChildCar);
#endinitclip
Symbol 14 MovieClip [truck11] Frame 1
#initclip 14
Object.registerClass("truck11", ChildCar);
#endinitclip
Symbol 17 MovieClip [playercar1] Frame 1
#initclip 15
Object.registerClass("playercar1", ChildCar);
#endinitclip
Symbol 20 MovieClip [car21] Frame 1
#initclip 16
Object.registerClass("car21", ChildCar);
#endinitclip
Symbol 22 MovieClip [car11] Frame 1
#initclip 17
Object.registerClass("car11", ChildCar);
#endinitclip
Symbol 24 MovieClip [car1] Frame 1
#initclip 18
Object.registerClass("car1", Car1);
#endinitclip
Symbol 25 MovieClip [Vehicle] Frame 1
#initclip 19
Object.registerClass("Vehicle", Vehicle);
#endinitclip
Symbol 28 MovieClip [playercar] Frame 1
#initclip 20
Object.registerClass("playercar", PlayerCar);
#endinitclip
Symbol 30 MovieClip [truck2] Frame 1
#initclip 21
Object.registerClass("truck2", Truck2);
#endinitclip
Symbol 32 MovieClip [truck1] Frame 1
#initclip 22
Object.registerClass("truck1", Truck1);
#endinitclip
Symbol 42 MovieClip [menupoint4] Frame 1
stop();
Symbol 46 MovieClip [menupoint3] Frame 1
stop();
Symbol 50 MovieClip [menupoint2] Frame 1
stop();
Symbol 54 MovieClip [menupoint1] Frame 1
stop();
Symbol 66 MovieClip [numbers] Frame 1
stop();
Symbol 84 MovieClip [board] Frame 1
#initclip 23
Object.registerClass("board", Board);
#endinitclip
Symbol 86 MovieClip [timer] Frame 1
#initclip 24
Object.registerClass("timer", Timer);
#endinitclip
Symbol 97 MovieClip Frame 1
stop();
Symbol 99 MovieClip Frame 1
stop();
Symbol 104 MovieClip Frame 1
stop();
Symbol 106 MovieClip [__Packages.Level] Frame 0
class Level
{
function Level () {
}
function getLevel(num) {
var _local2 = this["level" + num].slice(1);
return(_local2);
}
function getNumberofLevels() {
return(l);
}
function getDifficultyLevels(num) {
var _local3 = new Array();
var _local2 = 1;
while (_local2 <= l) {
if (this["level" + _local2][0] == num) {
_local3.push(_local2);
}
_local2++;
}
return(_local3);
}
function getCompetitionLevel() {
var _local2 = random(c);
return(this["level0" + _local2]);
}
var l = 18;
var c = 5;
var level1 = [1, ["truck2", 0, 5], ["car1", 4, 4], ["car2", 1, 4], ["playercar", 2, 1]];
var level2 = [1, ["truck2", 0, 5], ["car1", 4, 4], ["truck2", 1, 3], ["truck1", 5, 2], ["playercar", 2, 1], ["car1", 0, 0], ["truck2", 1, 0], ["car2", 4, 0]];
var level3 = [1, ["truck1", 0, 3], ["truck2", 1, 5], ["car2", 2, 4], ["car2", 1, 3], ["car1", 4, 4], ["car1", 5, 3], ["car2", 0, 0], ["playercar", 2, 0], ["truck1", 3, 0], ["car2", 4, 2], ["car1", 5, 0]];
var level4 = [1, ["truck2", 0, 3], ["truck1", 3, 3], ["car2", 4, 5], ["truck1", 5, 2], ["playercar", 2, 1], ["car2", 3, 2], ["truck2", 0, 0]];
var level5 = [1, ["car2", 0, 5], ["car2", 2, 5], ["truck2", 1, 4], ["car1", 4, 4], ["car1", 5, 4], ["truck2", 0, 3], ["playercar", 2, 1], ["truck1", 3, 1], ["car1", 0, 0], ["truck2", 1, 0], ["car2", 4, 0]];
var level6 = [1, ["truck2", 1, 5], ["truck2", 1, 4], ["car2", 0, 3], ["truck2", 2, 3], ["truck1", 5, 3], ["car1", 0, 0], ["car1", 1, 0], ["playercar", 2, 1], ["car2", 3, 2], ["car1", 3, 0], ["car2", 4, 0]];
var level7 = [2, ["truck2", 0, 3], ["truck1", 3, 3], ["car2", 4, 5], ["car1", 0, 1], ["playercar", 2, 1], ["car2", 3, 2], ["truck1", 5, 2], ["truck2", 0, 0]];
var level8 = [2, ["truck2", 0, 5], ["truck1", 3, 3], ["car2", 4, 4], ["car1", 0, 1], ["truck2", 1, 2], ["truck1", 5, 0], ["car2", 0, 0], ["playercar", 2, 0]];
var level9 = [2, ["truck2", 1, 5], ["car2", 0, 4], ["car1", 4, 4], ["car1", 5, 4], ["car1", 0, 2], ["playercar", 2, 3], ["car1", 3, 3], ["car2", 4, 3], ["car2", 1, 2], ["car1", 5, 1], ["car1", 0, 0], ["car2", 2, 1], ["truck2", 3, 0]];
var level10 = [2, ["car1", 1, 4], ["car2", 2, 5], ["car2", 2, 4], ["car1", 4, 4], ["car2", 0, 2], ["playercar", 2, 2], ["car1", 3, 2], ["car2", 4, 2], ["car1", 0, 0], ["car2", 2, 1], ["car2", 2, 0], ["car1", 5, 0]];
var level11 = [2, ["truck2", 1, 5], ["truck2", 1, 4], ["car1", 4, 4], ["car1", 0, 3], ["car1", 1, 2], ["playercar", 2, 2], ["car2", 3, 3], ["car2", 3, 2], ["car1", 5, 3], ["car1", 0, 1], ["car1", 1, 0], ["truck2", 2, 1], ["truck2", 2, 0], ["car1", 5, 1]];
var level12 = [3, ["truck2", 0, 3], ["truck1", 5, 3], ["car2", 0, 2], ["playercar", 2, 1], ["truck1", 3, 1], ["car1", 0, 0], ["truck2", 1, 0]];
var level13 = [3, ["truck1", 0, 3], ["car1", 1, 4], ["car1", 3, 4], ["car2", 4, 5], ["truck2", 1, 3], ["car1", 4, 2], ["truck1", 5, 1], ["car2", 0, 2], ["playercar", 2, 1], ["car2", 3, 1], ["car2", 1, 0], ["car2", 4, 0]];
var level14 = [3, ["truck2", 0, 5], ["car1", 3, 4], ["car1", 4, 4], ["truck1", 0, 2], ["car1", 1, 3], ["playercar", 2, 3], ["car2", 3, 3], ["truck1", 5, 2], ["car2", 1, 2], ["car2", 3, 2]];
var level15 = [3, ["car1", 0, 3], ["car2", 2, 4], ["car2", 4, 4], ["car2", 0, 2], ["playercar", 2, 2], ["car2", 1, 1], ["car1", 3, 1], ["car2", 2, 0], ["truck1", 4, 0], ["car1", 5, 0]];
var level16 = [4, ["truck1", 0, 3], ["car1", 1, 4], ["truck2", 2, 5], ["truck1", 5, 3], ["car2", 1, 3], ["car1", 3, 3], ["playercar", 2, 1], ["truck2", 3, 2], ["car1", 0, 0], ["car2", 2, 0], ["car1", 4, 0]];
var level17 = [4, ["car1", 0, 4], ["truck2", 3, 5], ["car2", 0, 3], ["car1", 3, 3], ["car2", 4, 3], ["truck2", 0, 2], ["car1", 3, 1], ["car1", 0, 0], ["playercar", 2, 0], ["car2", 3, 0], ["car1", 5, 0]];
var level18 = [4, ["car1", 0, 4], ["truck2", 3, 5], ["car1", 3, 3], ["car2", 4, 4], ["car2", 4, 3], ["truck2", 0, 2], ["car2", 0, 1], ["playercar", 2, 0], ["car1", 3, 1], ["car1", 4, 1], ["car2", 3, 0], ["truck1", 5, 0]];
var level00 = [["car1", 0, 4], ["car1", 0, 2], ["truck2", 1, 5], ["car1", 4, 4], ["car1", 1, 3], ["car2", 3, 3], ["car2", 0, 1], ["car2", 1, 2], ["playercar", 2, 0], ["car1", 3, 1], ["truck1", 5, 1], ["truck2", 3, 0]];
var level01 = [["car1", 0, 4], ["truck2", 1, 5], ["car2", 1, 4], ["truck2", 0, 2], ["truck1", 3, 2], ["car1", 4, 4], ["car2", 4, 3], ["car2", 0, 0], ["playercar", 2, 0], ["car2", 3, 1], ["car1", 5, 1], ["car2", 4, 0]];
var level02 = [["car2", 0, 5], ["car2", 0, 4], ["car2", 0, 3], ["car2", 2, 3], ["car1", 3, 4], ["car1", 4, 3], ["car2", 4, 5], ["truck1", 0, 0], ["car1", 1, 0], ["playercar", 2, 0], ["car1", 3, 1], ["car2", 3, 0], ["car2", 4, 2], ["car1", 5, 0]];
var level03 = [["car1", 0, 3], ["car2", 1, 3], ["car2", 3, 3], ["car1", 3, 4], ["car2", 4, 5], ["car1", 0, 1], ["truck2", 1, 2], ["playercar", 2, 0], ["car1", 3, 0], ["car1", 4, 1], ["car2", 4, 0], ["truck1", 5, 1]];
var level04 = [["truck2", 0, 5], ["truck1", 0, 2], ["playercar", 2, 3], ["car2", 1, 2], ["car1", 4, 4], ["car2", 3, 3], ["car2", 3, 2], ["car1", 3, 0], ["truck1", 5, 2], ["car2", 4, 1], ["car2", 4, 0]];
}
Symbol 107 MovieClip [__Packages.ChildCar] Frame 0
class ChildCar extends MovieClip
{
var theparent;
function ChildCar () {
super();
}
function onPress() {
theparent.onPress();
}
function onRelease() {
theparent.onRelease();
}
function onReleaseOutside() {
theparent.onRelease();
}
function onLoad() {
_root.adjustDepth(this);
}
}
Symbol 108 MovieClip [__Packages.Vehicle] Frame 0
class Vehicle extends MovieClip
{
var onEnterFrame, _x, ypos, xpos, spacing, _y, _parent, size, getDepth, cartype;
function Vehicle () {
super();
}
function onRelease() {
delete onEnterFrame;
_x = spacing * (xpos + ypos);
_y = (spacing / 2) * (xpos - ypos);
_root.adjustDepth(this);
_parent.updateBoard();
}
function onReleaseOutside() {
onRelease();
}
function onLoad() {
var _local10;
var _local5;
var _local4;
if (size[0] > size[1]) {
_local10 = size[0];
} else {
_local10 = size[1];
}
var _local2 = 1;
while (_local2 <= _local10) {
if (size[0] > size[1]) {
_local5 = spacing * ((xpos + _local2) + ypos);
_local4 = (spacing / 2) * ((xpos + _local2) - ypos);
} else {
_local5 = spacing * ((xpos + ypos) + _local2);
_local4 = (spacing / 2) * ((xpos - ypos) - _local2);
}
var _local3 = getDepth().toString() + _local2.toString();
var _local6 = cartype + _local2;
this["child" + _local2] = _parent.attachMovie(_local6, "car" + _local3, parseInt(_local3), {_x:_local5, _y:_local4, theparent:this});
_local2++;
}
}
function getPossibleX(a) {
return(spacing * (a[0] + a[1]));
}
}
Symbol 109 MovieClip [__Packages.Car1] Frame 0
class Car1 extends Vehicle
{
var _parent, getPossibleX, spacing, _xmouse, onEnterFrame, ypos, xpos;
function Car1 () {
super();
}
function onPress() {
var _local3 = _parent.possibleMoves(this);
if ((cartype == "playercar") && (_local3[1][1] == 5)) {
_local3[1][1] = 6;
}
var min_x = getPossibleX(_local3[0]);
var max_x = (getPossibleX(_local3[1]) - (spacing * size[1]));
var mousehelper = _xmouse;
onEnterFrame = function () {
var _local2;
if (((this._parent._xmouse - mousehelper) >= min_x) && ((this._parent._xmouse - mousehelper) <= max_x)) {
_local2 = (this._parent._xmouse - this._x) - mousehelper;
} else if ((this._parent._xmouse - mousehelper) < min_x) {
_local2 = min_x - this._x;
} else if ((this._parent._xmouse - mousehelper) > max_x) {
_local2 = max_x - this._x;
}
var _local3 = _local2 / 2;
var _local4 = Math.round((((this._x + _local2) / this.spacing) - ((2 * (this._y + _local3)) / this.spacing)) / 2);
this._x = this._x + _local2;
this._y = this._y - _local3;
this.moveChildren(_local2, _local3);
this.adjustDepth();
this.ypos = _local4;
};
}
function adjustDepth() {
_root.adjustDepth(this);
var _local3 = 1;
while (_local3 <= size[0]) {
_root.adjustDepth(this["child" + _local3]);
_local3++;
}
}
function moveChildren(xmove, ymove) {
var _local3 = 1;
while (_local3 <= size[1]) {
this["child" + _local3]._x = this["child" + _local3]._x + xmove;
this["child" + _local3]._y = this["child" + _local3]._y - ymove;
_root.adjustDepth(this["child" + _local3]);
_local3++;
}
}
function onRelease() {
super.onRelease();
var _local4 = 1;
while (_local4 <= size[1]) {
this["child" + _local4]._x = spacing * ((xpos + ypos) + _local4);
this["child" + _local4]._y = (spacing / 2) * ((xpos - ypos) - _local4);
_root.adjustDepth(this["child" + _local4]);
_local4++;
}
}
function onUnload() {
var _local2 = 1;
while (_local2 <= size[1]) {
this["child" + _local2].swapDepths(100000);
this["child" + _local2].removeMovieClip();
_local2++;
}
}
var cartype = "car1";
var size = [0, 1];
}
Symbol 110 MovieClip [__Packages.PlayerCar] Frame 0
class PlayerCar extends Car1
{
var ypos, _parent;
function PlayerCar () {
super();
}
function onRelease() {
super.onRelease();
if (ypos == 5) {
if (_parent.mode == "training") {
_parent.endOfGame();
} else if (_parent.mode == "competition") {
_parent.endOfCompetition();
}
}
}
function onReleaseOutside() {
onRelease();
}
var cartype = "playercar";
}
Symbol 111 MovieClip [__Packages.Car2] Frame 0
class Car2 extends Vehicle
{
var _parent, getPossibleX, spacing, _xmouse, onEnterFrame, ypos, xpos;
function Car2 () {
super();
}
function onPress() {
var _local4 = _parent.possibleMoves(this);
var min_x = getPossibleX(_local4[0]);
var max_x = (getPossibleX(_local4[1]) - (spacing * size[0]));
var mousehelper = _xmouse;
onEnterFrame = function () {
var _local2;
if (((this._parent._xmouse - mousehelper) >= min_x) && ((this._parent._xmouse - mousehelper) <= max_x)) {
_local2 = (this._parent._xmouse - this._x) - mousehelper;
} else if ((this._parent._xmouse - mousehelper) < min_x) {
_local2 = min_x - this._x;
} else if ((this._parent._xmouse - mousehelper) > max_x) {
_local2 = max_x - this._x;
}
var _local3 = _local2 / 2;
var _local4 = Math.round((((this._x + _local2) / this.spacing) + ((2 * (this._y + _local3)) / this.spacing)) / 2);
this._x = this._x + _local2;
this._y = this._y + _local3;
this.moveChildren(_local2, _local3);
this.adjustDepth();
this.xpos = _local4;
};
}
function adjustDepth() {
_root.adjustDepth(this);
var _local3 = 1;
while (_local3 <= size[0]) {
_root.adjustDepth(this["child" + _local3]);
_local3++;
}
}
function moveChildren(xmove, ymove) {
var _local2 = 1;
while (_local2 <= size[0]) {
this["child" + _local2]._x = this["child" + _local2]._x + xmove;
this["child" + _local2]._y = this["child" + _local2]._y + ymove;
_local2++;
}
}
function onRelease() {
super.onRelease();
var _local4 = 1;
while (_local4 <= size[0]) {
this["child" + _local4]._x = spacing * ((xpos + _local4) + ypos);
this["child" + _local4]._y = (spacing / 2) * ((xpos + _local4) - ypos);
_root.adjustDepth(this["child" + _local4]);
_local4++;
}
}
function onUnload() {
var _local2 = 1;
while (_local2 <= size[0]) {
this["child" + _local2].swapDepths(100000);
this["child" + _local2].removeMovieClip();
_local2++;
}
}
var cartype = "car2";
var size = [1, 0];
}
Symbol 112 MovieClip [__Packages.Truck2] Frame 0
class Truck2 extends Car2
{
function Truck2 () {
super();
}
var cartype = "truck2";
var size = [2, 0];
}
Symbol 113 MovieClip [__Packages.Truck1] Frame 0
class Truck1 extends Car1
{
function Truck1 () {
super();
}
var cartype = "truck1";
var size = [0, 2];
}
Symbol 114 MovieClip [__Packages.Board] Frame 0
class Board extends MovieClip
{
var attachMovie, _parent, mode;
function Board () {
super();
attachMovie("borderfront", "borderfront", 1000000);
loadCar("playercar", 2, 1, 1);
}
function loadCar(id, xpos, ypos, d) {
var _local4 = spacing * (xpos + ypos);
var _local3 = (spacing / 2) * (xpos - ypos);
var _local5 = _local4 + (((_local3 + 80) * 6) * 32);
var _local2 = attachMovie(id, "car" + d, _local5, {_x:_local4, _y:_local3, xpos:xpos, ypos:ypos, spacing:spacing});
placeCar(_local2, xpos, ypos);
cars.push(_local2);
}
function loadCars(l) {
var _local2 = 1;
while (_local2 <= l.length) {
loadCar(l[_local2 - 1][0], l[_local2 - 1][1], l[_local2 - 1][2], _local2);
_local2++;
}
}
function unloadCars() {
var _local2 = 0;
while (_local2 < cars.length) {
cars[_local2].swapDepths(100000);
cars[_local2].removeMovieClip();
_local2++;
}
cars = new Array();
}
function placeCar(car, xpos, ypos) {
board[xpos][ypos] = 1;
var _local2 = 1;
while (_local2 <= car.size[0]) {
board[xpos + _local2][ypos] = 1;
_local2++;
}
_local2 = 1;
while (_local2 <= car.size[1]) {
board[xpos][ypos + _local2] = 1;
_local2++;
}
}
function updateBoard() {
loadBoard();
var _local2 = 0;
while (_local2 < cars.length) {
placeCar(cars[_local2], cars[_local2].xpos, cars[_local2].ypos);
_local2++;
}
}
function loadBoard() {
board = new Array([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]);
}
function possibleMoves(car) {
var _local4;
var _local6;
var _local3;
var _local5;
if (car.size[0] > 0) {
_local4 = car.xpos;
_local6 = _local4 + car.size[0];
_local3 = car.ypos;
_local5 = _local3;
var _local2 = _local4 - 1;
while (_local2 >= 0) {
if (board[_local2][_local3] == 0) {
_local4 = _local2;
} else {
break;
}
_local2--;
}
_local2 = _local6 + 1;
while (_local2 <= 5) {
if (board[_local2][_local3] == 0) {
_local6 = _local2;
} else {
break;
}
_local2++;
}
} else if (car.size[1] > 0) {
_local4 = car.xpos;
_local6 = _local4;
_local3 = car.ypos;
_local5 = _local3 + car.size[1];
var _local2 = _local3 - 1;
while (_local2 >= 0) {
if (board[_local4][_local2] == 0) {
_local3 = _local2;
} else {
break;
}
_local2--;
}
_local2 = _local5 + 1;
while (_local2 <= 5) {
if (board[_local4][_local2] == 0) {
_local5 = _local2;
} else {
break;
}
_local2++;
}
}
return([[_local4, _local3], [_local6, _local5]]);
}
function loadLevel(num) {
unloadCars();
loadBoard();
level = num;
var _local2 = new Level().getLevel(level);
loadCars(_local2);
var path = this;
_parent.bg.but_next.gotoAndStop(2);
_parent.bg.but_next._visible = true;
_parent.bg.but_reset.gotoAndStop(1);
_parent.bg.but_reset.onRelease = function () {
path.loadLevel(path.level);
};
delete _parent.bg.but_start.onRelease;
}
function endOfGame() {
var path = this;
_parent.bg.but_next.gotoAndStop(1);
_parent.bg.but_reset.gotoAndStop(2);
delete _parent.bg.but_reset.onRelease;
_parent.bg.but_start.onRelease = function () {
this._parent.container["level" + path.level].gotoAndStop(1);
path.level++;
this._parent.container["level" + path.level].gotoAndStop(2);
if (path.level > new Level().getNumberofLevels()) {
path.level = 1;
}
path.loadLevel(path.level);
};
}
function loadTraining() {
mode = "training";
_parent.bg.container["level" + level].gotoAndStop(2);
loadLevel(level);
var path = this;
_parent.bg.but_back.onRelease = function () {
path.unloadCars();
path.loadCar("playercar", 2, 1, 1);
this._parent._parent.backToStart();
};
}
function endOfCompetition() {
unloadCars();
var _local2 = _parent.bg.timer.stopTimerAndGetTime();
_parent.competitionPopUp(_local2);
_parent.bg.but_next.gotoAndStop(2);
delete _parent.bg.but_reset.onRelease;
_parent.bg.but_reset.gotoAndStop(2);
delete _parent.bg.but_start.onRelease;
delete _parent.bg.but_back.onRelease;
}
function loadCompetitionLevel(newlevel) {
unloadCars();
loadBoard();
loadCars(newlevel);
var path = this;
_parent.bg.but_next.gotoAndStop(1);
_parent.bg.but_reset.gotoAndStop(1);
_parent.bg.but_reset.onRelease = function () {
path.loadCompetitionLevel(newlevel);
};
}
function loadCompetition() {
mode = "competition";
var _local2 = new Level().getCompetitionLevel();
loadCompetitionLevel(_local2);
_parent.bg.timer.startTimer();
var path = this;
_parent.bg.but_back.onRelease = function () {
path.unloadCars();
path.loadCar("playercar", 2, 1, 1);
this._parent._parent.backToStart();
};
_parent.bg.but_start.onRelease = function () {
path.loadCompetitionLevel(new Level().getCompetitionLevel());
this._parent.timer.startTimer();
};
}
var spacing = 32;
var cars = new Array();
var board = new Array();
var level = 1;
}
Symbol 115 MovieClip [__Packages.Timer] Frame 0
class Timer extends MovieClip
{
var starttime, onEnterFrame, h1, attachMovie, h2, m1, m2, s1, s2;
function Timer () {
super();
}
function showTime(letter, value) {
var _local3;
var _local2;
if (value < 10) {
_local3 = 0;
_local2 = value;
} else {
_local3 = parseInt(value.toString().charAt(0));
_local2 = parseInt(value.toString().charAt(1));
}
if (_local3 == 0) {
_local3 = 10;
}
if (_local2 == 0) {
_local2 = 10;
}
this[letter + 1].gotoAndStop(_local3);
this[letter + 2].gotoAndStop(_local2);
}
function startTimer() {
starttime = getTimer();
onEnterFrame = function () {
var _local5 = getTimer() - this.starttime;
var _local3 = Math.floor(_local5 / 3600000);
var _local2 = _local5 - (_local3 * 3600000);
var _local6 = Math.floor(_local2 / 60000);
_local2 = _local2 - (_local6 * 60000);
var _local4 = Math.floor(_local2 / 1000);
_local2 = _local2 - (_local4 * 1000);
this.showTime("h", _local3);
this.showTime("m", _local6);
this.showTime("s", _local4);
};
}
function stopTimerAndGetTime() {
delete onEnterFrame;
return(getTimer() - starttime);
}
function translateTimer(num) {
var _local6;
var _local7;
var _local5;
var _local2 = Math.floor(num / 3600000);
var _local1 = num - (_local2 * 3600000);
var _local4 = Math.floor(_local1 / 60000);
_local1 = _local1 - (_local4 * 60000);
var _local3 = Math.floor(_local1 / 1000);
_local1 = _local1 - (_local3 * 1000);
if (_local2 < 10) {
_local6 = "0" + _local2.toString();
} else {
_local6 = _local2.toString();
}
if (_local4 < 10) {
_local7 = "0" + _local4.toString();
} else {
_local7 = _local4.toString();
}
if (_local3 < 10) {
_local5 = "0" + _local3.toString();
} else {
_local5 = _local3.toString();
}
return((((_local6 + ":") + _local7) + ":") + _local5);
}
function onLoad() {
h1 = attachMovie("numbers", "h1", 1, {_x:0, _y:-16});
h2 = attachMovie("numbers", "h2", 2, {_x:12, _y:-22});
m1 = attachMovie("numbers", "m1", 3, {_x:34, _y:-33});
m2 = attachMovie("numbers", "m2", 4, {_x:46, _y:-39});
s1 = attachMovie("numbers", "s1", 5, {_x:68, _y:-50});
s2 = attachMovie("numbers", "s2", 6, {_x:80, _y:-56});
showTime("h", 0);
showTime("m", 0);
showTime("s", 0);
}
}