|
|
@ -6,16 +6,53 @@
|
|
|
|
class Jeu extends Scene {
|
|
|
|
class Jeu extends Scene {
|
|
|
|
//----------------------------------------------------------------------------------------Attributs
|
|
|
|
//----------------------------------------------------------------------------------------Attributs
|
|
|
|
/* Declarer ici les attributs de la scene. */
|
|
|
|
/* Declarer ici les attributs de la scene. */
|
|
|
|
|
|
|
|
public carte_ : Array<Array<number>>;
|
|
|
|
|
|
|
|
public wall_ : Sprite;
|
|
|
|
|
|
|
|
public pas_ : number;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------------------------Constructeur
|
|
|
|
//-------------------------------------------------------------------------------------Constructeur
|
|
|
|
public constructor(element : HTMLElement) {
|
|
|
|
public constructor(element : HTMLElement) {
|
|
|
|
super(element,false);
|
|
|
|
super(element,false);
|
|
|
|
/* Ecrire ici le code qui initialise la scene. */
|
|
|
|
/* Ecrire ici le code qui initialise la scene. */
|
|
|
|
|
|
|
|
this.pas_ = 32;
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private initialiserCarte(){
|
|
|
|
|
|
|
|
this.carte_ = [];
|
|
|
|
|
|
|
|
this.carte_[0] = [1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1];
|
|
|
|
|
|
|
|
this.carte_[1] = [1 ,10,2 ,2 ,2 ,1 ,10,2 ,2 ,1];
|
|
|
|
|
|
|
|
this.carte_[2] = [1 ,1 ,2 ,1 ,1 ,1 ,2 ,1 ,2 ,1];
|
|
|
|
|
|
|
|
this.carte_[3] = [1 ,2 ,2 ,2 ,1 ,1 ,2 ,1 ,1 ,1];
|
|
|
|
|
|
|
|
this.carte_[4] = [1 ,2 ,1 ,1 ,2 ,2 ,2 ,1 ,2 ,9];
|
|
|
|
|
|
|
|
this.carte_[5] = [1 ,2 ,2 ,2 ,2 ,1 ,2 ,1 ,2 ,1];
|
|
|
|
|
|
|
|
this.carte_[6] = [1 ,2 ,1 ,8 ,1 ,1 ,2 ,2 ,2 ,1];
|
|
|
|
|
|
|
|
this.carte_[7] = [1 ,2 ,1 ,2 ,1 ,1 ,2 ,1 ,1 ,1];
|
|
|
|
|
|
|
|
this.carte_[8] = [1 ,2 ,2 ,2 ,1 ,2 ,2 ,2 ,2 ,1];
|
|
|
|
|
|
|
|
this.carte_[9] = [1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1];
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private dessinerLabyrinthe(){
|
|
|
|
|
|
|
|
for(let i = 0 ; i<this.carte_.length; i++){
|
|
|
|
|
|
|
|
for(let j = 0 ; j<this.carte_[i].length; j++){
|
|
|
|
|
|
|
|
if(this.carte_[i][j] == 1){
|
|
|
|
|
|
|
|
this.wall_ = new Sprite(document.createElement("img"));
|
|
|
|
|
|
|
|
this.wall_.setImage("mur.jpg",32,32);
|
|
|
|
|
|
|
|
this.wall_.setXY(this.pas_*j,this.pas_*i);
|
|
|
|
|
|
|
|
this.appendChild(this.wall_);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
//--------------------------------------------------------------------------------------------start
|
|
|
|
//--------------------------------------------------------------------------------------------start
|
|
|
|
public override start() {
|
|
|
|
public override start() {
|
|
|
|
/* Ecrire ici le code qui demarre la scene. */
|
|
|
|
/* Ecrire ici le code qui demarre la scene. */
|
|
|
|
|
|
|
|
console.log(this.carte_);
|
|
|
|
|
|
|
|
this.initialiserCarte();
|
|
|
|
|
|
|
|
this.dessinerLabyrinthe();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------pause
|
|
|
|
//--------------------------------------------------------------------------------------------pause
|
|
|
|