Frame 1
function getAlphaNum(number) {
toReturn = "";
while (number > 0) {
unite = number % baseAlphaNum;
if (unite < 10) {
toReturn = String.fromCharCode(unite + 48) + toReturn;
} else if (unite < 36) {
toReturn = String.fromCharCode(unite + 55) + toReturn;
} else {
toReturn = String.fromCharCode(unite + 61) + toReturn;
}
number = (number - unite) / baseAlphaNum;
}
return(toReturn);
}
function getNumber(alphanum) {
toReturn = 0;
l = alphanum.length;
i = 0;
while (i < l) {
unite = alphanum.charCodeAt(i);
if ((unite >= 48) && (unite < 58)) {
toReturn = ((toReturn * baseAlphaNum) + unite) - 48;
} else if ((unite >= 65) && (unite < 91)) {
toReturn = ((toReturn * baseAlphaNum) + unite) - 55;
} else if ((unite >= 97) && (unite < 123)) {
toReturn = ((toReturn * baseAlphaNum) + unite) - 61;
}
i++;
}
return(toReturn);
}
function playSurround(show) {
if (show) {
playback._visible = play_btn._visible;
playback.gotoAndPlay(1);
} else {
playback._visible = false;
}
}
function showButtons(vis) {
pause_btn._visible = vis;
play_btn._visible = vis;
stop_btn._visible = vis;
playback._visible = vis;
}
function clicStart() {
if (!_root.timing) {
menuder._visible = false;
if (_root.voitureverte.gare && (_root.voitureverte.replayPlay == false)) {
_root.timer_txt = "00:00:00:00";
_root.voitureverte.init();
_root.voitureverte.initReplayRec();
}
if (_root.paused) {
} else {
startFrame = frame;
}
_root.paused = false;
_root.timing = true;
aidetimestart = -1;
}
}
function clicStop() {
_root.timing = false;
_root.paused = false;
_root.timer_txt = "00:00:00:00";
chocs_txt = "";
art_txt = "";
playSurround(true);
menuder._visible = true;
_root.voitureverte.init();
_root.voitureverte.initReplayRec();
aidetimestart = getTimer();
}
var vX = _root.voitureverte._x;
var vY = _root.voitureverte._y;
var vRot = _root.voitureverte._rotation;
var xCorps = _root.voitureverte.bustebras._x;
var yCorps = _root.voitureverte.bustebras._y;
var xTete = _root.voitureverte.tete._x;
var yTete = _root.voitureverte.tete._y;
var frame = 0;
var startFrame = 0;
var baseAlphaNum = 62;
var timing = false;
chocs_txt = "";
art_txt = "";
aidetimestart = getTimer();
_root.play_btn.onPress = function () {
clicStart();
};
_root.stop_btn.onPress = function () {
clicStop();
};
_root.pause_btn.onPress = function () {
if (_root.timing) {
_root.timing = false;
_root.paused = true;
playSurround(true);
}
};
_root.onEnterFrame = function () {
if (voitureverte.chocs > 0) {
chocs_txttmp = "chocs : " + voitureverte.chocs;
} else {
chocs_txttmp = "";
}
if (chocs_txttmp != chocs_txt) {
chocs_txt = chocs_txttmp;
}
if ((aidetimestart != -1) && ((getTimer() - aidetimestart) > 2000)) {
_root.aide._visible = true;
} else {
_root.aide._visible = false;
}
if (timing) {
playSurround(false);
elapsedTime = ((frame - startFrame) * 100) / 3;
elapsedHours = Math.floor(elapsedTime / 3600000);
remaining = elapsedTime - (elapsedHours * 3600000);
elapsedM = Math.floor(remaining / 60000);
remaining = remaining - (elapsedM * 60000);
elapsedS = Math.floor(remaining / 1000);
remaining = remaining - (elapsedS * 1000);
elapsedH = Math.floor(remaining / 10);
if (elapsedHours < 10) {
hours = "0" + elapsedHours.toString();
} else {
hours = elapsedHours.toString();
}
if (elapsedM < 10) {
minutes = "0" + elapsedM.toString();
} else {
minutes = elapsedM.toString();
}
if (elapsedS < 10) {
seconds = "0" + elapsedS.toString();
} else {
seconds = elapsedS.toString();
}
if (elapsedH < 10) {
hundredths = "0" + elapsedH.toString();
} else {
hundredths = elapsedH.toString();
}
_root.timer_txt = (((((hours + ":") + minutes) + ":") + seconds) + ":") + hundredths;
frame++;
}
};
Instance of Symbol 3 MovieClip in Frame 1
on (press) {
getURL ("http://annuaire.pepere.free.fr/aventures/pepere.php");
}
Instance of Symbol 34 MovieClip "voitureverte" in Frame 1
onClipEvent (load) {
function setBrasRotation() {
xVolant = reposBonhommeVolant - corpsDeltaX;
yVolantGauche = corpsDeltaY + posBrasGaucheVolant;
yDiff = yVolantGauche - lEpaule;
lEpauleGaucheVolant = Math.sqrt((yDiff * yDiff) + (xVolant * xVolant));
alpha = Math.atan(yDiff / xVolant);
beta = Math.acos(lEpauleGaucheVolant / (2 * lBras));
Angle1 = ((-(alpha + beta)) * 180) / Math.PI;
Angle2 = ((2 * beta) * 180) / Math.PI;
bustebras.brasgaucheplein._rotation = Angle1;
bustebras.contourbrasgauche._rotation = Angle1;
bustebras.contourbrasgauche.avantbras._rotation = Angle2;
yVolantDroit = corpsDeltaY - posBrasDroitVolant;
yDiff = yVolantDroit + lEpaule;
lEpauleDroiteVolant = Math.sqrt((yDiff * yDiff) + (xVolant * xVolant));
alpha = Math.atan(yDiff / xVolant);
beta = Math.acos(lEpauleGaucheVolant / (2 * lBras));
Angle1 = ((beta - alpha) * 180) / Math.PI;
Angle2 = ((-(2 * beta)) * 180) / Math.PI;
bustebras.brasdroitplein._rotation = Angle1;
bustebras.contourbrasdroit._rotation = Angle1;
bustebras.contourbrasdroit.avantbras._rotation = Angle2;
}
function init() {
speedDecay = 0.85;
maxSpeed = 7;
incRotation = 0;
incRotationQuanta = 8;
maxWheelAngle = 45;
incSpeed = 0;
incSpeedQuanta = 0.2;
speed = 0;
wheelRotation = 0;
carLength = 90;
carLengthScaled = (carLength * _xscale) / 100;
incy = 0;
incx = 0;
_x = _root.vX;
_y = _root.vY;
_rotation = _root.vRot;
rouedroite._rotation = wheelRotation;
rouegauche._rotation = wheelRotation;
memoX = _x;
memoY = _y;
memoRot = _rotation;
etape = 0;
gagne = false;
gare = false;
_root.gagnos._visible = false;
reposBonhommeVolant = 20;
rayonVolant = 8;
posBrasGaucheVolant = 0;
posBrasDroitVolant = 0;
corpsDeltaX = 0;
corpsDeltaY = 0;
maxCorpsDeltaY = 4;
corpsSpeedX = 0;
maxCorpsDeltaX = 8;
minCorpsDeltaX = -5;
corpsDecay = 0.5;
bustebras._x = _root.xCorps + corpsDeltaX;
bustebras._y = _root.yCorps + corpsDeltaY;
teteDeltaX = 0;
teteDeltaY = 0;
teteDecay = 0.5;
maxTeteDeltaX = 10;
minTeteDeltaX = -8;
teteSpeedX = 0;
tete._x = (_root.xTete + corpsDeltaX) + teteDeltaX;
tete._y = (_root.yTete + corpsDeltaY) + teteDeltaY;
bustebras._x = _root.xCorps;
bustebras._y = _root.yCorps;
lBras = 14;
lEpaule = 10;
ombrevoiture._x = Math.cos((((-_rotation) + 45) * Math.PI) / 180) * 15;
ombrevoiture._y = Math.sin((((-_rotation) + 45) * Math.PI) / 180) * 15;
setBrasRotation();
tuturevertefeuxarr.gotoAndStop(1);
chocs = 0;
forceChocs = 0;
noteArtistique = 0;
noteArtistiqueFinale = -1;
bonusArtistique = 0;
score = 0;
derapDecayArr = 0.93;
derapDecayArrFluide = 0.98;
derapDecayAva = 0.3;
derapDecayAvaFluide = 0.98;
derapQuickDecay = 0.5;
derapSpeedIncRap = 0.15;
derapQuickDecaySpeedLimit = 3;
derapQuickDecayZeroSpeedLimit = 1;
poidsAva = 1;
poidsArr = 1;
poidsTot = poidsAva + poidsArr;
derapage = false;
frein = false;
memoDerapArr = {x:0, y:0};
memoDerapAva = {x:0, y:0};
firstDerapage = true;
startFrameLastDerapage = -1;
startAngLastDerapage = -1;
endFrameLastDerapage = -1;
tracespneu = new Array();
tracespneuStart = 0;
tracespneuEnd = 0;
if (pneuFrame != undefined) {
i = 0;
while (i < pneuFrame) {
_root.tracespneu["tracespneu" + i].removeMovieClip();
i++;
}
}
pneuFrame = 0;
}
function initReplayRec() {
replayRecFrame = 0;
replayPlayFrame = 0;
replayRecEventsIndex = 0;
replayPlayEventsIndex = 0;
replayEvents = new Array();
replayPlay = false;
_root.replayos.gotoAndStop(1);
_root.repclign.stop();
_root.repclign._visible = false;
}
function hit(clip) {
return(((((((((((((clip.hitTest(arriere) || (clip.hitTest(arrieregauche))) || (clip.hitTest(arrieregauche2))) || (clip.hitTest(gauche))) || (clip.hitTest(avantgauche3))) || (clip.hitTest(avantgauche2))) || (clip.hitTest(avantgauche))) || (clip.hitTest(avant))) || (clip.hitTest(avantdroite))) || (clip.hitTest(avantdroite3))) || (clip.hitTest(avantdroite2))) || (clip.hitTest(droite))) || (clip.hitTest(arrieredroite))) || (clip.hitTest(arrieredroite2)));
}
function startReplayPlay() {
init();
replayPlayFrame = 0;
replayPlayEventsIndex = 0;
replayPlay = true;
_root.timing = true;
_root.paused = false;
_root.timer_txt = "00:00:00:00";
_root.startFrame = _root.frame;
_root.repclign._visible = true;
_root.repclign.gotoAndPlay(1);
}
function keyDownAction(t) {
toreturn = false;
if (t == 39) {
if (incRotation != incRotationQuanta) {
incRotation = incRotationQuanta;
toreturn = true;
}
} else if (t == 37) {
if (incRotation != (-incRotationQuanta)) {
incRotation = -incRotationQuanta;
toreturn = true;
}
} else if (t == 40) {
if (incSpeed != (-incSpeedQuanta)) {
incSpeed = -incSpeedQuanta;
toreturn = true;
}
} else if (t == 38) {
if (incSpeed != incSpeedQuanta) {
incSpeed = incSpeedQuanta;
toreturn = true;
}
} else if (t == 32) {
if (frein != true) {
frein = true;
derapage = true;
toreturn = true;
}
}
return(toreturn);
}
function getNewCoord(v, va, vb) {
return({a:((v.y * vb.x) - (v.x * vb.y)) / ((va.y * vb.x) - (va.x * vb.y)), b:((v.y * va.x) - (v.x * va.y)) / ((vb.y * va.x) - (vb.x * va.y))});
}
function getProjection(v, va) {
return(((v.y * va.y) + (v.x * va.x)) / ((va.y * va.y) + (va.x * va.x)));
}
function getNormedProjection(v, va) {
return((v.y * va.y) + (v.x * va.x));
}
function getPolaire(v) {
dx = v.x;
dy = v.y;
d = Math.sqrt((dx * dx) + (dy * dy));
if (d == 0) {
a = 0;
} else {
a = Math.acos(dx / d);
if (dy < 0) {
a = -a;
}
}
return({a:a, d:d});
}
function keyUpAction(t) {
if (t == 39) {
if (incRotation > 0) {
incRotation = 0;
}
} else if (t == 37) {
if (incRotation < 0) {
incRotation = 0;
}
} else if (t == 40) {
if (incSpeed < 0) {
incSpeed = 0;
}
} else if (t == 38) {
if (incSpeed > 0) {
incSpeed = 0;
}
} else if (t == 32) {
if (derapage == true) {
frein = false;
}
}
}
debug = false;
init();
initReplayRec();
}
onClipEvent (keyDown) {
if ((_root.timing == true) && (replayPlay == false)) {
t = Key.getCode();
if (keyDownAction(t)) {
replayEvents[replayRecEventsIndex] = {framenb:replayRecFrame, updown:1, keycode:t};
replayRecEventsIndex = replayRecEventsIndex + 1;
}
}
}
onClipEvent (keyUp) {
t = Key.getCode();
a = Key.getAscii();
if (a == 115) {
if (((_root.timing == false) && (replayPlay == false)) && (_root.gagnos._visible == false)) {
_root.clicStart();
} else if (_root.timing == true) {
_root.clicStop();
}
} else if ((_root.timing == true) && (replayPlay == false)) {
keyUpAction(t);
replayEvents[replayRecEventsIndex] = {framenb:replayRecFrame, updown:0, keycode:t};
replayRecEventsIndex = replayRecEventsIndex + 1;
}
}
onClipEvent (enterFrame) {
if ((_root.timing == true) && (_root.paused == false)) {
if (replayPlay) {
currentFrameIsEvented = true;
while (currentFrameIsEvented) {
nextFrame = replayEvents[replayPlayEventsIndex].framenb;
if (nextFrame == replayPlayFrame) {
if (replayEvents[replayPlayEventsIndex].updown == 0) {
keyUpAction(replayEvents[replayPlayEventsIndex].keycode);
} else {
keyDownAction(replayEvents[replayPlayEventsIndex].keycode);
}
replayPlayEventsIndex = replayPlayEventsIndex + 1;
} else {
currentFrameIsEvented = false;
}
}
replayPlayFrame = replayPlayFrame + 1;
}
if (debug) {
_root.createEmptyMovieClip("traces", replayRecFrame);
traceClip = _root.traces;
}
if (derapage) {
memoDerapArr = {x:memoX, y:memoY};
tmpRadAng = (memoRot * Math.PI) / 180;
memoDerapAva = {x:memoX + (carLength * Math.cos(tmpRadAng)), y:memoY + (carLength * Math.sin(tmpRadAng))};
if (debug) {
zoom = 20;
traceClip.lineStyle(4, 255, 100);
traceClip.moveTo(memoDerapArr.x, memoDerapArr.y);
traceClip.lineTo(memoDerapArr.x - 2, memoDerapArr.y - 2);
}
}
memoX = _x;
memoY = _y;
memoRot = _rotation;
oldRot = wheelRotation;
oldSpeed = speed;
oldCorpsSpeedX = corpsSpeedX;
wheelRotation = wheelRotation + incRotation;
if (wheelRotation > maxWheelAngle) {
wheelRotation = maxWheelAngle;
} else if (wheelRotation < (-maxWheelAngle)) {
wheelRotation = -maxWheelAngle;
}
if (oldRot != wheelRotation) {
rouedroite._rotation = wheelRotation;
rouegauche._rotation = wheelRotation;
}
if (derapage) {
derapArr = {x:_x, y:_y};
tmpRadAng = (_rotation * Math.PI) / 180;
derapAva = {x:_x + (carLength * Math.cos(tmpRadAng)), y:_y + (carLength * Math.sin(tmpRadAng))};
diffDerapArr = {x:derapArr.x - memoDerapArr.x, y:derapArr.y - memoDerapArr.y};
dCarre = (diffDerapArr.x * diffDerapArr.x) + (diffDerapArr.y * diffDerapArr.y);
if (dCarre < derapQuickDecaySpeedLimit) {
if (dCarre < derapQuickDecayZeroSpeedLimit) {
diffDerapArr = {x:diffDerapArr.x * 0.1, y:diffDerapArr.y * 0.1};
if (endFrameLastDerapage == -1) {
endFrameLastDerapage = pneuFrame;
}
} else {
diffDerapArr = {x:diffDerapArr.x * derapQuickDecay, y:diffDerapArr.y * derapQuickDecay};
}
}
tmpRoueRadAng = (_rotation * Math.PI) / 180;
vRoue = {x:Math.cos(tmpRoueRadAng), y:Math.sin(tmpRoueRadAng)};
vRoueOrth = {x:-vRoue.y, y:vRoue.x};
diffDerapArrRepRoue = getNewCoord(diffDerapArr, vRoue, vRoueOrth);
diffDerapArrModif = {x:((diffDerapArrRepRoue.a * vRoue.x) * derapDecayArrFluide) + ((diffDerapArrRepRoue.b * vRoueOrth.x) * derapDecayArr), y:((diffDerapArrRepRoue.a * vRoue.y) * derapDecayArrFluide) + ((diffDerapArrRepRoue.b * vRoueOrth.y) * derapDecayArr)};
newDerapArr = {x:derapArr.x + diffDerapArrModif.x, y:derapArr.y + diffDerapArrModif.y};
diffDerapAva = {x:derapAva.x - memoDerapAva.x, y:derapAva.y - memoDerapAva.y};
dCarre = (diffDerapAva.x * diffDerapAva.x) + (diffDerapAva.y * diffDerapAva.y);
if (dCarre < derapQuickDecaySpeedLimit) {
if (dCarre < derapQuickDecayZeroSpeedLimit) {
diffDerapAva = {x:diffDerapAva.x * 0.1, y:diffDerapAva.y * 0.1};
} else {
diffDerapAva = {x:diffDerapAva.x * derapQuickDecay, y:diffDerapAva.y * derapQuickDecay};
}
}
tmpRoueRadAng = ((_rotation + wheelRotation) * Math.PI) / 180;
vRoue = {x:Math.cos(tmpRoueRadAng), y:Math.sin(tmpRoueRadAng)};
vRoueOrth = {x:-vRoue.y, y:vRoue.x};
diffDerapAvaRepRoue = getNewCoord(diffDerapAva, vRoue, vRoueOrth);
diffDerapAvaModif = {x:((diffDerapAvaRepRoue.a * vRoue.x) * derapDecayAvaFluide) + ((diffDerapAvaRepRoue.b * vRoueOrth.x) * derapDecayAva), y:((diffDerapAvaRepRoue.a * vRoue.y) * derapDecayAvaFluide) + ((diffDerapAvaRepRoue.b * vRoueOrth.y) * derapDecayAva)};
newDerapAva = {x:derapAva.x + diffDerapAvaModif.x, y:derapAva.y + diffDerapAvaModif.y};
voitureTailleNonCorrecte = {x:newDerapAva.x - newDerapArr.x, y:newDerapAva.y - newDerapArr.y};
voitureTailleNonCorrectePol = getPolaire(voitureTailleNonCorrecte);
milieuVoiture = {x:(newDerapAva.x + newDerapArr.x) / 2, y:(newDerapAva.y + newDerapArr.y) / 2};
newRotation = voitureTailleNonCorrectePol.a;
demiRayon = (carLength / 2) + ((((voitureTailleNonCorrectePol.d - carLength) / 2) * (poidsArr - poidsAva)) / poidsTot);
if (!frein) {
demiRayon = demiRayon - ((incSpeed * derapSpeedIncRap) / incSpeedQuanta);
tuturevertefeuxarr.gotoAndStop(2);
} else {
tuturevertefeuxarr.gotoAndStop(1);
}
newPosition = {x:milieuVoiture.x - (Math.cos(newRotation) * demiRayon), y:milieuVoiture.y - (Math.sin(newRotation) * demiRayon)};
if (debug) {
zoom = 20;
traceClip.lineStyle(1.5, 7798784, 100);
traceClip.moveTo(derapAva.x, derapAva.y);
traceClip.lineTo(derapAva.x + (diffDerapAva.x * zoom), derapAva.y + (diffDerapAva.y * zoom));
traceClip.lineStyle(1.5, 16711680, 100);
traceClip.moveTo(derapArr.x, derapArr.y);
traceClip.lineTo(derapArr.x + (diffDerapArr.x * zoom), derapArr.y + (diffDerapArr.y * zoom));
traceClip.lineStyle(1.5, 65280, 100);
traceClip.moveTo(newDerapArr.x, newDerapArr.y);
traceClip.lineTo(newDerapAva.x, newDerapAva.y);
zoom = 20;
traceClip.lineStyle(4, 119, 100);
traceClip.moveTo(milieuVoiture.x, milieuVoiture.y);
traceClip.lineTo(milieuVoiture.x - 2, milieuVoiture.y - 2);
}
_x = newPosition.x;
_y = newPosition.y;
_rotation = ((newRotation * 180) / Math.PI);
_root.tracespneu.createEmptyMovieClip("tracespneu" + pneuFrame, pneuFrame);
tracespneuClip = _root.tracespneu["tracespneu" + pneuFrame];
parrd = {x:_x + (17 * Math.cos(newRotation + (Math.PI/2))), y:_y + (17 * Math.sin(newRotation + (Math.PI/2)))};
parrg = {x:_x - (17 * Math.cos(newRotation + (Math.PI/2))), y:_y - (17 * Math.sin(newRotation + (Math.PI/2)))};
tracespneu[tracespneuEnd] = {frame:pneuFrame, type:1, pneus:new Array(parrd, parrg)};
if (firstDerapage == true) {
firstDerapage = false;
tracespneu[tracespneuEnd].type = 0;
startFrameLastDerapage = pneuFrame;
endFrameLastDerapage = -1;
bonusArtistique = 0;
startAngLastDerapage = _rotation;
} else {
k = 0;
while (k < 3) {
if (k == 0) {
pneucouleur = 7838173 /* 0x7799DD */;
pneulargeur = 3;
decalpneux = -3;
decalpneuy = -3;
} else if (k == 1) {
pneucouleur = 12312063 /* 0xBBDDFF */;
pneulargeur = 3;
decalpneux = 3;
decalpneuy = 3;
} else if (k == 2) {
pneucouleur = 10075118 /* 0x99BBEE */;
pneulargeur = 4;
decalpneux = 0;
decalpneuy = 0;
}
j = 0;
while (j < 2) {
xderold = 0;
yderold = 0;
i = tracespneuEnd;
pneu = tracespneu[i];
oldpneu = tracespneu[i - 1];
tracespneuClip.lineStyle(pneulargeur, pneucouleur, 50);
tracespneuClip.moveTo(oldpneu.pneus[j].x + decalpneux, oldpneu.pneus[j].y + decalpneuy);
tracespneuClip.lineTo(pneu.pneus[j].x + decalpneux, pneu.pneus[j].y + decalpneuy);
j++;
}
k++;
}
}
tracespneuEnd++;
ombrevoiture._x = Math.cos((((-_rotation) + 45) * Math.PI) / 180) * 15;
ombrevoiture._y = Math.sin((((-_rotation) + 45) * Math.PI) / 180) * 15;
} else {
speed = speed + incSpeed;
if (speed > maxSpeed) {
speed = maxSpeed;
} else if (speed < (-maxSpeed)) {
speed = -maxSpeed;
}
if (incSpeed == 0) {
speed = speed * speedDecay;
tuturevertefeuxarr.gotoAndStop(1);
} else {
tuturevertefeuxarr.gotoAndStop(2);
speed = speed + incSpeed;
if (speed > maxSpeed) {
speed = maxSpeed;
} else if (speed < (-maxSpeed)) {
speed = -maxSpeed;
}
}
incx = Math.sin(wheelRotation * (Math.PI/180)) * speed;
_rotation = (_rotation + ((Math.atan(incx / carLength) * 180) / Math.PI));
ombrevoiture._x = Math.cos((((-_rotation) + 45) * Math.PI) / 180) * 15;
ombrevoiture._y = Math.sin((((-_rotation) + 45) * Math.PI) / 180) * 15;
incy = Math.cos(wheelRotation * (Math.PI/180)) * speed;
_y = (_y + (Math.sin((_rotation + 0) * (Math.PI/180)) * incy));
_x = (_x + (Math.cos((_rotation + 0) * (Math.PI/180)) * incy));
}
memoMove = {x:0, y:0};
if (_y < 0) {
_y = (_y + 800);
memoMove.y = 800;
} else if (_y > 800) {
_y = (_y - 800);
memoMove.y = -800;
}
if (_x < 0) {
_x = (_x + 800);
memoMove.x = 800;
} else if (_x > 800) {
_x = (_x - 800);
memoMove.x = -800;
}
if (_root.circuit.ligne.hitTest(centre)) {
if (etape == 0) {
etape = 1;
} else if (etape == 3) {
gagne = true;
} else if (etape > 1) {
etape--;
}
} else if (_root.circuit.ligne1_1.hitTest(centre) || (_root.circuit.ligne1_2.hitTest(centre))) {
if (etape == 1) {
etape = 2;
} else if (etape > 2) {
etape--;
}
} else if (_root.circuit.ligne2.hitTest(centre)) {
if (etape == 2) {
etape = 3;
} else if (etape > 3) {
etape--;
}
}
tmpP1 = {x:_x, y:_y};
A = !_root.circuit.hitTest(tmpP1.x, tmpP1.y, true);
tmpRadAng = (_rotation * Math.PI) / 180;
tmpP2 = {x:_x + (carLengthScaled * Math.cos(tmpRadAng)), y:_y + (carLengthScaled * Math.sin(tmpRadAng))};
B = !_root.circuit.hitTest(tmpP2.x, tmpP2.y, true);
if (A || (B)) {
if (Math.abs(speed) > 7) {
chocs = chocs + 1;
forceChocs = forceChocs + Math.abs(speed);
}
memoDerapArr = {x:memoX, y:memoY};
tmpMemoRadAng = (memoRot * Math.PI) / 180;
memoDerapAva = {x:memoX + (carLengthScaled * Math.cos(tmpMemoRadAng)), y:memoY + (carLengthScaled * Math.sin(tmpMemoRadAng))};
nAngles = 10;
speedChocStop = 0.7;
if (A) {
newArriere = memoDerapArr;
vectArr = {x:tmpP1.x - memoDerapArr.x, y:tmpP1.y - memoDerapArr.y};
vectArrPol = getPolaire(vectArr);
i = 0;
while (i < (nAngles - 1)) {
tmpAngle = ((i + 1) * Math.PI) / nAngles;
tmpFacteur = Math.abs(Math.sin(tmpAngle)) * speedChocStop;
pTest = {x:memoDerapArr.x + ((vectArrPol.d * Math.cos(vectArrPol.a + tmpAngle)) * tmpFacteur), y:memoDerapArr.y + ((vectArrPol.d * Math.sin(vectArrPol.a + tmpAngle)) * tmpFacteur)};
if (_root.circuit.hitTest(pTest.x, pTest.y, true)) {
newArriere = pTest;
break;
}
pTest = {x:memoDerapArr.x + ((vectArrPol.d * Math.cos(vectArrPol.a - tmpAngle)) * tmpFacteur), y:memoDerapArr.y + ((vectArrPol.d * Math.sin(vectArrPol.a - tmpAngle)) * tmpFacteur)};
if (_root.circuit.hitTest(pTest.x, pTest.y, true)) {
newArriere = pTest;
break;
}
i++;
}
} else {
newArriere = tmpP1;
}
if (B) {
newAvant = memoDerapAva;
vectAva = {x:tmpP2.x - memoDerapAva.x, y:tmpP2.y - memoDerapAva.y};
vectAvaPol = getPolaire(vectAva);
i = 0;
while (i < (nAngles - 1)) {
tmpAngle = ((i + 1) * Math.PI) / nAngles;
tmpFacteur = Math.abs(Math.sin(tmpAngle)) * speedChocStop;
pTest = {x:memoDerapAva.x + ((vectAvaPol.d * Math.cos(vectAvaPol.a + tmpAngle)) * tmpFacteur), y:memoDerapAva.y + ((vectAvaPol.d * Math.sin(vectAvaPol.a + tmpAngle)) * tmpFacteur)};
if (_root.circuit.hitTest(pTest.x, pTest.y, true)) {
newAvant = pTest;
break;
}
pTest = {x:memoDerapAva.x + ((vectAvaPol.d * Math.cos(vectAvaPol.a - tmpAngle)) * tmpFacteur), y:memoDerapAva.y + ((vectAvaPol.d * Math.sin(vectAvaPol.a - tmpAngle)) * tmpFacteur)};
if (_root.circuit.hitTest(pTest.x, pTest.y, true)) {
newAvant = pTest;
break;
}
i++;
}
} else {
newAvant = tmpP2;
}
voitureTailleNonCorrecte = {x:newAvant.x - newArriere.x, y:newAvant.y - newArriere.y};
voitureTailleNonCorrectePol = getPolaire(voitureTailleNonCorrecte);
milieuVoiture = {x:(newAvant.x + newArriere.x) / 2, y:(newAvant.y + newArriere.y) / 2};
newRotation = voitureTailleNonCorrectePol.a;
demiRayon = carLengthScaled / 2;
if (A && (B)) {
_x = memoX;
_y = memoY;
_rotation = memoRot;
speed = 0;
} else if (A) {
newPosition = {x:newArriere.x, y:newArriere.y};
speed = speed * speedChocStop;
_x = newPosition.x;
_y = newPosition.y;
_rotation = ((newRotation * 180) / Math.PI);
} else if (B) {
newPosition = {x:newAvant.x - (Math.cos(newRotation) * carLengthScaled), y:newAvant.y - (Math.sin(newRotation) * carLengthScaled)};
speed = speed * speedChocStop;
_x = newPosition.x;
_y = newPosition.y;
_rotation = ((newRotation * 180) / Math.PI);
}
} else {
if (gagne == true) {
gare = true;
if (replayPlay) {
_root.timing = false;
replayPlay = false;
_root.replayos.gotoAndPlay(2);
} else {
_root.gagnos._visible = true;
_root.gagnos.gotoAndPlay(1);
_root.elapsedTime = (Math.ceil(_root.elapsedTime) + 8) - random(16);
noteArtistiqueFinale = noteArtistique;
score = (2000000 / _root.elapsedTime) - forceChocs;
_root.timing = false;
_root.paused = false;
}
_root.playSurround(true);
}
memoX = memoX + memoMove.x;
memoY = memoY + memoMove.y;
}
if (startFrameLastDerapage != -1) {
if (noteArtistiqueFinale != -1) {
noteArtistique = noteArtistiqueFinale;
} else {
if (endFrameLastDerapage == -1) {
endFrameLastDerapageTmp = pneuFrame;
} else {
endFrameLastDerapageTmp = endFrameLastDerapage;
}
durreeDerapage = endFrameLastDerapageTmp - startFrameLastDerapage;
dureeEcouleDepuisFinDerapage = pneuFrame - endFrameLastDerapageTmp;
noteArtistique = ((durreeDerapage - 10) * 3) - (dureeEcouleDepuisFinDerapage * 2);
if (noteArtistique > 150) {
startFrameLastDerapage++;
noteArtistique = 150;
}
diffAngDerapageArtistique = Math.abs(_rotation - startAngLastDerapage);
if (diffAngDerapageArtistique > 135) {
if (bonusArtistique < 50) {
bonusArtistique = 50;
}
}
if (diffAngDerapageArtistique > 160) {
bonusArtistique = 100;
}
noteArtistique = noteArtistique + bonusArtistique;
if (noteArtistique < 0) {
noteArtistique = 0;
}
}
}
if (derapage) {
Set("lastDiffArri\u00E8re", {x:_x - memoDerapArr.x, y:_y - memoDerapArr.y});
voitureVect = {x:Math.cos((_rotation * Math.PI) / 180), y:Math.sin((_rotation * Math.PI) / 180)};
speed = getNormedProjection(lastDiffArri\u00E8re, voitureVect);
}
if (!frein) {
if (Math.abs((_rotation - memoRot) * speed) > 19.1) {
derapage = true;
} else if (derapage == true) {
Set("lastDiffArri\u00E8reDCarre", (lastDiffArri\u00E8re.x * lastDiffArri\u00E8re.x) + (lastDiffArri\u00E8re.y * lastDiffArri\u00E8re.y));
if ((((speed * speed) / lastDiffArri\u00E8reDCarre) > 0.9) || (lastDiffArri\u00E8reDCarre < 0.5)) {
derapage = false;
speed = speed * 0.7;
firstDerapage = true;
if (endFrameLastDerapage == -1) {
endFrameLastDerapage = pneuFrame;
}
}
}
}
forceAccelerationY = oldSpeed - speed;
if (corpsDeltaY > 0) {
forceBack = (-corpsDeltaX) * 0.5;
} else {
forceBack = (-corpsDeltaX) * 2;
}
corpsSpeedX = corpsSpeedX + (forceAccelerationY + forceBack);
oldCorpsDeltaX = corpsDeltaX;
corpsDeltaX = corpsDeltaX + corpsSpeedX;
if (corpsDeltaX > maxCorpsDeltaX) {
corpsDeltaX = maxCorpsDeltaX;
} else if (corpsDeltaX < minCorpsDeltaX) {
corpsDeltaX = minCorpsDeltaX;
}
bustebras._x = _root.xCorps + corpsDeltaX;
corpsSpeedX = corpsSpeedX * corpsDecay;
teteDeltaX = teteDeltaX + (oldCorpsDeltaX - corpsDeltaX);
teteSpeedX = teteSpeedX + ((-teteDeltaX) * 0.5);
teteDeltaX = teteDeltaX + teteSpeedX;
if (teteDeltaX > maxTeteDeltaX) {
teteDeltaX = maxTeteDeltaX;
} else if (teteDeltaX < minTeteDeltaX) {
teteDeltaX = minTeteDeltaX;
}
tete._x = (_root.xTete + corpsDeltaX) + teteDeltaX;
teteSpeedX = teteSpeedX * teteDecay;
if (((oldRot != wheelRotation) || (oldSpeed != speed)) || (oldCorpsSpeedX != corpsSpeedX)) {
corpsDeltaY = ((wheelRotation * Math.abs(speed)) * maxCorpsDeltaY) / (maxWheelAngle * maxSpeed);
bustebras._y = _root.yCorps + corpsDeltaY;
teteDeltaY = corpsDeltaY * 0.3;
tete._y = (_root.yTete + corpsDeltaY) + teteDeltaY;
posBrasDroitVolant = rayonVolant * Math.sin((Math.abs(2 * wheelRotation) * Math.PI) / (2 * maxWheelAngle));
posBrasGaucheVolant = rayonVolant * Math.sin((Math.abs(2 * wheelRotation) * Math.PI) / (2 * maxWheelAngle));
setBrasRotation();
}
if (!replayPlay) {
replayRecFrame = replayRecFrame + 1;
}
pneuFrame++;
}
}
Instance of Symbol 38 MovieClip "flocons" in Frame 1
onClipEvent (load) {
frames = 60;
nbFloconsPerFrame = 1;
nbFlocons = frames * nbFloconsPerFrame;
tailleMin = 1;
tailleMax = 5;
floconsTab = new Array();
i = 0;
while (i < frames) {
floconsTab[i] = new Array();
j = 0;
while (j < nbFloconsPerFrame) {
flocon.duplicateMovieClip("flocon" + ((i * nbFloconsPerFrame) + j), 1 + ((i * nbFloconsPerFrame) + j));
clip = _root.flocons["flocon" + ((i * nbFloconsPerFrame) + j)];
floconsTab[i][j] = {x:random(800), y:random(800), alpha:random(100), taille:tailleMin + random(tailleMax), clip:clip};
j++;
}
i++;
}
frameInd = 0;
}
onClipEvent (enterFrame) {
j = 0;
while (j < nbFloconsPerFrame) {
tmp = floconsTab[frameInd][j];
tmp.clip._x = tmp.x;
tmp.clip._y = tmp.y;
tmp.clip._alpha = tmp.alpha;
tmp.alpha = tmp.alpha + 5;
if (tmp.alpha > 100) {
tmp.alpha = 5;
}
tmp.x = tmp.x + (15 - random(30));
tmp.y = tmp.y + (15 - random(30));
if (tmp.x > 800) {
tmp.x = tmp.x - 800;
} else if (tmp.x < 0) {
tmp.x = tmp.x + 800;
}
if (tmp.y > 800) {
tmp.y = tmp.y - 800;
} else if (tmp.y < 0) {
tmp.y = tmp.y + 800;
}
j++;
}
frameInd++;
if (frameInd == frames) {
frameInd = 0;
}
}
Instance of Symbol 112 MovieClip "menuder" in Frame 1
onClipEvent (enterFrame) {
if (initDone && (openDone)) {
}
}
Instance of Symbol 125 MovieClip "message" in Frame 1
onClipEvent (load) {
var messagetext;
}
Instance of Symbol 27 MovieClip "tete" in Symbol 34 MovieClip Frame 1
onClipEvent (load) {
oscilator = 0;
fils = new Array();
color = 16711680 /* 0xFF0000 */;
largeur = 3;
fils[0] = {x:-7, y:-1, tx:-7, ty:-2, fx:-8, fy:-3, r:20, color:color, largeur:largeur};
fils[1] = {x:-7, y:1, tx:-7, ty:2, fx:-8, fy:3, r:20, color:color, largeur:largeur};
nbFils = 2;
memoP = {x:_x, y:_y};
localToGlobal(memoP);
}
onClipEvent (enterFrame) {
p = {x:_x, y:_y};
localToGlobal(p);
vitesse = {x:p.x - memoP.x, y:p.y - memoP.y};
vitessePol = _root.voitureverte.getPolaire(vitesse);
if (vitessePol.d > 20) {
vitessePol.d = 20;
}
vitessePol.a = vitessePol.a + Math.PI;
rapport = vitessePol.d / 3;
angleRelatif = vitessePol.a - ((_root.voitureverte._rotation * Math.PI) / 180);
_root.voitureverte.createEmptyMovieClip("fils", 102);
filsClip = _root.voitureverte.fils;
filsClip.lineStyle(2, 16711680, 100);
ray = 6;
rayonVit = ray * rapport;
angleOscil = Math.cos((oscilator * Math.PI) / 180) / 10;
diam1 = {x:_x + (ray * Math.cos(angleRelatif - (Math.PI/2))), y:_y + (ray * Math.sin(angleRelatif - (Math.PI/2)))};
diam2 = {x:_x + (ray * Math.cos(angleRelatif + (Math.PI/2))), y:_y + (ray * Math.sin(angleRelatif + (Math.PI/2)))};
ponpon = {x:(_x + (2 * Math.cos(angleRelatif))) + (rayonVit * Math.cos(angleRelatif + angleOscil)), y:(_y + (2 * Math.sin(angleRelatif))) + (rayonVit * Math.sin(angleRelatif + angleOscil))};
ponponIn = {x:ponpon.x - _x, y:ponpon.y - _y};
if (((ponponIn.x * ponponIn.x) + (ponponIn.y * ponponIn.y)) > (ray * ray)) {
filsClip.beginFill(16777215);
filsClip.moveTo(diam1.x, diam1.y);
filsClip.lineTo(ponpon.x, ponpon.y);
filsClip.lineTo(diam2.x, diam2.y);
i = 0;
while (i < 6) {
filsClip.lineTo(_x + (ray * Math.cos((angleRelatif + (Math.PI/2)) + ((Math.PI * (i + 1)) / 6))), _y + (ray * Math.sin((angleRelatif + (Math.PI/2)) + ((Math.PI * (i + 1)) / 6))));
i++;
}
filsClip.endFill();
} else {
angleRelatif = -3.14159265358979;
ponpon = {x:(_x + (2 * Math.cos(angleRelatif))) + (rayonVit * Math.cos(angleRelatif + angleOscil)), y:(_y + (2 * Math.sin(angleRelatif))) + (rayonVit * Math.sin(angleRelatif + angleOscil))};
}
_root.voitureverte.pompon._x = ponpon.x;
_root.voitureverte.pompon._y = ponpon.y;
oscilator = oscilator + (1 + (vitessePol.d * 4));
memoP = p;
}
Symbol 62 MovieClip Frame 15
stop();
var seschocs = _root.voitureverte.chocs;
var sonart = _root.voitureverte.noteArtistiqueFinale;
var sonscore = Math.ceil(_root.voitureverte.score * 100);
var sontemps = _root.elapsedTime;
if (seschocs < 0) {
chocs.text = "";
} else if (seschocs < 2) {
chocs.text = (newline + seschocs) + " choc\n";
} else {
chocs.text = (newline + seschocs) + " chocs\n";
}
score.text = "score : " + (sonscore / 100);
var position = -1;
var total = -1;
var parcoursenr = 0;
enregistrer.onPress = function () {
_root.showButtons(false);
gotoAndPlay (16);
myVar = new LoadVars();
myVar.seschocs = seschocs;
myVar.sonart = sonart;
myVar.sonscore = sonscore;
myVar.sontemps = sontemps;
myVar.sonnom = sonnom;
myVar.sonsite = sonsite;
myVar.fc = _root.voitureverte.forceChocs;
myVar.position = -1;
myVar.total = -1;
myVar.sendAndLoad("neige.php", myVar, "POST");
myVar.onLoad = function () {
position = this.position;
total = this.total;
if (this.askparcours == 1) {
_root.message.messagetext = "Enregistrement\ndu parcours";
_root.message.gotoAndPlay(2);
myParcours = new LoadVars();
myParcours.sonnom = sonnom;
myParcours.sonscore = sonscore;
myParcours.parcours = "1.01_";
tmpA = new Array();
i = 0;
while (i < _root.voitureverte.replayRecEventsIndex) {
tmpA[i] = {clef:(_root.voitureverte.replayEvents[i].updown + "_") + _root.getAlphaNum(_root.voitureverte.replayEvents[i].keycode), framenb:_root.voitureverte.replayEvents[i].framenb};
i++;
}
tmpA.sortOn(["clef", "framenb"], Array.NUMERIC);
theCurrentKey = "";
i = 0;
while (i < _root.voitureverte.replayRecEventsIndex) {
key = tmpA[i].clef;
if (key != theCurrentKey) {
if (theCurrentKey != "") {
myParcours.parcours = myParcours.parcours + "!";
}
theCurrentKey = key;
myParcours.parcours = myParcours.parcours + ((theCurrentKey + "_") + _root.getAlphaNum(tmpA[i].framenb));
} else {
myParcours.parcours = myParcours.parcours + ("_" + _root.getAlphaNum(tmpA[i].framenb - tmpA[i - 1].framenb));
}
i++;
}
tmpA = new Array();
myParcours.sendAndLoad("neige.php", myParcours, "POST");
myParcours.onLoad = function () {
parcoursenr = this.parcoursenr;
_root.replayos.gotoAndPlay(2);
_root.showButtons(true);
};
} else {
_root.replayos.gotoAndPlay(2);
_root.showButtons(true);
}
};
};
Symbol 62 MovieClip Frame 30
_visible = false;
stop();
Symbol 70 MovieClip Frame 1
_visible = false;
stop();
Symbol 70 MovieClip Frame 2
_visible = true;
Symbol 70 MovieClip Frame 15
stop();
classement.text = "";
if ((_root.gagnos.position > 0) && (_root.gagnos.total > 0)) {
if (_root.gagnos.position == 1) {
eme = "er";
} else {
eme = "\u00E8me";
}
classement.text = (((_root.gagnos.position + "") + eme) + " sur ") + _root.gagnos.total;
}
goreplay.onPress = function () {
gotoAndPlay (16);
_root.voitureverte.startReplayPlay();
};
Symbol 70 MovieClip Frame 30
_visible = false;
stop();
Symbol 73 MovieClip Frame 1
onRollOut = function () {
_root.menuder.gotoAndPlay(1);
};
onRollOver = function () {
_root.menuder.gotoAndPlay(2);
};
onPress = function () {
_root.menuder.gotoAndPlay(8);
};
Symbol 90 MovieClip Frame 15
gotoAndPlay (1);
Symbol 103 MovieClip Frame 1
stop();
Symbol 103 MovieClip Frame 4
gotoAndPlay (2);
Symbol 106 MovieClip Frame 1
stop();
Symbol 106 MovieClip Frame 4
gotoAndPlay (2);
Symbol 109 MovieClip Frame 1
stop();
onRollOut = function () {
gotoAndPlay (1);
};
onRollOver = function () {
gotoAndPlay (2);
};
onPress = function () {
_root.menuder.theparcours.loadModelAndPlay(theindice);
stop();
};
coupcoeur.gotoAndPlay(1);
coupcoeur._visible = thecoeur;
nouv.gotoAndPlay(1);
nouv._visible = thenouv;
parcourstexte.text = thetext;
Symbol 109 MovieClip Frame 2
onRollOut = function () {
gotoAndPlay (1);
};
onRollOver = function () {
};
onPress = function () {
_root.menuder.theparcours.loadModelAndPlay(theindice);
stop();
};
coupcoeur.gotoAndPlay(2);
coupcoeur._visible = thecoeur;
nouv.gotoAndPlay(2);
nouv._visible = thenouv;
parcourstexte.text = thetext;
Symbol 109 MovieClip Frame 7
stop();
onPress = function () {
_root.menuder.theparcours.loadModelAndPlay(theindice);
stop();
};
coupcoeur._visible = thecoeur;
nouv._visible = thenouv;
parcourstexte.text = thetext;
Instance of Symbol 109 MovieClip "themodel1" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
var thecoeur;
var thenouv;
}
Instance of Symbol 109 MovieClip "themodel2" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
}
Instance of Symbol 109 MovieClip "themodel10" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
}
Instance of Symbol 109 MovieClip "themodel9" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
}
Instance of Symbol 109 MovieClip "themodel8" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
}
Instance of Symbol 109 MovieClip "themodel7" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
}
Instance of Symbol 109 MovieClip "themodel6" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
}
Instance of Symbol 109 MovieClip "themodel5" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
}
Instance of Symbol 109 MovieClip "themodel4" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
}
Instance of Symbol 109 MovieClip "themodel3" in Symbol 110 MovieClip Frame 1
onClipEvent (load) {
var thetext;
var theindice;
}
Symbol 112 MovieClip Frame 1
initDone = false;
openDone = false;
index = 0;
parcoursArray = new Array();
stop();
Symbol 112 MovieClip Frame 2
initDone = false;
openDone = false;
Symbol 112 MovieClip Frame 7
gotoAndPlay (2);
Symbol 112 MovieClip Frame 8
_root.showButtons(false);
_root.chrono._visible = false;
_root.replayos._alpha = 30;
_root.gagnos.position = 0;
_root.gagnos.total = 0;
_root.aidetimestart = -1;
initDone = false;
openDone = false;
parcoursArray = new Array();
index = 0;
demandeParcours = new LoadVars();
demandeParcours.action = "allparcours";
demandeParcours.sendAndLoad("pneige.php", demandeParcours, "POST");
demandeParcours.onLoad = function () {
occurence = -1;
while (occurence != -2) {
occurence1 = this.allparcours.indexOf("_", occurence);
occurence2 = this.allparcours.indexOf("_", occurence1 + 1);
score = this.allparcours.substring(occurence, occurence1);
if (occurence2 == -1) {
nom = this.allparcours.substring(occurence1 + 1);
occurence = -2;
} else if (occurence2 == undefined) {
nom = "Echec";
score = "0";
occurence = -2;
} else {
nom = this.allparcours.substring(occurence1 + 1, occurence2);
occurence = occurence2 + 1;
}
if (score.substring(0, 1) == "#") {
score = score.substring(1);
coeur = true;
} else {
coeur = false;
}
if (score.substring(0, 1) == "N") {
score = score.substring(1);
nouv = true;
} else {
nouv = false;
}
parcoursArray[index] = new Array(nom, score, coeur, nouv);
index = index + 1;
}
initDone = true;
};
Symbol 112 MovieClip Frame 44
openDone = true;
closemenu.onPress = function () {
gotoAndPlay (45);
};
stop();
Instance of Symbol 110 MovieClip "theparcours" in Symbol 112 MovieClip Frame 44
onClipEvent (load) {
function models() {
if (!loadingparcours) {
indFirst = Math.round((-yFirst) / 30);
decal = (-yFirst) - (indFirst * 30);
max = 10;
if (objectNumber < 10) {
max = objectNumber;
}
i = 0;
while (i < max) {
objet = this["themodel" + (i + 1)];
objet._visible = true;
objet.theindice = indFirst + i;
objet.thetext = objectList[objet.theindice];
objet.thecoeur = _root.menuder.parcoursArray[objet.theindice][2];
objet.coupcoeur._visible = objet.thecoeur;
objet.thenouv = _root.menuder.parcoursArray[objet.theindice][3];
objet.nouv._visible = objet.thenouv;
objet.parcourstexte.text = objet.thetext;
objet._y = (30 * i) - decal;
i++;
}
i = max + 1;
while (i < 10) {
objet = this["themodel" + (i + 1)];
objet._visible = false;
i++;
}
}
}
function loadModelAndPlay(ind) {
loadingparcours = true;
_root.menuder.closemenu._visible = false;
i = 0;
while (i < 10) {
objet = this["themodel" + (i + 1)];
objet._visible = false;
i++;
}
demandeParcours = new LoadVars();
demandeParcours.action = "oneparcours";
demandeParcours.sonnom = _root.menuder.parcoursArray[ind][0];
demandeParcours.sonscore = _root.menuder.parcoursArray[ind][1];
demandeParcours.sendAndLoad("pneige.php", demandeParcours, "POST");
demandeParcours.onLoad = function () {
occurence = this.sonparcours.indexOf("_", 0);
version = this.sonparcours.substring(0, occurence);
_root.voitureverte.initReplayRec();
if ((version == "1.00") && (occurence != -1)) {
occurence = occurence + 1;
while (occurence != -2) {
occurence1 = this.sonparcours.indexOf("_", occurence);
occurence2 = this.sonparcours.indexOf("_", occurence1 + 1);
occurence3 = this.sonparcours.indexOf("_", occurence2 + 1);
frame = this.sonparcours.substring(occurence, occurence1);
updown = this.sonparcours.substring(occurence1 + 1, occurence2);
if (occurence3 == -1) {
key = this.sonparcours.substring(occurence2 + 1);
occurence = -2;
} else {
key = this.sonparcours.substring(occurence2 + 1, occurence3);
occurence = occurence3 + 1;
}
_root.voitureverte.replayEvents[_root.voitureverte.replayRecEventsIndex] = {framenb:frame, updown:updown, keycode:key};
_root.voitureverte.replayRecEventsIndex = _root.voitureverte.replayRecEventsIndex + 1;
}
_root.voitureverte.startReplayPlay();
} else if ((version == "1.01") && (occurence != -1)) {
occurence = occurence + 1;
while (occurence != 0) {
occurence1 = this.sonparcours.indexOf("!", occurence);
if (occurence1 == -1) {
keysequence = this.sonparcours.substring(occurence);
} else {
keysequence = this.sonparcours.substring(occurence, occurence1);
}
occurence2 = keysequence.indexOf("_", 0);
var updown = keysequence.substring(0, occurence2);
occurence2++;
occurence3 = keysequence.indexOf("_", occurence2);
var key = _root.getNumber(keysequence.substring(occurence2, occurence3));
occurence3++;
var frame = -1;
while (occurence3 != 0) {
occurence4 = keysequence.indexOf("_", occurence3);
if (occurence4 == -1) {
tmpframe = _root.getNumber(keysequence.substring(occurence3));
} else {
tmpframe = _root.getNumber(keysequence.substring(occurence3, occurence4));
}
if (frame == -1) {
frame = tmpframe;
} else {
frame = frame + tmpframe;
}
_root.voitureverte.replayEvents[_root.voitureverte.replayRecEventsIndex] = {framenb:frame, updown:updown, keycode:key};
_root.voitureverte.replayRecEventsIndex = _root.voitureverte.replayRecEventsIndex + 1;
occurence3 = occurence4 + 1;
}
occurence = occurence1 + 1;
}
_root.voitureverte.replayEvents.sortOn("framenb", Array.NUMERIC);
_root.voitureverte.startReplayPlay();
} else {
_root.message.messagetext = "\nECHEC :(";
_root.message.gotoAndPlay(2);
}
_root.menuder.gotoAndPlay(45);
};
}
loadingparcours = false;
initDone = false;
objectList = new Array();
objectNumber = 0;
incy = 0;
yFirst = 0;
listeHeight = 0;
closemenu._visible = true;
i = 0;
while (i < 10) {
objet = this["themodel" + (i + 1)];
objet._visible = false;
i++;
}
}
onClipEvent (unload) {
}
onClipEvent (enterFrame) {
if (initDone == false) {
if (_root.menuder.initDone && (_root.menuder.openDone)) {
initDone = true;
titre.text = "Liste des parcours";
objectNumber = _root.menuder.index;
listeHeight = (objectNumber + 1) * 30;
i = 0;
while (i < objectNumber) {
scoretmp = _root.menuder.parcoursArray[i][1] / 100;
nomtmp = _root.menuder.parcoursArray[i][0];
objectList[i] = (nomtmp + " ") + scoretmp;
i++;
}
} else {
titre.text = "Chargement...";
}
} else {
if (objectNumber > 9) {
if ((_ymouse - 150) > 0) {
incy = (-(_ymouse - 150)) / 5;
} else if ((_ymouse - 120) < 0) {
incy = (-(_ymouse - 120)) / 5;
} else {
incy = 0;
}
} else {
incy = 0;
}
if (incy > 100) {
incy = 100;
} else if (incy < -100) {
incy = -100;
}
oldYFirst = yFirst;
yFirst = yFirst + incy;
if (yFirst >= 0) {
yFirst = 0;
} else if ((yFirst + listeHeight) < 300) {
yFirst = 300 - listeHeight;
}
models();
}
}
Symbol 112 MovieClip Frame 45
_root.replayos._alpha = 100;
Symbol 112 MovieClip Frame 60
initDone = false;
_root.showButtons(true);
_root.chrono._visible = true;
gotoAndPlay (1);
Symbol 115 MovieClip Frame 15
stop();
Symbol 118 MovieClip Frame 40
gotoAndPlay (1);
Symbol 125 MovieClip Frame 1
stop();
Symbol 125 MovieClip Frame 10
msg.text = messagetext;
Symbol 125 MovieClip Frame 41
msg.text = messagetext;
Symbol 129 MovieClip Frame 1
stop();
onRollOut = function () {
gotoAndPlay (1);
};
onRollOver = function () {
gotoAndPlay (2);
};
Symbol 129 MovieClip Frame 5
gotoAndPlay (2);
Symbol 134 MovieClip Frame 1
stop();
onRollOut = function () {
gotoAndPlay (1);
};
onRollOver = function () {
gotoAndPlay (2);
};
Symbol 134 MovieClip Frame 5
gotoAndPlay (2);
Symbol 138 MovieClip Frame 1
stop();
onRollOut = function () {
gotoAndPlay (1);
};
onRollOver = function () {
gotoAndPlay (2);
};
Symbol 138 MovieClip Frame 5
gotoAndPlay (2);