From f700848caa6d1b18cfea127ae45d02de5a5e537d Mon Sep 17 00:00:00 2001 From: SSBU_Jules Date: Sun, 2 Jun 2024 16:47:46 +0200 Subject: [PATCH] =?UTF-8?q?CASSE=20BRIQUE=20TERMIN=C3=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build/index.htm | 19 +++++++++ build/jeu.css | 100 +++++++++++++++++++++++++++++++++++++++++++++- build/pause.png | Bin 0 -> 9759 bytes build/unpause.png | Bin 0 -> 4747 bytes source/Balle.ts | 24 +++++++---- source/Jeu.ts | 88 ++++++++++++++++++++++++++++++++++++++++ source/Palet.ts | 2 - 7 files changed, 222 insertions(+), 11 deletions(-) create mode 100644 build/pause.png create mode 100644 build/unpause.png diff --git a/build/index.htm b/build/index.htm index fa7bd88..d3f1d55 100644 --- a/build/index.htm +++ b/build/index.htm @@ -23,8 +23,27 @@ + +

PARTIE EN PAUSE

+ bouton de restart + bouton de derestart + +
+

VOUS AVEZ PERDU : (

+

+ +
+ +
+

VOUS AVEZ GAGNÉ : )

+

+ +
+ +

+
diff --git a/build/jeu.css b/build/jeu.css index bb8ab2a..c4ae1f5 100644 --- a/build/jeu.css +++ b/build/jeu.css @@ -7,10 +7,10 @@ body { height: 100%; background-image: url(background.jpg); - cursor: none; } #scene { + cursor: none; user-select: none; /*overflow: hidden;*/ @@ -28,6 +28,104 @@ body { box-shadow: none; } +#score { + font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; + right: 25px; + top: 25px; + color: black; + border-radius: 15px; + z-index: 4; + position: absolute; + background-color: wheat; + padding: 15px; +} + +#pause { + cursor: pointer; + z-index: 20; + position: absolute; + right: 50px; + top: 150px; +} + +#unpause { + display: none; + cursor: pointer; + z-index: 20; + position: absolute; + right: 50px; + top: 150px; +} + +#textepause { + margin: auto; + color: red; + padding: 15px; + background-color: black; + border: black; + display: none; + text-align: center; + font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; +} + +#victoire { + z-index: 40; + position: absolute; + display: none; + text-align: center; + justify-content: center; + + font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.603); + display: flex; + flex-direction: column; +} + +#victoire h1 { + justify-content: center; + margin-left: 37%; + width: 250px; + height: 75px; + padding: 50px; + background-color: green; +} + +#recommencer { + cursor: pointer; + border-radius: 15px; + width: 150; + height: 50; + padding: 25px; + background-color: wheat; + +} + +#defaite { + z-index: 40; + position: absolute; + display: none; + text-align: center; + justify-content: center; + + font-family: Impact, Haettenschweiler, 'Arial Narrow Bold', sans-serif; + width: 100%; + height: 100%; + background-color: rgba(0, 0, 0, 0.603); + display: flex; + flex-direction: column; +} + +#defaite h1 { + justify-content: center; + margin-left: 37%; + width: 250px; + height: 75px; + padding: 50px; + background-color: red; +} + #fullscreen { position: absolute; right: 10px; diff --git a/build/pause.png b/build/pause.png new file mode 100644 index 0000000000000000000000000000000000000000..863327c5d8687d97849cb81728e4205dfd70b4bf GIT binary patch literal 9759 zcmcgyc|6qH`~Qr=C^3Y(NhlR=B9#moT4XCEN%mIjWh@CZmeD4;XyGPgiK4R9MaYbq zu1ZVj2dGW-`q0e5iZt_jR}Ly}#cdUgL9~bI!A!^PK0rpA)^;!dPsf>_P~F z#7s>L_d$>V_*VcD5e7dWf?Ga;p9Q`qb^#D1UIqUls&To;K;yC#yAGbP#<`vdI_!TO z3JMBR_wexwIC|LkxH`_?EoDSc7J?KZQ^W21gHxGZUN3wGo!Z7m8xFfEA0FJFa%MGl zwYj(V837yj+upM6-=AK%f4#VFTyT=-SjlPK4ZqM?Mm-zSbPr)O+-<%~*lT1~wX#_2 z?5Vvb877N80@OEGuO%o?(PJ2|uegnt*p5sMh0_8#`J-+F$saB*ZTnQ%6Oqpk=wVcj zB2^xRP+PY$j#F)@iCg)h%Y21=b$mt2q%n&e1s#RuI=MY3D;8lQ+9Dzl!2>@=40_PN zV_|%ygO>#R4;mNk{V@l8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wNpM4+ zn%01N^S$j<1OrDV)J+#V>c<#)kj-`=D&vw8(e$*^b1zV}_+|S32h=O0>U<{Ym%{5f zHrtLSDSw;x2ZL7H=SLwI+M>4nR(z~+P58*uPc@}q~>A8EYPH5a! zt5wH&qN)bxSE<%rjh1yDKR34Zt0N|OLzmQ3qslp~{+i$9mZNb!lnluVHRiY8{^T7V zN0kbA&6~VWujw*eNlCU%tByPN@OLArkRX0JC)JZr4Z;;Eh}bqJFj?PCMrmzK&g7G%YLdulmEWoZfWw$+u(k=jMb&! zlqkG##l}8^3B(c-5k=1e4`b>41uqZrTL6Y^y zt_?JX#b_@fL}YC0IAtDmX8-f2y_NjX)4#dt<*@Sv54~Lj+nzbKz5u-+uG60S)lG)K zwsSMpL&b2OGA8p?Lf=AHWYpTPzJ8oLFxL6pbL^b1`lZ1iv-E$&b8_ig^Wg*$;G z>SN*tCt5cB*`}OoH|DF#-_U7tB_c*robuKeN#onv$gh|OC8)^l^7@RhJJ0;Zl{YDx zfi@Kr-&Qw1tA8y?Gx3S1+6-rR1(I^%PbIdgUxI;yqJEBR=~?UaGn4e)j_R586;Bpl zzNA$r`gHBBS&EbNg4lEGmifK4XZ#mBPgTwnt~g4iDQ!G_dZ$tJ%I^Ms!jbNgN~tL1 PUjTaN47G~R+J^rNu=Y9e literal 0 HcmV?d00001 diff --git a/source/Balle.ts b/source/Balle.ts index d4bae7d..a7dcedd 100644 --- a/source/Balle.ts +++ b/source/Balle.ts @@ -10,9 +10,9 @@ class Balle extends Anime { public multiplicateur : number; public vitesseMax : number; private coller : boolean; - private ecouteurSouris : any; + public ecouteurSouris : any; - private timerAnimation : number; + public timerAnimation : number; private scene_ : Jeu; @@ -53,7 +53,7 @@ class Balle extends Anime { private nx_ : number; private ny_ : number; - private bouger() { + public bouger() { if (this.coller) { this.nx_= this.scene_.palet_.getX() + this.scene_.palet_.getWidth()/2 - this.getWidth()/2; @@ -61,6 +61,11 @@ class Balle extends Anime { this.setXY(this.nx_,this.ny_) } + else if (this.scene_.compteurScore_ >= this.scene_.brique_.length) { + this.figer(); + this.scene_.palet_.figer(); + this.scene_.partieGagnee(); + } else { @@ -73,11 +78,13 @@ class Balle extends Anime { this.setXY(this.nx_, this.ny_); } + + } private vitesse() { - this.vitesseMax = 15; + this.vitesseMax = 8; this.multiplicateur = 1.05; this.vx *= this.multiplicateur; this.vy*= this.multiplicateur; @@ -101,6 +108,7 @@ class Balle extends Anime { if (this.ny_ >= this.ymax_) { this.figer(); this.scene_.palet_.figer(); + this.scene_.partiePerdue(); } else if (this.ny_ <= this.ymin_) { @@ -125,11 +133,13 @@ class Balle extends Anime { for (let i : number = 0; i; +public score_ : HTMLElement; +public scoreFin_ : HTMLElement; +public compteurScore_ : number; + +public defaite_ : HTMLElement; +public victoire_ : HTMLElement; + +public recommencer_ : HTMLElement; +public pause_ : HTMLElement; +public textePause_ : HTMLElement; +public unpause_ : HTMLElement; + public zone_ : Sprite; //-------------------------------------------------------------------------------------Constructeur @@ -22,6 +34,30 @@ public zone_ : Sprite; this.zone_.setXY(10,10); this.zone_.setWidth(this.getWidth()-20); this.zone_.setHeight(this.getHeight()-20); + + //Gestion des stats + this.compteurScore_ = 0; + this.score_ = document.getElementById('score'); + this.score_.textContent = "Score : " + this.compteurScore_; + + this.scoreFin_ = document.getElementById('scoreI'); + + //Gestion de la partie + this.defaite_ = document.getElementById('defaite'); + this.defaite_.style.display = 'none'; + + this.victoire_ = document.getElementById('victoire'); + this.victoire_.style.display = 'none'; + + this.recommencer_ = document.getElementById('recommencer'); + this.pause_ = document.getElementById('pause'); + this.textePause_ = document.getElementById('textepause'); + this.unpause_ = document.getElementById('unpause'); + + this.clique(); + + + } //--------------------------------------------------------------------------------------------start @@ -85,21 +121,73 @@ public zone_ : Sprite; + } + + public augmenterScore() { + this.compteurScore_ += 1; + this.score_.textContent = "Score : " + this.compteurScore_; + } + + public partieGagnee() { + this.scoreFin_.textContent = "Votre score : " + this.compteurScore_ + "/" + this.brique_.length; + this.victoire_.style.display = "block"; + } + + public partiePerdue() { + this.scoreFin_.textContent = "Votre score : " + this.compteurScore_ + "/" + this.brique_.length; + this.defaite_.style.display = "block"; + } + + public clique() { + this.recommencer_.addEventListener('click',this.recommencer.bind(this)); + this.pause_.addEventListener('click',this.pause.bind(this)); + this.unpause_.addEventListener('click',this.unpause.bind(this)); + } + + public recommencer() { + this.clean(); + setTimeout(() => { + this.start(); + }, 1500); + } //--------------------------------------------------------------------------------------------pause public override pause() { /* Ecrire ici le code qui met la scene en pause. */ + this.textePause_.style.display = "block"; + this.unpause_.style.display = "block"; + this.pause_.style.display = "none"; + this.balle_.figer(); + this.palet_.figer(); } //------------------------------------------------------------------------------------------unpause public override unpause() { /* Ecrire ici le code qui sort la scene de la pause. */ + this.textePause_.style.display = "none"; + this.unpause_.style.display = "none"; + this.pause_.style.display = "block"; + + this.balle_.animer(); + this.palet_.animer(); } //--------------------------------------------------------------------------------------------clean public override clean() { /* Ecrire ici le code qui nettoie la scene en vue d'un redemarrage. */ + this.defaite_.style.display = "none"; + this.victoire_.style.display = "none"; + + this.compteurScore_ = 0; + this.score_.textContent = "Score : " + this.compteurScore_; + + this.removeChild(this.balle_); + this.removeChild(this.palet_); + + for (let i : number = 0; i < this.brique_.length; i++) { + this.brique_[i].setXY(-1000000,-1000000); + } } } diff --git a/source/Palet.ts b/source/Palet.ts index 09f8fc6..cbaa33a 100644 --- a/source/Palet.ts +++ b/source/Palet.ts @@ -23,8 +23,6 @@ class Palet extends Anime { if (nx <= this.xmin_) nx = this.xmin_; if (nx >= this.xmax_) nx = this.xmax_; - console.log(this.xmax_); - this.setX(nx); }