Frame 1
function CCar(speedmax, acceleration, theclip, StartRotation, KeySpeed, KeyLeft, KeyRight, ClipCircuit) {
this.SpeedKey = KeySpeed;
this.TurnLeftKey = KeyLeft;
this.TurnRightKey = KeyRight;
this.ConvToRad = (Math.PI/180);
this.MaxSpeed = speedmax;
this.Acceleration = acceleration;
this.ClipName = theclip;
this.Rotation = 5;
this.Circuit = ClipCircuit;
this.CurrentSpeed = 0;
this.CurrentRotation = StartRotation;
this.ClipName._rotation = this.CurrentRotation;
}
var aKey = 97;
var wKey = 112;
var xKey = 120;
CCar.prototype.Move = function () {
var RadianAngle;
if (Key.isDown(this.TurnLeftKey)) {
this.CurrentRotation = this.CurrentRotation - this.Rotation;
}
if (Key.isDown(this.TurnRightKey)) {
this.CurrentRotation = this.CurrentRotation + this.Rotation;
}
if (Key.isDown(this.SpeedKey)) {
if (this.HitBounds()) {
this.CurrentSpeed = 0.5;
} else {
this.CurrentSpeed = this.CurrentSpeed + this.Acceleration;
if (this.MaxSpeed < this.CurrentSpeed) {
this.CurrentSpeed = this.MaxSpeed;
}
}
} else if (this.HitBounds()) {
this.CurrentSpeed = 0;
} else {
this.CurrentSpeed = this.CurrentSpeed - this.Acceleration;
if (this.CurrentSpeed < 0) {
this.CurrentSpeed = 0;
}
}
RadianAngle = this.CurrentRotation * this.ConvToRad;
this.ClipName._rotation = this.CurrentRotation;
this.ClipName._x = this.ClipName._x + (this.CurrentSpeed * Math.cos(RadianAngle));
this.ClipName._y = this.ClipName._y + (this.CurrentSpeed * Math.sin(RadianAngle));
};
CCar.prototype.HitBounds = function () {
return(this.Circuit.hitTest(this.ClipName._x, this.ClipName._y, true));
};
if (_framesloaded == _totalframes) {
gotoAndPlay(_currentframe + 2);
} else {
play();
}
Frame 2
function TestCheckPoint(CheckPointMovieClipArray, CarMovieClip) {
var CptArray;
var HitValue;
CptArray = 0;
HitValue = 0;
while ((CptArray < CheckPointMovieClipArray.length) && (!HitValue)) {
HitValue = CheckPointMovieClipArray[CptArray].hitTest(CarMovieClip._x, CarMovieClip._y, true);
CptArray++;
}
if (HitValue) {
CptArray--;
return(CptArray);
}
return(-1);
}
function UpDateCheckPointNumArray(RangeNum, CheckPointNumOfMovieClipArray) {
if ((!RangeNum) || (CheckPointNumOfMovieClipArray[RangeNum - 1])) {
CheckPointNumOfMovieClipArray[RangeNum] = 1;
return(1);
}
return(0);
}
function TestNewLap(CheckPointNumOfMovieClipArray) {
var Cpt;
Cpt = 0;
while ((Cpt < CheckPointNumOfMovieClipArray.length) && (CheckPointNumOfMovieClipArray[Cpt])) {
Cpt++;
}
return(Cpt >= CheckPointNumOfMovieClipArray.length);
}
function InitTab(TableOfNum, Nb) {
var Cpt;
Cpt = 0;
while (Cpt < TableOfNum.length) {
TableOfNum[Cpt] = Nb;
Cpt++;
}
}
prevFrame();
Frame 3
VarNumCircuit = "";
stop();
Frame 4
gotoAndPlay(_root.VarNumCircuit);
Frame 10
TotalLaps = 5;
CurrentLap = 1;
CheckPointClipArray = new Array(ClipInterLap1, ClipInterLap2, ClipInterLap3, ClipInterLap4, ClipNewLap);
CheckPointNumArray = new Array(0, 0, 0, 0, 0);
TheDate = new Date();
TextLaps = (("Lap " + CurrentLap) + "/") + TotalLaps;
TextTime = "Time : 0 s 00";
StartTime = TheDate.getTime();
delete TheDate;
OpponentLaps = 0;
Frame 11
myCar1 = new CCar(6, 0.08, CarN1, 0, Key.UP, Key.LEFT, Key.RIGHT, BordsCircuit);
Frame 12
TheDate = new Date();
CurrentTime = TheDate.getTime();
delete TheDate;
TotalTime = CurrentTime - StartTime;
TextTime = (("Time : " + Math.floor(TotalTime / 1000)) + " s ") + Math.floor((TotalTime - (Math.floor(TotalTime / 1000) * 1000)) / 10);
myCar1.Move();
TestVal = TestCheckPoint(CheckPointClipArray, myCar1.ClipName);
if (-1 < TestVal) {
if (UpDateCheckPointNumArray(TestVal, CheckPointNumArray)) {
TestVal = TestNewLap(CheckPointNumArray);
if (TestVal) {
CurrentLap++;
InitTab(CheckPointNumArray, 0);
if (TotalLaps >= CurrentLap) {
TextLaps = (("Lap " + CurrentLap) + "/") + TotalLaps;
} else {
gotoAndPlay(_currentframe + 2);
}
}
}
}
TextTabNum = (((((((CheckPointNumArray[0] + " ") + CheckPointNumArray[1]) + " ") + CheckPointNumArray[2]) + " ") + CheckPointNumArray[3]) + " ") + CheckPointNumArray[4];
if (TotalLaps < OpponentLaps) {
ClipOpponent.stop();
gotoAndPlay(_currentframe + 2);
}
play();
Frame 13
prevFrame();
Frame 15
stop();
Frame 16
gotoAndPlay (3);
Frame 20
TotalLaps = 5;
CurrentLap = 1;
CheckPointClipArray = new Array(ClipInterLap1, ClipInterLap2, ClipInterLap3, ClipInterLap4, ClipNewLap);
CheckPointNumArray = new Array(0, 0, 0, 0, 0);
TheDate = new Date();
TextLaps = (("Lap " + CurrentLap) + "/") + TotalLaps;
TextTime = "Time : 0 s 00";
StartTime = TheDate.getTime();
delete TheDate;
OpponentLaps = 0;
Frame 21
myCar1 = new CCar(6, 0.08, CarN1, 315, Key.UP, Key.LEFT, Key.RIGHT, BordsCircuit);
Frame 22
TheDate = new Date();
CurrentTime = TheDate.getTime();
delete TheDate;
TotalTime = CurrentTime - StartTime;
TextTime = (("Time : " + Math.floor(TotalTime / 1000)) + " s ") + Math.floor((TotalTime - (Math.floor(TotalTime / 1000) * 1000)) / 10);
myCar1.Move();
TestVal = TestCheckPoint(CheckPointClipArray, myCar1.ClipName);
if (-1 < TestVal) {
if (UpDateCheckPointNumArray(TestVal, CheckPointNumArray)) {
TestVal = TestNewLap(CheckPointNumArray);
if (TestVal) {
CurrentLap++;
InitTab(CheckPointNumArray, 0);
if (TotalLaps >= CurrentLap) {
TextLaps = (("Lap " + CurrentLap) + "/") + TotalLaps;
} else {
gotoAndPlay(_currentframe + 2);
}
}
}
}
TextTabNum = (((((((CheckPointNumArray[0] + " ") + CheckPointNumArray[1]) + " ") + CheckPointNumArray[2]) + " ") + CheckPointNumArray[3]) + " ") + CheckPointNumArray[4];
if (TotalLaps < OpponentLaps) {
ClipOpponent.stop();
gotoAndPlay(_currentframe + 2);
}
play();
Frame 23
prevFrame();
Frame 25
stop();
Frame 26
gotoAndPlay (3);
Frame 30
TotalLaps = 5;
CurrentLap = 1;
CheckPointClipArray = new Array(ClipInterLap1, ClipInterLap2, ClipInterLap3, ClipInterLap4, ClipNewLap);
CheckPointNumArray = new Array(0, 0, 0, 0, 0);
TheDate = new Date();
TextLaps = (("Lap " + CurrentLap) + "/") + TotalLaps;
TextTime = "Time : 0 s 00";
StartTime = TheDate.getTime();
delete TheDate;
OpponentLaps = 0;
Frame 31
myCar1 = new CCar(6, 0.08, CarN1, 0, Key.UP, Key.LEFT, Key.RIGHT, BordsCircuit);
Frame 32
TheDate = new Date();
CurrentTime = TheDate.getTime();
delete TheDate;
TotalTime = CurrentTime - StartTime;
TextTime = (("Time : " + Math.floor(TotalTime / 1000)) + " s ") + Math.floor((TotalTime - (Math.floor(TotalTime / 1000) * 1000)) / 10);
myCar1.Move();
TestVal = TestCheckPoint(CheckPointClipArray, myCar1.ClipName);
if (-1 < TestVal) {
if (UpDateCheckPointNumArray(TestVal, CheckPointNumArray)) {
TestVal = TestNewLap(CheckPointNumArray);
if (TestVal) {
CurrentLap++;
InitTab(CheckPointNumArray, 0);
if (TotalLaps >= CurrentLap) {
TextLaps = (("Lap " + CurrentLap) + "/") + TotalLaps;
} else {
gotoAndPlay(_currentframe + 2);
}
}
}
}
TextTabNum = (((((((CheckPointNumArray[0] + " ") + CheckPointNumArray[1]) + " ") + CheckPointNumArray[2]) + " ") + CheckPointNumArray[3]) + " ") + CheckPointNumArray[4];
if (TotalLaps < OpponentLaps) {
ClipOpponent.stop();
gotoAndPlay(_currentframe + 2);
}
play();
Frame 33
prevFrame();
Frame 35
stop();
Frame 36
gotoAndPlay (3);
Symbol 36 Button
on (release) {
gotoAndPlay (10);
ClipRegles.play();
}
Symbol 40 Button
on (release) {
gotoAndPlay (10);
ClipCredits.play();
}
Symbol 44 Button
on (release) {
gotoAndPlay (10);
SelectCircuit._visible = 1;
}
Symbol 58 MovieClip Frame 1
stop();
Symbol 58 MovieClip Frame 275
_parent.play();
Symbol 61 MovieClip Frame 1
stop();
Symbol 61 MovieClip Frame 259
_parent.play();
Symbol 72 Button
on (release) {
_root.VarNumCircuit = "Circuit1";
_root.play();
}
Symbol 79 Button
on (release) {
_root.VarNumCircuit = "Circuit2";
_root.play();
}
Symbol 86 Button
on (release) {
_root.VarNumCircuit = "Circuit3";
_root.play();
}
Symbol 93 MovieClip Frame 1
SelectCircuit._visible = 0;
Symbol 93 MovieClip Frame 2
stop();
Symbol 93 MovieClip Frame 10
stop();
Symbol 93 MovieClip Frame 19
gotoAndPlay (1);
Symbol 93 MovieClip Frame 20
stop();
Symbol 93 MovieClip Frame 29
gotoAndPlay (1);
Symbol 93 MovieClip Frame 30
stop();
Symbol 93 MovieClip Frame 101
stop();
Symbol 108 MovieClip Frame 1
_root.OpponentLaps++;
Symbol 111 MovieClip Frame 45
_root.play();
Symbol 117 MovieClip Frame 1
-(root.OpponentLaps++);
Symbol 123 MovieClip Frame 1
_root.OpponentLaps++;