|
|
|
@ -24,14 +24,19 @@ class Jeu extends Scene {
|
|
|
|
|
public intervalTemps: number;
|
|
|
|
|
|
|
|
|
|
public compteurScore : number;
|
|
|
|
|
public compteurScoreFinal : number;
|
|
|
|
|
|
|
|
|
|
public compteurMonnaie : number;
|
|
|
|
|
public compteurTemps : number;
|
|
|
|
|
|
|
|
|
|
public score_ : Sprite;
|
|
|
|
|
public scoreFinal_ : HTMLElement;
|
|
|
|
|
|
|
|
|
|
public monnaie_ : Sprite;
|
|
|
|
|
public temps_ : Sprite;
|
|
|
|
|
|
|
|
|
|
private zoneDeJeu_ : Sprite;
|
|
|
|
|
public partieFinie_ : HTMLElement;
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------------Constructeur
|
|
|
|
|
public constructor(element : HTMLElement) {
|
|
|
|
@ -45,15 +50,20 @@ class Jeu extends Scene {
|
|
|
|
|
this.zoneDeJeu_.setHeight(this.getHeight());
|
|
|
|
|
|
|
|
|
|
//Gestion des stats
|
|
|
|
|
|
|
|
|
|
this.score_ = new Sprite (document.getElementById("score"));
|
|
|
|
|
this.compteurScore = 0;
|
|
|
|
|
|
|
|
|
|
this.scoreFinal_ = document.getElementById("scoreFinal");
|
|
|
|
|
|
|
|
|
|
this.monnaie_ = new Sprite (document.getElementById("monnaie"));
|
|
|
|
|
this.compteurMonnaie = 0;
|
|
|
|
|
|
|
|
|
|
this.temps_ = new Sprite (document.getElementById("temps"));
|
|
|
|
|
this.compteurTemps = 90;
|
|
|
|
|
|
|
|
|
|
this.partieFinie_ = document.getElementById("partieFinie");
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------start
|
|
|
|
@ -72,10 +82,8 @@ class Jeu extends Scene {
|
|
|
|
|
this.afficherShop();
|
|
|
|
|
this.afficherOptions();
|
|
|
|
|
this.creerObject();
|
|
|
|
|
this.reduireTemps();
|
|
|
|
|
|
|
|
|
|
setTimeout (() => {
|
|
|
|
|
this.reduireTemps();
|
|
|
|
|
},3000)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
@ -121,16 +129,19 @@ class Jeu extends Scene {
|
|
|
|
|
|
|
|
|
|
clearInterval(this.intervalCollision);
|
|
|
|
|
clearInterval(this.intervalTemps);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public augmenterScore() {
|
|
|
|
|
this.compteurScore += 100;
|
|
|
|
|
this.score_.getElement().textContent = "" + this.compteurScore;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public reduireScore() {
|
|
|
|
|
this.compteurScore -= 200;
|
|
|
|
|
this.score_.getElement().textContent = "" + this.compteurScore;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public augmenterMonnaie() {
|
|
|
|
@ -148,7 +159,22 @@ public reduireScore() {
|
|
|
|
|
this.intervalTemps = setInterval( ()=> {
|
|
|
|
|
this.compteurTemps -=1;
|
|
|
|
|
this.temps_.getElement().textContent = "" + this.compteurTemps;
|
|
|
|
|
}, 1000 )
|
|
|
|
|
if (this.compteurTemps <= 0) {
|
|
|
|
|
this.finDePartie();
|
|
|
|
|
};
|
|
|
|
|
}, 1000 );
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public finDePartie() {
|
|
|
|
|
this.scoreFinal_.textContent = "Votre score est de : " + this.compteurScore;
|
|
|
|
|
this.partieFinie_.style.display = 'block';
|
|
|
|
|
this.figerObjet();
|
|
|
|
|
this.joueur_.figer();
|
|
|
|
|
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
window.location.reload();
|
|
|
|
|
}, 5000);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------pause
|
|
|
|
|