Frame 1
stop();
monSon = new Sound();
monSon.attachSound("boucle");
monSon.setVolume(0);
monSon.start(0, 9999999);
Frame 2
stop();
this.init = function () {
if (this.li != undefined) {
Key.removeListener(this.li);
}
monSon.setVolume(20);
this.score._visible = false;
this.perso._y = 270;
this.perso.gotoAndStop(1);
this.drapeau._x = 6666.66666666667;
this.perdu = (this.finit = (this.saute = false));
this.pos1 = (this.vit = (this.vity = 0));
this.dist = 0;
this.li = new Object();
this.li.hit = true;
this.li.ref = this;
this.li.onKeyDown = function () {
if ((((Key.getCode() == 37) && (this.hit)) && (!this.ref.saute)) && (!this.ref.perdu)) {
this.hit = !this.hit;
this.ref.vit = this.ref.vit + 12;
} else if (((((Key.getCode() == 39) && (!this.hit)) && (!this.ref.saute)) && (!this.ref.perdu)) && (!this.finit)) {
this.ref.vit = this.ref.vit + 12;
this.hit = !this.hit;
}
if ((((Key.getCode() == 38) && (!this.ref.saute)) && (!this.ref.perdu)) && (!this.finit)) {
trace(this.ref.saute);
this.ref.saute = true;
this.ref.perso.gotoAndStop(3);
this.ref.barreForce._xscale = 1;
this.ref.cibleY = -20;
}
if (((((Key.getCode() == 38) && (this.hit)) && (this.ref.saute)) && (!this.ref.perdu)) && (!this.finit)) {
this.hit = !this.hit;
this.ref.vity = this.ref.vity + 12;
} else if (((((Key.getCode() == 40) && (!this.hit)) && (this.ref.saute)) && (!this.ref.perdu)) && (!this.finit)) {
this.ref.vity = this.ref.vity + 12;
this.hit = !this.hit;
}
};
Key.addListener(this.li);
this.onEnterFrame = function () {
if ((this.finit || (this.finit)) || ((this.vit < 1) && (!this.saute))) {
this.perso.gotoAndStop(1);
} else if (this.saute) {
this.perso.gotoAndStop(3);
} else if ((this.vit > 1) && (!this.saute)) {
this.perso.gotoAndStop(2);
}
this.pos1 = this.pos1 - (this.vit / 1.5);
if (this.pos1 <= -500) {
this.pos1 = this.pos1 + 500;
}
if (!this.finit) {
this.sol1._x = pos1;
this.sol2._x = pos1 + 500;
this.drapeau._x = this.drapeau._x - (this.vit / 1.5);
}
if ((!this.saute) && (!this.perdu)) {
this.barreForce._xscale = this.barreForce._xscale + ((this.vit - this.barreForce._xscale) / 10);
this.monSon.setVolume(this.barreForce._xscale + 20);
this.dist = this.dist + this.vit;
this.vit = this.vit / 1.1;
if (this.dist > 10000) {
this.perdu = true;
this.score._visible = true;
this.score.distance.text = Math.round(this.dist - 10000) / 100;
}
} else if (((!this.perdu) && (this.saute)) && (!this.finit)) {
this.vit = this.vit / 1.01;
this.vity = this.vity / 1.1;
this.dist = this.dist + this.vit;
this.barreForce._xscale = this.barreForce._xscale + ((this.vity - this.barreForce._xscale) / 10);
this.perso._y = this.perso._y + ((this.cibley - this.perso._y) / 8);
this.cibley = this.cibley + ((100 - this.vity) / 25);
if (this.perso._y > 270) {
this.perso.gotoAndStop(1);
this.finit = true;
}
} else if (this.finit) {
this.score._visible = true;
if (this.dist < 10000) {
this.dist = 10000;
}
this.score.distance.text = Math.round(this.dist - 10000) / 100;
} else if (!this.finit) {
this.vit = this.vit / 1.3;
this.barreForce._xscale = this.barreForce._xscale + ((this.vit - this.barreForce._xscale) / 10);
this.dist = this.dist + this.vit;
}
if (this.barreForce._xscale > 100) {
this.barreForce._xscale = 100;
}
};
};
this.init();
Symbol 5 Button
on (press) {
gotoAndStop (2);
}
Symbol 48 Button
on (press) {
_root.init();
}