home *** CD-ROM | disk | FTP | other *** search
- scrollDecor = function()
- {
- malus1._x -= vitesseScroll / 1.5;
- bonus1._x -= vitesseScroll / 1.5;
- nuageMotor._x -= vitesseScroll;
- nuage._x -= vitesseScroll * 1.2;
- if(gagne == 1)
- {
- if(decor1._x >= consigneDecor)
- {
- decor1._x -= vitesseScroll / 2;
- decor2._x -= vitesseScroll / 4;
- }
- }
- else
- {
- decor1._x -= vitesseScroll / 2;
- decor2._x -= vitesseScroll / 4;
- }
- };
- numPlane = numPlane != undefined ? numPlane : 1;
- stop();
- initPlane = function(plane)
- {
- var _loc1_ = plane;
- if(_loc1_ == 1)
- {
- fuelMax = 25000;
- numPlane = 1;
- speedScroll = 1.1;
- speedPlane = 1.5;
- }
- else if(_loc1_ == 2)
- {
- fuelMax = 15000;
- numPlane = 2;
- speedScroll = 1.8;
- speedPlane = 1.5;
- }
- else if(_loc1_ == 3)
- {
- fuelMax = 45000;
- numPlane = 3;
- speedScroll = 1;
- speedPlane = 0.5;
- }
- };
- makeFuel = function(leTime)
- {
- var _loc1_ = leTime;
- _loc1_ = Math.min(fuelMax,_loc1_);
- fuel_gauge._xscale = 100 - Math.max(0,_loc1_ / fuelMax * 100);
- fuelMC.jauge._yscale = Math.max(0,_loc1_ / fuelMax * 100);
- fuelMC.aiguille._rotation = Math.max(0,100 - Math.max(0,_loc1_ / Max * 100));
- if(_loc1_ / fuelMax * 100 <= 30)
- {
- fuelAlarma.gotoAndStop(2);
- }
- else
- {
- fuelAlarma.gotoAndStop(1);
- }
- return Math.max(0,Math.round(_loc1_ / fuelMax * 100));
- };
- startGame = function()
- {
- heart1.gotoAndStop(1);
- heart2.gotoAndStop(1);
- heart3.gotoAndStop(1);
- heart4.gotoAndStop(1);
- plane.plane.gotoAndStop(numPlane);
- hauteurJeu = 280;
- nombreTablo = 20;
- fuel = fuelMax;
- motorSND.stop();
- motorSND.start(0,99999);
- motorSND.setVolume(0);
- plane._x = 40;
- decor1._x = 0;
- decor2._x = 0;
- indiceFond = 0;
- decor1.fond1.gotoAndStop(1);
- decor1.fond2.gotoAndStop(2);
- decor1.fond1._x = 0;
- decor1.fond2._x = decor1.fond1._x + decor1.fond1._width - 2;
- decor2.fond1._x = 0;
- decor2.fond2._x = decor2.fond1._x + decor2.fond1._width - 2;
- positionneBonus(bonus1);
- positionneMalus(malus1);
- positionneNuage();
- plane.gotoAndStop(1);
- plane._y = hauteurJeu;
- casse = 0;
- panne = 0;
- dejaDecol = 0;
- starter = 0;
- bonus = 0;
- pressed = 0;
- malus = 0;
- casse = 0;
- firstKey = 0;
- noKey = 0;
- debGame = Math.round(new Date().getTime());
- fuel = makeFuel(fuelMax);
- plane.gaz = 0;
- plane.angle = 0;
- this.onEnterFrame = function()
- {
- if(plane._y < hauteurJeu - 20)
- {
- dejaDecol = 1;
- }
- volumeVal = Math.max(0,plane.gaz * 2);
- motorSND.setVolume(volumeVal / 3);
- trace("volumeVal " + volumeVal);
- if(starter == 1 && !panne && !casse)
- {
- fuel = makeFuel(fuelMax - (Math.round(new Date().getTime()) - debGame - bonus * 4500));
- if(fuel <= 0 && panne == 0)
- {
- panneSND.start(0,1);
- }
- if(fuel <= 0)
- {
- fuel = 0;
- panne = 1;
- }
- else
- {
- panne = 0;
- }
- }
- noKey = 1;
- if(!casse && !panne && firstKey == 1)
- {
- if(Math.round(Math.random() * 10) == 2)
- {
- this.attachMovie("nuage","nuageMotor",10,{_y:plane._y,_x:plane._x});
- }
- }
- if(Key.isDown(32))
- {
- if(starter != 1)
- {
- debGame = Math.round(new Date().getTime());
- firstKey = 1;
- }
- starter = 1;
- if(!casse && !panne)
- {
- plane.angle -= 0.001 * plane.gaz * 1.3 * speedPlane;
- plane.gaz += 0.6;
- pressed = 1;
- noKey = 0;
- }
- }
- if(plane.plane.hitAreaMC.hitTest(bonus1))
- {
- bonus += 1;
- positionneBonus(bonus1);
- bonusSND.start();
- }
- if(plane.plane.hitAreaMC.hitTest(malus1))
- {
- malus += 1;
- plane.plane.plane.gotoAndStop(malus);
- eval("heart" + malus).gotoAndPlay(2);
- positionneMalus(malus1);
- malusSND.start();
- if(malus >= 5)
- {
- casse = 1;
- plane.gotoAndStop(2);
- }
- }
- if(noKey == 1)
- {
- if(pressed == 1)
- {
- if(plane._y <= hauteurJeu)
- {
- plane.gaz -= 0.3;
- if(decor1._x < -300 || dejaDecol)
- {
- plane.angle += 0.03 * speedPlane;
- }
- }
- }
- }
- plane.gaz = Math.max(plane.gaz,0);
- plane.gaz = Math.min(plane.gaz,20);
- if(plane._y < 80)
- {
- plane.angle *= plane._y / 80;
- }
- vitesseScroll = Math.max(0,plane.gaz * Math.cos(plane.angle) * speedScroll);
- scrollDecor();
- if(nuage._x < - nuage._width)
- {
- positionneNuage();
- }
- if(decor1._x + decor1.fond1._x < - decor1.fond1._width - 2)
- {
- indiceFond++;
- decor1.fond1._x = decor1.fond2._x + decor1.fond1._width - 2;
- if(indiceFond == nombreTablo)
- {
- gotoAndStop("gagne");
- decor1.fond1.gotoAndStop(3);
- lastDecor = decor1.fond1;
- }
- else
- {
- decor1.fond1.gotoAndStop(2);
- }
- }
- if(decor1._x + decor1.fond2._x < - decor1.fond1._width - 2)
- {
- indiceFond++;
- decor1.fond2._x = decor1.fond1._x + decor1.fond1._width - 2;
- if(indiceFond == nombreTablo)
- {
- gotoAndStop("gagne");
- lastDecor = decor1.fond2;
- decor1.fond2.gotoAndStop(3);
- }
- else
- {
- decor1.fond2.gotoAndStop(2);
- }
- }
- distanceLeft = Math.round((decor1.fond1._width - 2) * nombreTablo + decor1._x);
- distanceLeft = Math.max(0,distanceLeft);
- if(decor2._x + decor2.fond1._x < - decor2.fond1._width - 2)
- {
- decor2.fond1._x = decor2.fond2._x + decor2.fond1._width - 2;
- }
- if(decor2._x + decor2.fond2._x < - decor2.fond1._width - 2)
- {
- decor2.fond2._x = decor2.fond1._x + decor2.fond1._width - 2;
- }
- plane._y += plane.gaz * Math.sin(plane.angle) + 30 / (plane.gaz + 0.1);
- if(plane._x < 150)
- {
- plane._x += plane.gaz / 4;
- }
- if(plane._y > hauteurJeu && plane.angle > 0.1)
- {
- plane._y = hauteurJeu;
- trace(decor1._x);
- if(decor1._x < -300 || dejaDecol)
- {
- casse = 1;
- plane.gotoAndStop(2);
- gotoAndStop("PERDU");
- motorSND.stop();
- }
- else
- {
- plane.angle = 0;
- plane.gaz = 0;
- }
- }
- if(bonus1._x < -200)
- {
- positionneBonus(bonus1);
- }
- if(malus1._x < -200)
- {
- positionneMalus(malus1);
- }
- plane._y = Math.min(plane._y,hauteurJeu);
- if(!casse)
- {
- plane._rotation = plane.angle * 180 / 3.141592653589793;
- }
- };
- };
- positionneBonus = function(leBonus)
- {
- var _loc1_ = leBonus;
- _loc1_._x = 600 + Math.random() * 1900;
- _loc1_._y = 60 + Math.random() * (hauteurJeu - 80);
- if(_loc1_ == malus1)
- {
- _loc1_.gotoAndStop(Math.ceil(Math.random() * 3));
- }
- };
- positionneMalus = function(leBonus)
- {
- var _loc1_ = leBonus;
- _loc1_._x = 600 + Math.random() * 500;
- _loc1_._y = 0 + Math.random() * (hauteurJeu - 50);
- if(_loc1_ == malus1)
- {
- _loc1_.gotoAndStop(Math.ceil(Math.random() * 3));
- }
- };
- positionneNuage = function()
- {
- nuage._x = 600 + Math.random() * 2900;
- nuage._y = Math.random() * (hauteurJeu - 100);
- };
-