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
stopAllSounds();
stop();
Frame 4
stop();
mbenneyTimer = function () {
this.reset();
};
mT = mbenneyTimer.prototype;
mT.reset = function () {
var _local1 = this;
_local1.oldTime = 0;
_local1.pause = true;
_local1.totalTime = 0;
};
mT.stop = function () {
var _local1 = this;
if (!_local1.pause) {
_local1.pause = true;
_local1.totalTime = _local1.totalTime + (getTimer() - _local1.oldTime);
}
};
mT.start = function () {
var _local1 = this;
if (_local1.pause) {
_local1.pause = false;
_local1.oldTime = getTimer();
}
};
mT.getMili = function () {
var _local2 = this;
var _local1 = _local2.totalTime;
if (!_local2.pause) {
_local1 = _local1 + (getTimer() - _local2.oldTime);
}
return(_local1);
};
mT.getSecs = function () {
var _local2 = this;
var _local1 = _local2.totalTime / 1000;
if (!_local2.pause) {
_local1 = _local1 + ((getTimer() - _local2.oldTime) / 1000);
}
return(Math.round(_local1));
};
mT.getMins = function () {
var _local2 = this;
var _local1 = _local2.totalTime / 1000;
if (!_local2.pause) {
_local1 = _local1 + (((getTimer() - _local2.oldTime) / 1000) / 60);
}
return(Math.round(_local1));
};
mT.getCount = function (secs) {
var _local2 = this;
var _local1 = _local2.totalTime;
if (!_local2.pause) {
_local1 = _local1 + ((getTimer() - _local2.oldTime) / 1000);
}
var _local3 = secs - _local1;
return(Math.round(_local3));
};
Instance of Symbol 43 MovieClip "car" in Frame 4
onClipEvent (load) {
track_x = 100;
track_y = -818;
this._x = Stage.Width / 2;
this._y = Stage.Height / 2;
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
stop();
Instance of Symbol 43 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) {
var _local1 = x;
return((((_local1 > 99) ? "" : "0") + ((_local1 > 9) ? "" : "0")) + _local1);
}
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 hr = Math.floor(_local3 / 60);
_local3 = _local3 % 60;
_local1 = (two(_local3) + ":") + _local1;
return(_local1);
}
function skid(Handbrakey) {
var _local2 = this;
var _local3 = _root.track.attachMovie("skidmark", "skidleft" + skids, skids);
var _local1 = 0;
while (_local1 < _local2.displaywheels) {
wheelsPos[_local1] = getPos(_local2["w" + _local1]);
if (handbrakey) {
_local3.lineStyle(4, 0, 70);
_local3.moveto(_local2.wheelsPos[_local1].x - track_x, _local2.wheelsPos[_local1].y - track_y);
_local3.lineTo(_local2.lastpos[_local1].x, _local2.lastpos[_local1].y);
} else {
_local3.lineStyle(3, 0, 50);
_local3.moveto(_local2.wheelsPos[_local1].x - track_x, _local2.wheelsPos[_local1].y - track_y);
_local3.lineTo(_local2.lastpos[_local1].x, _local2.lastpos[_local1].y);
}
lastpos[_local1].x = _local2.wheelsPos[_local1].x - track_x;
lastpos[_local1].y = _local2.wheelsPos[_local1].y - track_y;
skids++;
_local1++;
}
return(true);
}
function setLastpos() {
var _local2 = this;
var _local1 = 0;
while (_local1 < _local2.displaywheels) {
_local2.wheelsPos[_local1] = getPos(_local2["w" + _local1]);
lastpos[_local1].x = _local2.wheelsPos[_local1].x - track_x;
lastpos[_local1].y = _local2.wheelsPos[_local1].y - track_y;
_local1++;
}
}
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 = Stage.Width / 2;
this._y = Stage.Height / 2;
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;
}
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;
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());
_root.speedHand._rotation = Math.max(-11, Math.Abs(speed * 8.5));
if (_root.track.check1.hittest(_x, _y, true)) {
checkpoints[1] = true;
}
if (_root.track.check2.hittest(_x, _y, true)) {
checkpoints[2] = true;
}
if (_root.track.check3.hittest(_x, _y, true)) {
checkpoints[3] = true;
}
if (_root.track.check4.hittest(_x, _y, true)) {
checkpoints[4] = true;
}
if (_root.track.check0.hittest(_x, _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
function two(x) {
return(((x > 9) ? "" : "0") + x);
}
function three(x) {
var _local1 = x;
return((((_local1 > 99) ? "" : "0") + ((_local1 > 9) ? "" : "0")) + _local1);
}
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 hr = 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 10 Button
on (release) {
getURL ("http://www.freewebs.com/chindamo", "_blank");
}
Symbol 27 Button
on (release) {
this.gotoAndPlay("4");
}
Symbol 33 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();
Symbol 43 MovieClip Frame 1
fscommand ("allowscale", "false");
Symbol 60 MovieClip Frame 75
_root.gotoandplay(5);
this.movieclipremove();
Symbol 66 Button
on (release) {
gotoAndStop (4);
stopAllSounds();
}