Mise a jour image et nom de classe

master
Victor BRUN 1 year ago
parent d351c0a1d1
commit 1f57003d07

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.6 KiB

@ -7,7 +7,7 @@
<script src="Sprite.js"></script> <script src="Sprite.js"></script>
<script src="Scene.js"></script> <script src="Scene.js"></script>
<script src="Jeu.js"></script> <script src="Jeu.js"></script>
<script src="Pacman.js"></script> <script src="Rat.js"></script>
<!-- Inclure ici les fichiers JavaScript necessaires a la scene. --> <!-- Inclure ici les fichiers JavaScript necessaires a la scene. -->
<script> <script>
let scene; let scene;

@ -13,7 +13,7 @@ body {
user-select: none; user-select: none;
/*overflow: hidden;*/ /*overflow: hidden;*/
background-color: #FFFFFF; background-image : url("nappe.jpg");
box-shadow: 12px 12px 4px rgba(150,150,150,0.75); box-shadow: 12px 12px 4px rgba(150,150,150,0.75);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 281 KiB

@ -9,7 +9,7 @@ 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 pacman_ : Pacman; public rat_ : Rat;
public noisette_ : Sprite; public noisette_ : Sprite;
public pastilles_ : Array<Array<Sprite>>; public pastilles_ : Array<Array<Sprite>>;
@ -27,7 +27,7 @@ class Jeu extends Scene {
private initialiserCarte(){ private initialiserCarte(){
this.carte_ = []; this.carte_ = [];
this.carte_[0] = [1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1 ,1]; 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_[1] = [1 ,3 ,2 ,2 ,2 ,1 ,3 ,2 ,2 ,1];
this.carte_[2] = [1 ,1 ,2 ,1 ,1 ,1 ,2 ,1 ,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_[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_[4] = [1 ,2 ,1 ,1 ,2 ,2 ,2 ,1 ,2 ,9];
@ -49,14 +49,20 @@ 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"),i,j); this.rat_ = new Rat(this,document.createElement("img"),i,j);
this.pacman_.setImage("Squirrel.png",32,32); this.rat_.setImage("rat.png",32,32);
this.pacman_.setXY(this.pas_*j,this.pas_*i); this.rat_.setXY(this.pas_*j,this.pas_*i);
this.appendChild(this.pacman_); this.appendChild(this.rat_);
} }
if (this.carte_[i][j] == 2){ if (this.carte_[i][j] == 2){
this.noisette_ = new Sprite(document.createElement("img")); this.noisette_ = new Sprite(document.createElement("img"));
this.noisette_.setImage("noisette.png",32,32); this.noisette_.setImage("fromage.png",32,32);
this.noisette_.setXY(this.pas_*j,this.pas_*i);
this.appendChild(this.noisette_);
}
if (this.carte_[i][j] == 3){
this.noisette_ = new Sprite(document.createElement("img"));
this.noisette_.setImage("fraise.png",32,32);
this.noisette_.setXY(this.pas_*j,this.pas_*i); this.noisette_.setXY(this.pas_*j,this.pas_*i);
this.appendChild(this.noisette_); this.appendChild(this.noisette_);
} }
@ -78,14 +84,14 @@ public retirePastille(){
console.log(this.carte_); console.log(this.carte_);
this.initialiserCarte(); this.initialiserCarte();
this.dessinerLabyrinthe(); this.dessinerLabyrinthe();
this.pacman_.animer(); this.rat_.animer();
this.pacman_.estArriver(); this.rat_.estArriver();
} }
//--------------------------------------------------------------------------------------------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(); this.rat_.figer();
} }
//------------------------------------------------------------------------------------------unpause //------------------------------------------------------------------------------------------unpause

@ -1,4 +1,4 @@
class Pacman extends Sprite { class Rat extends Sprite {
//Attributs //Attributs
public scene_ : Jeu; public scene_ : Jeu;
Loading…
Cancel
Save