|
|
@ -9,8 +9,6 @@ class Jeu extends Scene {
|
|
|
|
public carte_ : Array<Array<number>>;
|
|
|
|
public carte_ : Array<Array<number>>;
|
|
|
|
public wall_ : Sprite;
|
|
|
|
public wall_ : Sprite;
|
|
|
|
public pas_ : number;
|
|
|
|
public pas_ : number;
|
|
|
|
public px : number;
|
|
|
|
|
|
|
|
public py : number;
|
|
|
|
|
|
|
|
public pacman_ : Pacman;
|
|
|
|
public pacman_ : Pacman;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -19,9 +17,7 @@ class Jeu extends Scene {
|
|
|
|
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;
|
|
|
|
this.pas_ = 32;
|
|
|
|
this.px = 4;
|
|
|
|
|
|
|
|
this.py = 7;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -50,7 +46,7 @@ private dessinerLabyrinthe(){
|
|
|
|
this.appendChild(this.wall_);
|
|
|
|
this.appendChild(this.wall_);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (this.carte_[i][j] == 8){
|
|
|
|
if (this.carte_[i][j] == 8){
|
|
|
|
this.pacman_ = new Pacman(this,document.createElement("img"));
|
|
|
|
this.pacman_ = new Pacman(this,document.createElement("img"),4,7);
|
|
|
|
this.pacman_.setImage("Squirrel.png",32,32);
|
|
|
|
this.pacman_.setImage("Squirrel.png",32,32);
|
|
|
|
this.pacman_.setXY(this.pas_*j,this.pas_*i);
|
|
|
|
this.pacman_.setXY(this.pas_*j,this.pas_*i);
|
|
|
|
this.appendChild(this.pacman_);
|
|
|
|
this.appendChild(this.pacman_);
|
|
|
@ -64,11 +60,13 @@ private dessinerLabyrinthe(){
|
|
|
|
console.log(this.carte_);
|
|
|
|
console.log(this.carte_);
|
|
|
|
this.initialiserCarte();
|
|
|
|
this.initialiserCarte();
|
|
|
|
this.dessinerLabyrinthe();
|
|
|
|
this.dessinerLabyrinthe();
|
|
|
|
|
|
|
|
this.pacman_.animer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------pause
|
|
|
|
//--------------------------------------------------------------------------------------------pause
|
|
|
|
public override pause() {
|
|
|
|
public override pause() {
|
|
|
|
/* Ecrire ici le code qui met la scene en pause. */
|
|
|
|
/* Ecrire ici le code qui met la scene en pause. */
|
|
|
|
|
|
|
|
this.pacman_.figer();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//------------------------------------------------------------------------------------------unpause
|
|
|
|
//------------------------------------------------------------------------------------------unpause
|
|
|
|