back integrer rajoue de niveau WIP

master
Victor BRUN 2 years ago
parent d744b5ae39
commit c95360ef1a

@ -22,6 +22,8 @@ class Jeu extends Scene {
public mangerfraise_ : Array<Array<Sprite>>; public mangerfraise_ : Array<Array<Sprite>>;
public compteurfromagemoins_ : number; public compteurfromagemoins_ : number;
public compteurfraisemoins_ : number; public compteurfraisemoins_ : number;
public niveau_ : any;
private idniveau_ : number;
@ -34,26 +36,45 @@ class Jeu extends Scene {
this.mangerfraise_ = []; this.mangerfraise_ = [];
this.compteurfromagemoins_ = 0; this.compteurfromagemoins_ = 0;
this.compteurfraisemoins_ = 0; this.compteurfraisemoins_ = 0;
this.idniveau_ = 1;
} }
private telechargerNiveau(id : number){
let requete : XMLHttpRequest = new XMLHttpRequest();
let parametres : string = "id=" + id;
requete.open("get", "http://localhost/SAE/index.php?" + parametres);
/* Ecouteur déclenché à la réception des données */
requete.onreadystatechange = () => {
if (requete.readyState == XMLHttpRequest.DONE
&& requete.status == 200) {
this.niveau_ = JSON.parse(requete.responseText);
/* Suite du code */
console.log(this.niveau_.id);
console.log(this.niveau_.niveau);
this.start_suite();
}
}
requete.send();
}
private initialiserCarte(){ private initialiserCarte(){
this.carte_ = []; // this.carte_ = [];
this.carte_[0] = [1 ,1 ,1 ,0 ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ]; // this.carte_[0] = [1 ,1 ,1 ,0 ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ];
this.carte_[1] = [1 ,8 ,1 ,0 ,0 ,1 ,2 ,2 ,2 ,2 ,2 ,1 ,0 ,1 ,2 ,2 ,2 ,1 ,0 ,0 ]; // this.carte_[1] = [1 ,8 ,1 ,0 ,0 ,1 ,2 ,2 ,2 ,2 ,2 ,1 ,0 ,1 ,2 ,2 ,2 ,1 ,0 ,0 ];
this.carte_[2] = [1 ,2 ,1 ,0 ,0 ,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,1 ,0 ,1 ,1 ,1 ,1 ]; // this.carte_[13] = [0 ,0 ,1 ,2 ,2 ,2 ,2 ,2 ,2 ,1 ,1 ,3 ,2 ,2 ,1 ,0 ,1 ,1 ,1 ,1 ];
this.carte_[14] = [0 ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ]; // this.carte_[14] = [0 ,0 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,0 ,0 ,0 ,0 ,0 ];
this.carte_ = JSON.parse(this.niveau_.niveau);
} }
public dessinerLabyrinthe(){ public dessinerLabyrinthe(){
@ -178,7 +199,7 @@ public compteur(){
console.log(this.totalfromage_); console.log(this.totalfromage_);
} }
//--------------------------------------------------------------------------------------------start //--------------------------------------------------------------------------------------------start
public override start() { public start_suite() {
/* Ecrire ici le code qui demarre la scene. */ /* Ecrire ici le code qui demarre la scene. */
console.log(this.carte_); console.log(this.carte_);
this.initialiserCarte(); this.initialiserCarte();
@ -187,6 +208,11 @@ public compteur(){
this.rat_.animer(); this.rat_.animer();
this.rat_.estArriver(); this.rat_.estArriver();
} }
public override start() {
/* Ecrire ici le code qui demarre la scene. */
this.telechargerNiveau(this.idniveau_);
this.idniveau_++;
}
//--------------------------------------------------------------------------------------------pause //--------------------------------------------------------------------------------------------pause
public override pause() { public override pause() {
@ -207,3 +233,4 @@ public compteur(){
} }
// Fin //------------------------------------------------------------------------------------------- // Fin //-------------------------------------------------------------------------------------------
Loading…
Cancel
Save