Frame 1
function clignement() {
if (clignementframe > clignementnext) {
clignementframe = 0;
clignementnext = random(clignementmax - clignementmin) + clignementmin;
player.oeil.gotoAndPlay(1);
}
}
function getWR() {
}
function displayScore() {
lacentaine = Math.floor(compteur / 100);
ladizaine = Math.floor((compteur - (lacentaine * 100)) / 10);
lunite = Math.floor(((compteur - (lacentaine * 100)) - (ladizaine * 10)) / 1);
unites.gotoAndStop(lunite + 1);
dizaines.gotoAndStop(ladizaine + 1);
centaines.gotoAndStop(lacentaine + 1);
}
function initBall() {
i = 0;
while (i < nbPoints) {
ballPoints[i] = {x:rayon * Math.cos(((Math.PI*2) * i) / nbPoints), y:rayon * Math.sin(((Math.PI*2) * i) / nbPoints)};
i++;
}
theBall = ballon;
nbPointsBarre = 8;
i = 0;
while (i < nbBarres) {
barrePoints[i] = new Array();
j = 0;
while (j < nbPointsBarre) {
barrePoints[i][j] = {x:barres[i].x + (barres[i].r * Math.cos(((Math.PI*2) * j) / nbPointsBarre)), y:barres[i].y + (barres[i].r * Math.sin(((Math.PI*2) * j) / nbPointsBarre))};
j++;
}
i++;
}
barre1._x = barres[0].x;
barre2._x = barres[1].x;
barre1._y = barres[0].y;
barre2._y = barres[1].y;
createEmptyMovieClip("basket", 2);
theBasket = this.basket;
}
function loadModelAndPlay(nom, score) {
demandeParcours = new LoadVars();
demandeParcours.action = "oneparcours";
demandeParcours.sonnom = nom;
demandeParcours.sonscore = score;
demandeParcours.sendAndLoad("prebond.php", demandeParcours, "POST");
demandeParcours.onLoad = function () {
occurence = this.sonparcours.indexOf("_", 0);
version = this.sonparcours.substring(0, occurence);
if ((version == "1.02") && (occurence != -1)) {
initreplays();
tmpindex = 0;
frameindex = 0;
theX = 0;
theY = 0;
occurence = occurence + 1;
while (occurence != 0) {
souris = false;
if (this.sonparcours.substring(occurence, occurence + 1) == "!") {
souris = true;
occurence++;
occurence1 = this.sonparcours.indexOf("_", occurence);
tmpnum = Number(this.sonparcours.substring(occurence, occurence1));
if ((occurence1 != -1) && ((tmpnum + "") != "NaN")) {
frameindex = frameindex + tmpnum;
occurence = occurence1 + 1;
} else {
occurence = -1;
}
}
launch = false;
if (occurence != -1) {
if (this.sonparcours.substring(occurence, occurence + 1) == "@") {
launch = true;
occurence++;
}
}
if (occurence != -1) {
occurence1 = this.sonparcours.indexOf("_", occurence);
} else {
occurence1 = -1;
}
if (occurence1 != -1) {
occurence2 = this.sonparcours.indexOf("_", occurence1 + 1);
} else {
occurence2 = -1;
}
if (launch == true) {
if (occurence2 != -1) {
occurence3 = this.sonparcours.indexOf("_", occurence2 + 1);
} else {
occurence3 = -1;
}
if (occurence3 != -1) {
occurence4 = this.sonparcours.indexOf("_", occurence3 + 1);
} else {
occurence4 = -1;
}
if (occurence3 != -1) {
xtext = this.sonparcours.substring(occurence, occurence1);
ytext = this.sonparcours.substring(occurence1 + 1, occurence2);
vxtext = this.sonparcours.substring(occurence2 + 1, occurence3);
if (occurence4 == -1) {
vytext = this.sonparcours.substring(occurence3 + 1);
} else {
vytext = this.sonparcours.substring(occurence3 + 1, occurence4);
}
}
occurence = occurence4 + 1;
} else {
if (occurence1 != -1) {
xtext = this.sonparcours.substring(occurence, occurence1);
if (occurence2 == -1) {
ytext = this.sonparcours.substring(occurence1 + 1);
} else {
ytext = this.sonparcours.substring(occurence1 + 1, occurence2);
}
vxtext = "0";
vytext = "0";
}
occurence = occurence2 + 1;
}
theX = theX + (getNumber(xtext) / 100);
(theY = theY + (getNumber(ytext) / 100));
(replayShoots[tmpindex] = {f:frameindex, l:launch, s:souris, x:theX, y:theY, vx:getNumber(vxtext) / 100, vy:getNumber(vytext) / 100});
tmpindex++;
frameindex++;
}
_root.listreplays.gotoAndPlay(16);
replay();
} else {
_root.listreplays.registered.text = "Load failed";
}
};
}
function getAlphaNum(number) {
if (number < 0) {
signe = "-";
number = -number;
} else {
signe = "";
}
toReturn = "";
while (number > 0) {
lunite = number % baseAlphaNum;
if (lunite < 10) {
toReturn = String.fromCharCode(lunite + 48) + toReturn;
} else if (lunite < 36) {
toReturn = String.fromCharCode(lunite + 55) + toReturn;
} else {
toReturn = String.fromCharCode(lunite + 61) + toReturn;
}
number = (number - lunite) / baseAlphaNum;
}
return((signe + "") + toReturn);
}
function getNumber(alphanum) {
if (alphanum.substring(0, 1) == "-") {
nsigne = -1;
} else {
nsigne = 1;
}
toReturn = 0;
l = alphanum.length;
i = 0;
while (i < l) {
lunite = alphanum.charCodeAt(i);
if ((lunite >= 48) && (lunite < 58)) {
toReturn = ((toReturn * baseAlphaNum) + lunite) - 48;
} else if ((lunite >= 65) && (lunite < 91)) {
toReturn = ((toReturn * baseAlphaNum) + lunite) - 55;
} else if ((lunite >= 97) && (lunite < 123)) {
toReturn = ((toReturn * baseAlphaNum) + lunite) - 61;
}
i++;
}
return(nsigne * 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 drawBasket(theObject) {
i = 0;
while (i < nbBPts) {
lBPts[i].obj._x = lBPts[i].x;
lBPts[i].obj._y = lBPts[i].y;
rBPts[i].obj._x = rBPts[i].x;
rBPts[i].obj._y = rBPts[i].y;
i++;
}
}
function computeBasket() {
lforce = new Array();
rforce = new Array();
i = 1;
while (i < nbBPts) {
diff = {x:rBPts[i].x - lBPts[i].x, y:rBPts[i].y - lBPts[i].y};
dcarre = (diff.x * diff.x) + (diff.y * diff.y);
d = Math.sqrt(dcarre);
deltad = d - forceBPts[i].d;
if (d > 0) {
lforce[i] = {x:(deltad * diff.x) / d, y:(deltad * diff.y) / d};
} else {
lforce[i] = {x:0, y:0};
}
if (deltad > 0) {
lforce[i] = {x:lforce[i].x * forceBPts[i].pullit, y:lforce[i].y * forceBPts[i].pullit};
} else {
lforce[i] = {x:lforce[i].x * forceBPts[i].pushit, y:lforce[i].y * forceBPts[i].pushit};
}
rforce[i] = {x:-lforce[i].x, y:-lforce[i].y};
ldiff = {x:lBPts[i].x - lBPts[i - 1].x, y:lBPts[i].y - lBPts[i - 1].y};
ldcarre = (ldiff.x * ldiff.x) + (ldiff.y * ldiff.y);
ld = Math.sqrt(ldcarre);
ldeltad = ld - dPoints;
force = {x:0, y:0};
if ((ldeltad > 0) && (ld > 0)) {
force = {x:(ldeltad * ldiff.x) / ld, y:(ldeltad * ldiff.y) / ld};
force = {x:force.x * coefforce, y:force.y * coefforce};
}
lforce[i - 1].x = lforce[i - 1].x + force.x;
lforce[i - 1].y = lforce[i - 1].y + force.y;
lforce[i].x = lforce[i].x + (-force.x);
lforce[i].y = lforce[i].y + ((-force.y) + g);
rdiff = {x:rBPts[i].x - rBPts[i - 1].x, y:rBPts[i].y - rBPts[i - 1].y};
rdcarre = (rdiff.x * rdiff.x) + (rdiff.y * rdiff.y);
rd = Math.sqrt(rdcarre);
rdeltad = rd - dPoints;
force = {x:0, y:0};
if ((rdeltad > 0) && (rd > 0)) {
force = {x:(rdeltad * rdiff.x) / rd, y:(rdeltad * rdiff.y) / rd};
force = {x:force.x * coefforce, y:force.y * coefforce};
}
rforce[i - 1].x = rforce[i - 1].x + force.x;
rforce[i - 1].y = rforce[i - 1].y + force.y;
rforce[i].x = rforce[i].x + (-force.x);
rforce[i].y = rforce[i].y + ((-force.y) + g);
i++;
}
i = 1;
while (i < nbBPts) {
lBPts[i].vx = lBPts[i].vx + lforce[i].x;
lBPts[i].vy = lBPts[i].vy + lforce[i].y;
rBPts[i].vx = rBPts[i].vx + rforce[i].x;
rBPts[i].vy = rBPts[i].vy + rforce[i].y;
newx = lBPts[i].x + lBPts[i].vx;
newy = lBPts[i].y + lBPts[i].vy;
lBPts[i].vx = newx - lBPts[i].x;
lBPts[i].x = newx;
lBPts[i].vy = newy - lBPts[i].y;
lBPts[i].y = newy;
newx = rBPts[i].x + rBPts[i].vx;
newy = rBPts[i].y + rBPts[i].vy;
rBPts[i].vx = newx - rBPts[i].x;
rBPts[i].x = newx;
rBPts[i].vy = newy - rBPts[i].y;
rBPts[i].y = newy;
lBPts[i].vx = lBPts[i].vx * bdecay;
lBPts[i].vy = lBPts[i].vy * bdecay;
rBPts[i].vx = rBPts[i].vx * bdecay;
rBPts[i].vy = rBPts[i].vy * bdecay;
i++;
}
contreBallon = {x:0, y:0};
frotBasket = 1;
i = 1;
while (i < nbBPts) {
ldiff = {x:lBPts[i].x - center.x, y:lBPts[i].y - center.y};
ldcarre = (ldiff.x * ldiff.x) + (ldiff.y * ldiff.y);
if (ldcarre < (rayonc * rayonc)) {
ldiffpol = getPolaire({x:lBPts[i].x - center.x, y:lBPts[i].y - center.y});
lBPts[i].x = center.x + (rayonc * Math.cos(ldiffpol.a));
lBPts[i].y = center.y + (rayonc * Math.sin(ldiffpol.a));
retour = rayonc - ldiffpol.d;
contreBallon.x = contreBallon.x + ((contreBallonCoef * retour) * Math.cos(ldiffpol.a + Math.PI));
contreBallon.y = contreBallon.y + ((contreBallonCoef * retour) * Math.sin(ldiffpol.a + Math.PI));
frotBasket = frotBasket - quantaFrotBasket;
}
rdiff = {x:rBPts[i].x - center.x, y:rBPts[i].y - center.y};
rdcarre = (rdiff.x * rdiff.x) + (rdiff.y * rdiff.y);
if (rdcarre < (rayonc * rayonc)) {
rdiffpol = getPolaire({x:rBPts[i].x - center.x, y:rBPts[i].y - center.y});
rBPts[i].x = center.x + (rayonc * Math.cos(rdiffpol.a));
rBPts[i].y = center.y + (rayonc * Math.sin(rdiffpol.a));
retour = rayonc - rdiffpol.d;
contreBallon.x = contreBallon.x + ((contreBallonCoef * retour) * Math.cos(rdiffpol.a + Math.PI));
contreBallon.y = contreBallon.y + ((contreBallonCoef * retour) * Math.sin(rdiffpol.a + Math.PI));
frotBasket = frotBasket - quantaFrotBasket;
}
i++;
}
}
function drawBezier(aPt, theObject, bC, fC, largeur) {
var _local5 = new Array();
var _local2 = 0;
while (_local2 < aPt.length) {
var _local6 = (aPt[_local2].x + aPt[(_local2 + 1) % aPt.length].x) / 2;
var _local7 = (aPt[_local2].y + aPt[(_local2 + 1) % aPt.length].y) / 2;
_local5.push({x:_local6, y:_local7});
_local2++;
}
theObject.lineStyle(largeur, bC, 100);
theObject.beginFill(fC, 100);
theObject.moveTo(_local5[0].x, _local5[0].y);
var _local4 = 1;
while (_local4 <= aPt.length) {
var _local3 = _local4 % aPt.length;
theObject.curveTo(aPt[_local3].x, aPt[_local3].y, _local5[_local3].x, _local5[_local3].y);
_local4++;
}
theObject.endFill();
}
function setRotOeil() {
vectOeilBallon = {x:center.x - oeilCoord.x, y:center.y - oeilCoord.y};
polOeilBallon = getPolaire(vectOeilBallon);
rotOeil = (polOeilBallon.a * 180) / Math.PI;
if (rotOeil < oeilRotMin) {
rotOeil = oeilRotMin;
} else if (rotOeil > oeilRotMax) {
rotOeil = oeilRotMax;
}
player.oeil._rotation = rotOeil;
}
function sourisOut(b) {
_root.sourisback._visible = false;
if (b) {
if ((state == PLAY) || (state == REPLAY)) {
Mouse.show();
_root.sourisout._visible = b;
}
_root.souris._visible = false;
} else {
_root.sourisout._visible = b;
if (state == PLAY) {
Mouse.hide();
if (mouseControl == 0) {
_root.souris._visible = true;
}
}
}
}
function setNoMouseControl() {
mouseControl = 0;
_root.souris.gotoAndPlay(2);
_root.souris._visible = true;
}
function setMouseControl() {
if (mouseControl == 0) {
if (!inBasket) {
aLechec++;
}
}
mouseControl = 1;
_root.souris.gotoAndStop(1);
_root.souris._visible = false;
inBasket = false;
inCerceau = false;
oneShotChoc = false;
}
function launchReplays() {
stopit();
startbtn._visible = false;
Mouse.show();
state = REPLAYS;
listreplays.gotoAndPlay(2);
wrdisplay.replaybtn._visible = false;
wrdisplay.replaybtn.gotoAndStop(1);
}
function replaysOut() {
stopit();
wrdisplay.replaybtn._visible = true;
wrdisplay.replaybtn.gotoAndStop(1);
getWR();
}
function initReplays() {
replayShoots = new Array();
indexReplay = 0;
frameReplay = 0;
phaseLancer = PHASELANCERMAX;
}
function replay() {
initPartie();
countdownframe = countdownframemax;
countdownhappyhour = 0;
stopHappy();
displayCountdown();
indexReplay = 0;
frameReplay = 0;
phaseLancer = PHASELANCERMAX;
wrdisplay.replaybtn._visible = true;
wrdisplay.replaybtn.gotoAndPlay(3);
state = REPLAY;
startbtn._visible = false;
countdown._visible = true;
countdown.gotoAndStop(1);
}
function registerout() {
wrdisplay.replaybtn._visible = true;
wrdisplay.replaybtn.gotoAndStop(1);
stopit();
getWR();
}
function countisdown() {
if (state == REPLAY) {
Mouse.show();
state = REGISTER;
countdown._visible = false;
wrdisplay.replaybtn._visible = false;
_root.register.wait = false;
_root.register._visible = true;
_root.register.themessage.text = "";
_root.register.txtmsg = "";
_root.register.gotoAndPlay(16);
} else if (state == PLAY) {
if ((aLaSuite > minScoreRegister) && (pepere)) {
Mouse.show();
state = REGISTER;
countdown._visible = false;
wrdisplay.replaybtn._visible = false;
minScoreRegister = aLaSuite - 1;
_root.register.themessage.text = "";
_root.register.txtmsg = "";
_root.register.gotoAndPlay(2);
} else {
Mouse.show();
state = REGISTER;
countdown._visible = false;
wrdisplay.replaybtn._visible = false;
_root.register.wait = false;
_root.register._visible = true;
_root.register.txtmsg = "";
if (!pepere) {
_root.register.txtmsg = "You can only register\non official website\nwww.pepere.org";
}
_root.register.gotoAndPlay(16);
}
}
}
function stopit() {
initPartie();
initReplays();
wrdisplay.replaybtn._visible = true;
wrdisplay.replaybtn.gotoAndStop(1);
countdownframe = countdownframemax;
countdownhappyhour = 0;
stopHappy();
state = STOPPED;
displayCountdown();
startbtn._visible = true;
countdown.gotoAndPlay(1);
countdown._visible = false;
inBasket = false;
inCerceau = false;
oneShotChoc = false;
Mouse.show();
}
function initPartie() {
aLechec = 0;
aLaPerfection = 0;
aLesChocs = 0;
aLaSuite = 0;
compteur = 0;
compteurTempo = 0;
unites.play();
dizaines.play();
centaines.play();
}
function reinit() {
if (state == PLAY) {
if (mouseControl == 1) {
justMouseControl = true;
center = {x:coordMin + ((_xmouse - coordMin) * demult), y:coordMaxy - ((coordMaxy - _ymouse) * demult)};
}
}
}
function startit() {
state = PLAY;
startbtn.gotoAndPlay(1);
startbtn._visible = false;
countdown._visible = true;
countdown.gotoAndStop(1);
Mouse.hide();
setMouseControl();
reinit();
}
function displayCountdown() {
tmptimer = Math.ceil(countdownframe / 30);
countdown.timer.text = "" + tmptimer;
if (tmptimer < 10) {
countdown.gotoAndPlay(2);
}
if (countdownhappyhour > 0) {
happy._visible = true;
happyrapport = (countdownhappyhourmax - countdownhappyhour) / countdownhappyhourmax;
happy.cachehappy._y = 205 * happyrapport;
} else {
happy._visible = false;
}
}
function stopHappy() {
_root.bords.gotoAndStop(1);
_root.ballon.gotoAndStop(1);
}
function startHappy() {
_root.bords.gotoAndStop(2);
_root.ballon.gotoAndStop(2);
}
stop();
var minScoreRegister = 0;
_root.debug._visible = false;
var clignementframe = 0;
var clignementmin = 1;
var clignementmax = 20;
var clignementnext = 20;
var oeilRotMin = -25;
var oeilRotMax = 45;
oeilCoord = {x:0, y:0};
_root.player.oeil.localToGlobal(oeilCoord);
var PLAY = 0;
var REGISTER = 1;
var REPLAYLIST = 2;
var REPLAY = 3;
var STOPPED = 4;
var COUNTDOWN = 5;
var state = STOPPED;
var countdownframemax = 1800;
var countdownhappyhourmax = 300;
var globalTry = 0;
var globalSuccess = 0;
var globalWR = -1;
var pepere = false;
getWR();
var ballPoints = new Array();
var nbPoints = 16;
var rayon = 22;
var rayonc = 24;
var center = {x:ballon._x, y:ballon._y};
var memoCenter = center;
var mmemoCenter = memoCenter;
var mmmemoCenter = mmemoCenter;
var mmmmemoCenter = mmmemoCenter;
var theBall;
var coordMaxx = 900;
var coordMaxy = 600;
var coordMin = 0;
var mouseControl = 1;
var justMouseControl = true;
var inBasket;
var inCerceau;
var oneShotChoc;
var replayShoots;
var aLaSuite;
var compteur;
var compteurTempo;
var aLechec;
var aLaPerfection;
var aLesChocs;
var indexReplay;
var frameReplay;
var phaseLancer;
var PHASELANCERMAX = 5;
stopit();
setMouseControl();
perfect.gotoAndStop(20);
_root.sourisback._visible = false;
var justarrived = true;
var speed = {x:0, y:0};
var g = 0.7;
var firstChocDecay = 0.8;
var chocFrontDecay = 0.7;
var chocFrotDecay = 0.9;
tmp = {x:0, y:0};
_root.player.brasborder.localToGlobal(tmp);
var attacheBras = {x:tmp.x, y:tmp.y};
tmp = {x:0, y:0};
_root.player.brasborder.mainborder.localToGlobal(tmp);
var attacheMain = {x:tmp.x, y:tmp.y};
var bras = {x:attacheMain.x - attacheBras.x, y:attacheMain.y - attacheBras.y};
lBras = Math.sqrt((bras.x * bras.x) + (bras.y * bras.y));
lBrasCarre = lBras * lBras;
lAvantBras = 50;
lAvantBrasCarre = lAvantBras * lAvantBras;
totBras = (lBras + lAvantBras) - 5;
_root.limites._width = (totBras + rayon) * 2;
_root.limites._height = (totBras + rayon) * 2;
_root.limites._x = attacheBras.x - (_root.limites._width / 2);
_root.limites._y = attacheBras.y - (_root.limites._height / 2);
var demult = 1;
var vitesseMax = 27;
var barrePoints = new Array();
var rayonBarre = 9;
var yBarre = 340;
var barres = new Array({x:790, y:yBarre, r:rayonBarre}, {x:860, y:yBarre, r:rayonBarre}, {x:895 + (2 * rayonBarre), y:yBarre, r:rayonBarre});
var nbBarres = 2;
var compBarreDist = (rayonBarre + rayon);
var compBarreDistCarre = (compBarreDist * compBarreDist);
var theBasket;
var nbBPts = 5;
var dPoints = 5;
var lBPts = new Array();
var rBPts = new Array();
var forceBPts = new Array();
lBPts[0] = {x:barres[0].x + rayonBarre, y:barres[0].y, vx:0, vy:0, obj:this.lbpt0};
rBPts[0] = {x:barres[1].x - rayonBarre, y:barres[1].y, vx:0, vy:0, obj:this.rbpt0};
forceBPts[0] = {dcarre:(rBPts[0].x - lBPts[0].x) * (rBPts[0].x - lBPts[0].x), d:rBPts[0].x - lBPts[0].x, pullit:0, pushit:0};
i = 1;
while (i < nbBPts) {
lBPts[i] = {x:lBPts[0].x, y:lBPts[0].y + (i * dPoints), vx:0, vy:0, obj:this["lbpt" + i]};
rBPts[i] = {x:rBPts[0].x, y:rBPts[0].y + (i * dPoints), vx:0, vy:0, obj:this["rbpt" + i]};
d = (forceBPts[0].d * ((5 + (nbBPts * nbBPts)) - ((nbBPts - i) * (nbBPts - i)))) / (30 + (nbBPts * nbBPts));
forceBPts[i] = {dcarre:d * d, d:d, pullit:0.02, pushit:0.01};
i++;
}
var bdecay = 0.8;
var coefforce = 0.2;
var contreBallon = {x:0, y:0};
var contreBallonCoef = 0.15;
var frotBasket;
var quantaFrotBasket = 0.08;
sourisOut(false);
startit();
var baseAlphaNum = 62;
initBall();
_root.onEnterFrame = function () {
if (justarrived) {
if ((((_xmouse > coordMin) && (_xmouse < coordMaxx)) && (_ymouse > coordMin)) && (_ymouse < coordMaxy)) {
reinit();
memoCenter = {x:center.x, y:center.y};
mmemoCenter = {x:memoCenter.x, y:memoCenter.y};
mmmemoCenter = {x:mmemoCenter.x, y:mmemoCenter.y};
mmmmemoCenter = {x:mmmemoCenter.x, y:mmmemoCenter.y};
justarrived = false;
}
}
if ((state == PLAY) || (state == REPLAY)) {
if (countdownhappyhour > 0) {
countdownhappyhour--;
}
if (countdownhappyhour == 0) {
stopHappy();
}
if (countdownframe == 0) {
countisdown();
} else {
displayCountdown();
}
mmmmemoCenter = {x:mmmemoCenter.x, y:mmmemoCenter.y};
mmmemoCenter = {x:mmemoCenter.x, y:mmemoCenter.y};
mmemoCenter = {x:memoCenter.x, y:memoCenter.y};
memoCenter = {x:center.x, y:center.y};
if ((mouseControl == 1) && (state == PLAY)) {
wishpos = {x:coordMin + ((_xmouse - coordMin) * demult), y:coordMaxy - ((coordMaxy - _ymouse) * demult)};
diff = {x:wishpos.x - center.x, y:wishpos.y - center.y};
distance = Math.sqrt((diff.x * diff.x) + (diff.y * diff.y));
if (distance > vitesseMax) {
rapport = vitesseMax / distance;
} else {
rapport = 1;
}
center = {x:center.x + (diff.x * rapport), y:center.y + (diff.y * rapport)};
choc = false;
speed = {x:((((center.x - memoCenter.x) * 3) + ((memoCenter.x - mmemoCenter.x) * 2)) + ((mmemoCenter.x - mmmemoCenter.x) * 1)) / 5, y:((((center.y - memoCenter.y) * 3) + ((memoCenter.y - mmemoCenter.y) * 2)) + ((mmemoCenter.y - mmemoCenter.y) * 1)) / 5};
diffMainEpaule = {x:center.x - attacheBras.x, y:center.y - attacheBras.y};
polDiffMainEpaule = getPolaire(diffMainEpaule);
if (polDiffMainEpaule.d > totBras) {
polDiffMainEpaule.d = totBras;
if (justMouseControl) {
center.x = attacheBras.x + (totBras * Math.cos(polDiffMainEpaule.a));
center.y = attacheBras.y + (totBras * Math.sin(polDiffMainEpaule.a));
}
choc = true;
}
if (center.x > (coordMaxx - rayon)) {
center.x = coordMaxx - rayon;
speed.x = (-speed.x) * firstChocDecay;
choc = true;
} else if (center.x < (coordMin + rayon)) {
center.x = coordMin + rayon;
speed.x = (-speed.x) * firstChocDecay;
choc = true;
}
if (center.y > (coordMaxy - rayon)) {
center.y = coordMaxy - rayon;
speed.y = (-speed.y) * firstChocDecay;
choc = true;
} else if (center.y < (coordMin + rayon)) {
center.y = coordMin + rayon;
speed.y = (-speed.y) * firstChocDecay;
choc = true;
}
if (choc == true) {
if (!justMouseControl) {
globalTry++;
setNoMouseControl();
_root.sourisback._visible = false;
center.x = Math.round(center.x * 100) / 100;
center.y = Math.round(center.y * 100) / 100;
speed.x = Math.round(speed.x * 100) / 100;
speed.y = Math.round(speed.y * 100) / 100;
replayShoots[indexReplay] = {f:frameReplay, l:true, s:false, x:center.x, y:center.y, vx:speed.x, vy:speed.y};
} else if (_root.sourisout._visible == false) {
_root.sourisback._visible = true;
_root.sourisback._x = _xmouse;
_root.sourisback._y = _ymouse;
diffEpauleSouris = {x:(-_xmouse) + center.x, y:(-_ymouse) + center.y};
polDiffEpauleSouris = getPolaire(diffEpauleSouris);
_root.sourisback.fleche._rotation = (polDiffEpauleSouris.a * 180) / Math.PI;
}
} else {
justMouseControl = false;
_root.sourisback._visible = false;
}
diffMainEpaule = {x:center.x - attacheBras.x, y:center.y - attacheBras.y};
polDiffMainEpaule = getPolaire(diffMainEpaule);
a1 = Math.acos((((polDiffMainEpaule.d * polDiffMainEpaule.d) + lBrasCarre) - lAvantBrasCarre) / ((2 * polDiffMainEpaule.d) * lBras));
b1 = Math.acos((((polDiffMainEpaule.d * polDiffMainEpaule.d) - lBrasCarre) + lAvantBrasCarre) / ((2 * polDiffMainEpaule.d) * lAvantBras));
alpha = polDiffMainEpaule.a + a1;
beta = -(a1 + b1);
alpha = alpha * 57.2957795130823;
beta = beta * 57.2957795130823;
_root.player.brasborder._rotation = alpha;
_root.player.brasfill._rotation = alpha;
_root.player.brasborder.mainborder._rotation = beta;
_root.player.brasfill.mainfill._rotation = beta;
if (mouseControl == 1) {
replayShoots[indexReplay] = {f:frameReplay, l:false, s:false, x:Math.round(center.x * 100) / 100, y:Math.round(center.y * 100) / 100, vx:0, vy:0};
if ((indexReplay == 0) || (replayShoots[indexReplay - 1].l == true)) {
replayShoots[indexReplay].s = true;
}
}
indexReplay++;
} else if ((state == REPLAY) && (phaseLancer > 0)) {
center.x = replayShoots[indexReplay].x;
center.y = replayShoots[indexReplay].y;
if (replayShoots[indexReplay].l == true) {
speed.x = replayShoots[indexReplay].vx;
speed.y = replayShoots[indexReplay].vy;
phaseLancer = 0;
}
diffMainEpaule = {x:center.x - attacheBras.x, y:center.y - attacheBras.y};
polDiffMainEpaule = getPolaire(diffMainEpaule);
a1 = Math.acos((((polDiffMainEpaule.d * polDiffMainEpaule.d) + lBrasCarre) - lAvantBrasCarre) / ((2 * polDiffMainEpaule.d) * lBras));
b1 = Math.acos((((polDiffMainEpaule.d * polDiffMainEpaule.d) - lBrasCarre) + lAvantBrasCarre) / ((2 * polDiffMainEpaule.d) * lAvantBras));
alpha = polDiffMainEpaule.a + a1;
beta = -(a1 + b1);
alpha = alpha * 57.2957795130823;
beta = beta * 57.2957795130823;
_root.player.brasborder._rotation = alpha;
_root.player.brasfill._rotation = alpha;
_root.player.brasborder.mainborder._rotation = beta;
_root.player.brasfill.mainfill._rotation = beta;
indexReplay++;
} else {
if (state == REPLAY) {
if (replayShoots[indexReplay].f == frameReplay) {
if (replayShoots[indexReplay].s == true) {
phaseLancer = PHASELANCERMAX;
if (!inBasket) {
aLechec++;
}
inBasket = false;
inCerceau = false;
oneShotChoc = false;
indexReplay++;
}
}
}
if ((phaseLancer == 0) || (state != REPLAY)) {
speed.y = speed.y + g;
center.x = center.x + speed.x;
center.y = center.y + speed.y;
choc = false;
speed = {x:center.x - memoCenter.x, y:center.y - memoCenter.y};
if (center.x > (coordMaxx - rayon)) {
center.x = coordMaxx - rayon;
speed.x = (-speed.x) * chocFrontDecay;
speed.y = speed.y * chocFrotDecay;
if (Math.abs(speed.x) > 5) {
choc = true;
}
} else if (center.x < (coordMin + rayon)) {
center.x = coordMin + rayon;
speed.x = (-speed.x) * chocFrontDecay;
speed.y = speed.y * chocFrotDecay;
if (Math.abs(speed.x) > 5) {
choc = true;
}
}
if (center.y > (coordMaxy - rayon)) {
center.y = coordMaxy - rayon;
speed.y = (-speed.y) * chocFrontDecay;
speed.x = speed.x * chocFrotDecay;
if (Math.abs(speed.y) > 5) {
choc = true;
}
} else if (center.y < (coordMin + rayon)) {
center.y = coordMin + rayon;
speed.y = (-speed.y) * chocFrontDecay;
speed.x = speed.x * chocFrotDecay;
if (Math.abs(speed.y) > 5) {
choc = true;
}
}
i = 0;
while (i < nbBarres) {
diffCentreBarre = {x:(-barres[i].x) + center.x, y:(-barres[i].y) + center.y};
distCarre = (diffCentreBarre.x * diffCentreBarre.x) + (diffCentreBarre.y * diffCentreBarre.y);
if (distCarre < compBarreDistCarre) {
speedAvantChoc = {x:speed.x, y:speed.y};
centrifuge = {x:diffCentreBarre.x, y:diffCentreBarre.y};
tangeante = {x:centrifuge.y, y:-centrifuge.x};
speedRepTangeante = getNewCoord(speed, tangeante, centrifuge);
if (Math.abs(speedRepTangeante.b / speedRepTangeante.a) > 0.25) {
choc = true;
}
speedRepTangeante.b = (-speedRepTangeante.b) * chocFrontDecay;
speedRepTangeante.a = speedRepTangeante.a * chocFrotDecay;
speed = {x:(speedRepTangeante.a * tangeante.x) + (speedRepTangeante.b * centrifuge.x), y:(speedRepTangeante.a * tangeante.y) + (speedRepTangeante.b * centrifuge.y)};
distance = Math.sqrt(distCarre);
center = {x:barres[i].x + ((diffCentreBarre.x * compBarreDist) / distance), y:barres[i].y + ((diffCentreBarre.y * compBarreDist) / distance)};
if (choc == true) {
if ((speedAvantChoc.y >= 0) && (speed.y > 0)) {
choc = false;
}
}
}
i++;
}
speed.x = speed.x + contreBallon.x;
speed.y = speed.y + contreBallon.y;
speed.x = speed.x * frotBasket;
speed.y = speed.y * frotBasket;
if (choc) {
clignement();
oneShotChoc = true;
aLesChocs++;
}
if (inCerceau) {
if (center.y > (yBarre + 60)) {
inBasket = true;
aLaSuite = aLaSuite + 3;
if (compteurTempo == 0) {
compteur++;
compteurTempo = 10;
}
inCerceau = false;
displayScore();
if (state == PLAY) {
globalSuccess++;
} else if (state == REPLAY) {
}
if (!oneShotChoc) {
aLaPerfection++;
countdownhappyhour = countdownhappyhourmax;
startHappy();
}
}
}
if ((((center.x > barres[0].x) && (center.x < barres[1].x)) && (center.y > (yBarre - 15))) && (center.y < (yBarre + 15))) {
inCerceau = true;
}
}
}
frameReplay++;
}
theBall._x = center.x;
theBall._y = center.y;
computeBasket();
drawBasket(theBasket);
clignementframe++;
setRotOeil();
if (compteurTempo > 0) {
compteurTempo--;
if (compteurTempo == 0) {
compteur++;
displayScore();
if (compteur < aLaSuite) {
compteurTempo = 10;
}
}
}
};
_root.onMouseDown = function () {
if (!_root.sourisout._visible) {
if (state == PLAY) {
setMouseControl();
reinit();
}
}
};
Instance of Symbol 5 MovieClip "bords" in Frame 1
onClipEvent (load) {
}
Symbol 5 MovieClip Frame 1
stop();
onRollOut = function () {
_root.sourisOut(true);
};
onRollOver = function () {
_root.reinit();
_root.sourisOut(false);
};
Symbol 5 MovieClip Frame 2
stop();
Symbol 8 MovieClip Frame 1
stop();
Symbol 8 MovieClip Frame 2
stop();
Symbol 15 MovieClip Frame 1
stop();
Symbol 15 MovieClip Frame 2
stop();
Symbol 19 MovieClip Frame 1
stop();
Symbol 19 MovieClip Frame 2
stop();
Symbol 21 MovieClip Frame 1
mainborder.gotoAndStop(1);
stop();
Symbol 21 MovieClip Frame 2
mainborder.gotoAndStop(2);
stop();
Symbol 29 MovieClip Frame 6
stop();
Symbol 45 MovieClip Frame 1
stop();
Symbol 54 MovieClip Frame 1
stop();
Symbol 54 MovieClip Frame 20
gotoAndPlay (2);
Symbol 60 MovieClip Frame 10
gotoAndPlay (1);