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();
_root.dnf._visible = false;
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 70 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 70 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) {
var _local4 = _root.track.attachMovie("skidmark", "skidleft" + skids, skids);
var _local3 = 0;
while (_local3 < this.displaywheels) {
wheelsPos[_local3] = getPos(this["w" + _local3]);
if (Handbrakey) {
_local4.lineStyle(4, 8669479, 70);
_local4.moveto(this.wheelsPos[_local3].x - track_x, this.wheelsPos[_local3].y - track_y);
_local4.lineTo(this.lastpos[_local3].x, this.lastpos[_local3].y);
} else {
_local4.lineStyle(3, 8669479, 50);
_local4.moveto(this.wheelsPos[_local3].x - track_x, this.wheelsPos[_local3].y - track_y);
_local4.lineTo(this.lastpos[_local3].x, this.lastpos[_local3].y);
}
lastpos[_local3].x = this.wheelsPos[_local3].x - track_x;
lastpos[_local3].y = this.wheelsPos[_local3].y - track_y;
skids++;
_local3++;
}
return(true);
}
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.12;
steer_threshold = 4;
MINspd = -8;
MAXspd = 18;
MAXskiddisplay = 2;
MAXturnSpd = 8;
MaxTurnSkid = 8;
deccel = 0.85;
handbrake = 0.93;
handbrake_traction = 100;
drift = 0.98;
drift_traction = 50;
speed = 0;
surface = 1;
traction = 6;
traction_max = 1;
vector = [0, 0];
bounceBack = 0.6;
laptimes = new Array();
laps = 1;
var i = 1;
while (i <= laps) {
laptimes[i] = 0;
i++;
}
checkpoints = new Array();
checks = 13;
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);
traction = drift_traction / surface;
} 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(_x, _y, true)) {
speed = speed * 0.95;
traction = traction * 1.1;
}
c = 0;
while (c <= 1) {
var cCone = _root.track["cone" + c];
if (cCone.hitTest(this.conetest)) {
_root.penalty.gotoAndPlay(5);
_root.dnf._visible = true;
cCone.angle = this.angle + (0.523598775598299 * Math.random());
cCone.speed = 50 + (Math.Random() * 5);
speed = speed * 0.9;
traction = traction * 0.5;
if (this.speed < 0) {
cCone.angle = cCone.angle + Math.PI;
}
cCone.tx = cCone._x - (Math.cos(cCone.angle) * cCone.speed);
cCone.ty = cCone._y - (Math.sin(cCone.angle) * cCone.speed);
cCone.onEnterFrame = function () {
var _local2 = getPos(this);
if (!this._parent.crunchers.hitTest(_local2.x, _local2.y, true)) {
this._x = this._x - ((this._x - this.tx) / 8);
this._y = this._y - ((this._y - this.ty) / 8);
} else {
delete this.onEnterFrame;
}
};
}
c++;
}
c = 0;
while (c <= 1) {
var cTyre = _root.track["tyre" + c];
if (cTyre.hitTest(this.conetest)) {
cTyre.angle = this.angle + (0.523598775598299 * Math.random());
cTyre.speed = 50 + (Math.Random() * 2);
speed = speed * 0.7;
traction = traction * 0.5;
if (this.speed < 0) {
cTyre.angle = cTyre.angle + Math.PI;
}
cTyre.tx = cTyre._x - (Math.cos(cTyre.angle) * cTyre.speed);
cTyre.ty = cTyre._y - (Math.sin(cTyre.angle) * cTyre.speed);
cTyre.onEnterFrame = function () {
var _local2 = getPos(this);
if (!this._parent.crunchers.hitTest(_local2.x, _local2.y, true)) {
this._x = this._x - ((this._x - this.tx) / 8);
this._y = this._y - ((this._y - this.ty) / 8);
} else {
delete this.onEnterFrame;
}
};
}
c++;
}
c = 0;
while (c <= 1) {
var cBlock = _root.track["block" + c];
if (cBlock.hitTest(this.conetest)) {
cBlock.angle = this.angle + (0.523598775598299 * Math.random());
cBlock.speed = 10 + (Math.Random() * 1);
speed = speed * 0.1;
traction = traction * 0.5;
if (this.speed < 0) {
cBlock.angle = cBlock.angle + Math.PI;
}
cBlock.tx = cBlock._x - (Math.cos(cBlock.angle) * cBlock.speed);
cBlock.ty = cBlock._y - (Math.sin(cBlock.angle) * cBlock.speed);
cBlock.onEnterFrame = function () {
var _local2 = getPos(this);
if (!this._parent.crunchers.hitTest(_local2.x, _local2.y, true)) {
this._x = this._x - ((this._x - this.tx) / 4);
this._y = this._y - ((this._y - this.ty) / 4);
} else {
delete this.onEnterFrame;
}
};
}
c++;
}
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 * 0.3;
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 * 0.3;
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.check1.hittest(_x, _y, true)) {
checkpoints[5] = true;
}
if (_root.track.check2.hittest(_x, _y, true)) {
checkpoints[6] = true;
}
if (_root.track.check3.hittest(_x, _y, true)) {
checkpoints[7] = true;
}
if (_root.track.check4.hittest(_x, _y, true)) {
checkpoints[8] = true;
}
if (_root.track.check1.hittest(_x, _y, true)) {
checkpoints[9] = true;
}
if (_root.track.check2.hittest(_x, _y, true)) {
checkpoints[10] = true;
}
if (_root.track.check3.hittest(_x, _y, true)) {
checkpoints[11] = true;
}
if (_root.track.check0.hittest(_x, _y, true)) {
if ((((((((((checkpoints[1] & checkpoints[2]) & checkpoints[3]) & checkpoints[4]) & checkpoints[5]) & checkpoints[6]) & checkpoints[7]) & checkpoints[8]) & checkpoints[9]) & checkpoints[10]) & checkpoints[11]) {
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) {
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);
}
if ((timednf = DNF)) {
_root.totalrace = "DNF";
} else {
_root.totalrace = displaytime(_root.racetimer);
}
_root.bestlap = displaytime(_root.bestlaptime);
var rank:Number = displaytime(_root.racetimer);
String.prototype.stripSign = function () {
return(this.split(":").join(""));
};
var s:Number = rank.stripSign();
if ((s <= 7680) && (s >= 4096)) {
_root.rank = "veeery gooood!";
} else if ((s <= 8192) && (s >= 7681)) {
_root.rank = "Good!";
} else if ((s <= 10752) && (s >= 8193)) {
_root.rank = "Is OK";
} else if ((s <= 12288) && (s >= 10753)) {
_root.rank = "Try harder...";
} else {
_root.rank = "almost a champion... of turtles...";
}
stop();
Symbol 1 MovieClip [skidmark] Frame 71
this.removemovieclip();
Symbol 19 Button
on (release) {
gotoAndPlay (4);
}
Symbol 54 MovieClip Frame 1
this.track._visible = false;
this.crunchers._visible = false;
this.road._visible = true;
this.check0._visible = false;
this.check1._visible = false;
this.check2._visible = false;
this.check3._visible = false;
this.check4._visible = false;
this.check5._visible = false;
this.check6._visible = false;
this.check7._visible = false;
this.check8._visible = false;
this.check9._visible = false;
this.check10._visible = false;
this.check11._visible = false;
this.check12._visible = false;
this.check13._visible = false;
stop();
Instance of Symbol 29 MovieClip "crunchers" in Symbol 54 MovieClip Frame 1
/* no clip actions */
Symbol 57 MovieClip Frame 1
stop();
timednf = "OK";
Symbol 57 MovieClip Frame 33
stop();
timednf = "DQ";
Symbol 64 Button
on (release) {
getURL ("http://www.flashrally.com");
}
Symbol 70 MovieClip Frame 1
fscommand ("allowscale", "false");
Symbol 82 Button
on (release) {
gotoAndPlay (3);
}
Symbol 87 MovieClip Frame 64
_root.gotoandplay(5);
this.movieclipremove();
Symbol 89 MovieClip Frame 1
stop();
Symbol 89 MovieClip Frame 9
gotoAndPlay (1);
Symbol 89 MovieClip Frame 19
gotoAndPlay (10);