|
|
|
@ -10,6 +10,8 @@ class Jeu extends Scene {
|
|
|
|
|
public wall_ : Sprite;
|
|
|
|
|
public pas_ : number;
|
|
|
|
|
public pacman_ : Pacman;
|
|
|
|
|
public noisette_ : Sprite;
|
|
|
|
|
public pastilles_ : Array<Array<Sprite>>;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -18,6 +20,7 @@ class Jeu extends Scene {
|
|
|
|
|
super(element,false);
|
|
|
|
|
/* Ecrire ici le code qui initialise la scene. */
|
|
|
|
|
this.pas_ = 32;
|
|
|
|
|
this.pastilles_ = [];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -33,11 +36,11 @@ private initialiserCarte(){
|
|
|
|
|
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++){
|
|
|
|
|
this.pastilles_[i] = [];
|
|
|
|
|
for(let j = 0 ; j<this.carte_[i].length; j++){
|
|
|
|
|
if(this.carte_[i][j] == 1){
|
|
|
|
|
this.wall_ = new Sprite(document.createElement("img"));
|
|
|
|
@ -46,13 +49,28 @@ private dessinerLabyrinthe(){
|
|
|
|
|
this.appendChild(this.wall_);
|
|
|
|
|
}
|
|
|
|
|
if (this.carte_[i][j] == 8){
|
|
|
|
|
this.pacman_ = new Pacman(this,document.createElement("img"),4,7);
|
|
|
|
|
this.pacman_ = new Pacman(this,document.createElement("img"),i,j);
|
|
|
|
|
this.pacman_.setImage("Squirrel.png",32,32);
|
|
|
|
|
this.pacman_.setXY(this.pas_*j,this.pas_*i);
|
|
|
|
|
this.appendChild(this.pacman_);
|
|
|
|
|
}
|
|
|
|
|
if (this.carte_[i][j] == 2){
|
|
|
|
|
this.noisette_ = new Sprite(document.createElement("img"));
|
|
|
|
|
this.noisette_.setImage("noisette.png",32,32);
|
|
|
|
|
this.noisette_.setXY(this.pas_*j,this.pas_*i);
|
|
|
|
|
this.appendChild(this.noisette_);
|
|
|
|
|
}
|
|
|
|
|
if(this.carte_[i][j] == 2){
|
|
|
|
|
this.pastilles_[i][j] = this.noisette_;
|
|
|
|
|
} else {
|
|
|
|
|
this.pastilles_[i][j] = null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}console.log(this.pastilles_);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public retirePastille(){
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//--------------------------------------------------------------------------------------------start
|
|
|
|
|
public override start() {
|
|
|
|
@ -61,6 +79,7 @@ private dessinerLabyrinthe(){
|
|
|
|
|
this.initialiserCarte();
|
|
|
|
|
this.dessinerLabyrinthe();
|
|
|
|
|
this.pacman_.animer();
|
|
|
|
|
this.pacman_.estArriver();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//--------------------------------------------------------------------------------------------pause
|
|
|
|
|