Frame 1
Loading = getBytesLoaded();
Total = getBytesTotal();
_root.loaded = Math.round(loading / 1000);
_root.totalk = Math.round(Total / 1000);
if (loading >= Total) {
gotoAndStop (3);
}
Frame 2
gotoAndPlay (1);
Frame 3
stop();
Frame 4
stop();
mbenneyTimer = function () {
this.reset();
};
mT = mbenneyTimer.prototype;
mT.reset = function () {
this.oldTime = 0;
this.pause = true;
this.totalTime = 0;
};
mT.stop = function () {
if (!this.pause) {
this.pause = true;
this.totalTime = this.totalTime + (getTimer() - this.oldTime);
}
};
mT.start = function () {
if (this.pause) {
this.pause = false;
this.oldTime = getTimer();
}
};
mT.getMili = function () {
var _local2 = this.totalTime;
if (!this.pause) {
_local2 = _local2 + (getTimer() - this.oldTime);
}
return(_local2);
};
mT.getSecs = function () {
var _local2 = this.totalTime / 1000;
if (!this.pause) {
_local2 = _local2 + ((getTimer() - this.oldTime) / 1000);
}
return(Math.round(_local2));
};
mT.getMins = function () {
var _local2 = this.totalTime / 1000;
if (!this.pause) {
_local2 = _local2 + (((getTimer() - this.oldTime) / 1000) / 60);
}
return(Math.round(_local2));
};
mT.getCount = function (secs) {
var _local2 = this.totalTime;
if (!this.pause) {
_local2 = _local2 + ((getTimer() - this.oldTime) / 1000);
}
var _local3 = secs - _local2;
return(Math.round(_local3));
};
Instance of Symbol 48 MovieClip "car" in Frame 4
onClipEvent (load) {
track_x = 100;
track_y = -818;
this._x = 250;
this._y = 150;
angle = 1.5609317684435;
_rotation = ((angle * 180) / Math.PI);
_root.track._x = track_x;
_root.track._y = track_y;
_root.lap1 = "";
_root.lap2 = "";
_root.lap3 = "";
_root.timer = "";
}
Frame 5
var sound = new Sound();
sound.attachSound("america");
sound.start(0, 0);
sound.onSoundComplete = function () {
sound.start(0, 0);
};
stop();
Instance of Symbol 48 MovieClip "car" in Frame 5
onClipEvent (load) {
function getPos(clip) {
var _local1 = {x:0, y:0};
clip.localToGlobal(_local1);
return(_local1);
}
function two(x) {
return(((x > 9) ? "" : "0") + x);
}
function three(x) {
return((((x > 99) ? "" : "0") + ((x > 9) ? "" : "0")) + x);
}
function displaytime(ms) {
var _local2 = Math.floor(ms / 1000);
ms = ms % 1000;
var _local1 = three(ms);
var _local3 = Math.floor(_local2 / 60);
_local2 = _local2 % 60;
_local1 = (two(_local2) + ":") + _local1;
var _local5 = Math.floor(_local3 / 60);
_local3 = _local3 % 60;
_local1 = (two(_local3) + ":") + _local1;
return(_local1);
}
function skid(handbrakey) {
}
function setLastpos() {
var _local2 = 0;
while (_local2 < this.displaywheels) {
this.wheelsPos[_local2] = getPos(this["w" + _local2]);
lastpos[_local2].x = this.wheelsPos[_local2].x - track_x;
lastpos[_local2].y = this.wheelsPos[_local2].y - track_y;
_local2++;
}
}
function adjust(v, threshold, maximum) {
vx = 0;
if (v <= threshold) {
vx = (v / threshold) * 1;
} else {
vx = 1;
}
return(vx);
}
accel = 0.2;
steer = 0.08;
steer_normal = 0.08;
steer_handbrake = 0.099;
steer_threshold = 4;
MINspd = -5;
MAXspd = 22;
MAXskiddisplay = 2;
MAXturnSpd = 10;
MaxTurnSkid = 18;
deccel = 0.92;
handbrake = 0.93;
handbrake_traction = 20;
drift = 0.98;
speed = 0;
surface = 3;
traction = 5;
traction_max = 1;
vector = [0, 0];
bounceback = 0.6;
laptimes = new Array();
laps = 3;
var i = 1;
while (i <= laps) {
laptimes[i] = 0;
i++;
}
checkpoints = new Array();
checks = 4;
var i = 0;
while (i <= checks) {
checkpoints[i] = false;
i++;
}
lap = 0;
collide = false;
track_x = 100;
track_y = -818;
this._x = 250;
this._y = 150;
angle = 1.5609317684435;
_rotation = ((angle * 180) / Math.PI);
myTimer = new _root.mbenneyTimer();
displaywheels = 2;
wheelsPos = new Array();
lastPos = new Array();
var i = 0;
while (i < displaywheels) {
wheelsPos[i] = getPos(this["w" + i]);
lastPos[i] = wheelspos[i];
i++;
}
skidding = false;
turnskidding = false;
skids = 1;
myTimer.start();
}
onClipEvent (enterFrame) {
_rotation = ((angle * 180) / Math.PI);
_root.track._x = track_x;
_root.track._y = track_y;
UD = Key.isDown(38) - Key.isDown(40);
LR = Key.isDown(39) - Key.isDown(37);
HAND = Key.isDown(32);
if (LR) {
angle = angle + ((LR * steer) * adjust(Math.abs(speed), steer_threshold, MAXSpd));
if (speed > maxturnskid) {
if (!turnskidding) {
setLastpos();
}
turnskidding = skid(HAND);
} else {
turnskidding = false;
}
} else {
turnskidding = false;
}
if (!UD) {
speed = speed * drift;
} else if (UD & (!HAND)) {
speed = Math.min(Math.max(speed + (UD * accel), MINspd), MAXspd);
}
if (Math.abs(speed) < (accel / 2)) {
speed = 0;
}
if (HAND) {
speed = speed * handbrake;
if (speed > MAXskiddisplay) {
steer = steer_handbrake;
if (!skidding) {
setLastpos();
}
skidding = skid(HAND);
}
traction = handbrake_traction / surface;
} else {
skidding = false;
traction = Math.max(traction_max, Math.abs((speed - MAXturnSpd) / surface));
steer = steer_normal;
}
if (speed < 0) {
traction = 1;
}
if (!_root.track.track.hitTest(this._x, this._y, true)) {
speed = speed * 0.95;
traction = traction * 1.1;
}
var frontpos = new Array();
var i = 0;
while (i < this.displaywheels) {
this.frontpos[i] = getPos(this["f" + i]);
i++;
}
if (_root.track.crunchers.hitTest(frontpos[0].x, frontpos[0].y, true) & (!collide)) {
speed = (speed * bounceback) * -1;
vector[0] = -vector[0];
vector[1] = -vector[1];
collide = true;
} else if (_root.track.crunchers.hitTest(frontpos[1].x, frontpos[1].y, true) & (!collide)) {
speed = (-speed) * bounceback;
vector[0] = -vector[0];
vector[1] = -vector[1];
collide = true;
} else {
collide = false;
}
track_x = track_x + ((vector[0] = vector[0] + (((Math.cos(angle) * speed) - vector[0]) / traction)));
track_y = track_y + ((vector[1] = vector[1] + (((Math.sin(angle) * speed) - vector[1]) / traction)));
_root.timer = displaytime(myTimer.getMili());
if (_root.track.check1.hitTest(this._x, this._y, true)) {
checkpoints[1] = true;
}
if (_root.track.check2.hitTest(this._x, this._y, true)) {
checkpoints[2] = true;
}
if (_root.track.check3.hitTest(this._x, this._y, true)) {
checkpoints[3] = true;
}
if (_root.track.check4.hitTest(this._x, this._y, true)) {
checkpoints[4] = true;
}
if (_root.track.check0.hitTest(this._x, this._y, true)) {
if (((checkpoints[1] & checkpoints[2]) & checkpoints[3]) & checkpoints[4]) {
lap++;
if (lap == 1) {
laptimes[1] = myTimer.getMili();
_root.lap1 = displaytime(laptimes[1]);
} else if (lap == 2) {
laptimes[2] = myTimer.getMili() - laptimes[1];
_root.lap2 = displaytime(laptimes[2]);
} else if (lap == 3) {
laptimes[3] = (myTimer.getMili() - laptimes[2]) - laptimes[1];
_root.lap3 = displaytime(laptimes[3]);
}
var i = 0;
while (i <= checks) {
checkpoints[i] = false;
i++;
}
if (lap >= laps) {
mytimer.stop();
_root.racetimer = myTimer.getMili();
_root.bestlaptime = Math.min(laptimes[1], Math.min(laptimes[2], laptimes[3]));
_root.gotoAndStop(6);
}
}
}
}
Frame 6
var sound1 = new Sound();
sound1.attachSound("brettygood");
sound1.start(0, 0);
function two(x) {
return(((x > 9) ? "" : "0") + x);
}
function three(x) {
return((((x > 99) ? "" : "0") + ((x > 9) ? "" : "0")) + x);
}
function displaytime(ms) {
var _local2 = Math.floor(ms / 1000);
ms = ms % 1000;
var _local1 = three(ms);
var _local3 = Math.floor(_local2 / 60);
_local2 = _local2 % 60;
_local1 = (two(_local2) + ":") + _local1;
var _local5 = Math.floor(_local3 / 60);
_local3 = _local3 % 60;
_local1 = (two(_local3) + ":") + _local1;
return(_local1);
}
_root.totalrace = displaytime(_root.racetimer);
_root.bestlap = displaytime(_root.bestlaptime);
stop();
Symbol 3 MovieClip [skidmark] Frame 71
this.removemovieclip();
Symbol 26 Button
on (release) {
gotoAndPlay (4);
}
Symbol 37 MovieClip Frame 1
stop();
Symbol 39 MovieClip Frame 1
stop();
Symbol 41 MovieClip Frame 1
stop();
Symbol 43 MovieClip Frame 1
stop();
Symbol 44 MovieClip Frame 1
this.track._visible = false;
this.crunchers._visible = false;
this.check0._visible = false;
this.check1._visible = false;
this.check2._visible = false;
this.check3._visible = false;
this.check4._visible = false;
stop();
Instance of Symbol 37 MovieClip in Symbol 44 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_root.car.hitTest(this)) {
this.gotoAndPlay(2);
}
}
Instance of Symbol 39 MovieClip in Symbol 44 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_root.car.hitTest(this)) {
this.gotoAndPlay(2);
}
}
Instance of Symbol 41 MovieClip in Symbol 44 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_root.car.hitTest(this)) {
this.gotoAndPlay(2);
}
}
Instance of Symbol 43 MovieClip in Symbol 44 MovieClip Frame 1
onClipEvent (enterFrame) {
if (_root.car.hitTest(this)) {
this.gotoAndPlay(2);
}
}
Symbol 48 MovieClip Frame 1
fscommand ("allowscale", "false");
Symbol 65 MovieClip Frame 101
_root.gotoAndPlay(5);
this.removeMovieClip();
Symbol 70 Button
on (release) {
gotoAndStop (4);
}