From 6448c4385d69ea65b5c3512afe40372136b9c299 Mon Sep 17 00:00:00 2001 From: Rayane Belguebli <rayane.belguebli.etu@univ-lille.fr> Date: Mon, 8 Apr 2024 11:46:13 +0200 Subject: [PATCH] =?UTF-8?q?fix=20hitbox=20et=20add=20css=20scoreboard=20&?= =?UTF-8?q?=20cr=C3=A9dits?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/public/css/main.css | 22 ++++++++++++++++++++++ client/public/res/scoreboard.json | 12 ++++++++++++ client/src/setHtml.js | 21 +++++++++++---------- server/Projectile.js | 2 +- server/ScoreBoard.js | 4 ++-- server/enemis.js | 13 ++----------- server/index.js | 2 +- 7 files changed, 51 insertions(+), 25 deletions(-) diff --git a/client/public/css/main.css b/client/public/css/main.css index fedccf3..945b210 100644 --- a/client/public/css/main.css +++ b/client/public/css/main.css @@ -29,6 +29,28 @@ h1 em { color: #777; } +h3 { + font-family: 'New Super Mario Font U', sans-serif; + color: #1341d6; + font-size: 50px; +} +h3 em { + font-style: normal; + font-weight: bold; + color: #777; +} + +h4 { + font-family: 'New Super Mario Font U', sans-serif; + color: #1341d6; + font-size: 25px; +} +h4 em { + font-style: normal; + font-weight: bold; + color: #777; +} + canvas { background-color: #000000; border: 3px dashed #777; diff --git a/client/public/res/scoreboard.json b/client/public/res/scoreboard.json index 6939e19..fa41906 100644 --- a/client/public/res/scoreboard.json +++ b/client/public/res/scoreboard.json @@ -142,6 +142,18 @@ }, { "score": -15 + }, + { + "nom": "rayane", + "score": 0 + }, + { + "nom": "raayne*", + "score": -15 + }, + { + "nom": "rayane", + "score": -15 } ] } \ No newline at end of file diff --git a/client/src/setHtml.js b/client/src/setHtml.js index 7f7378f..d2678b6 100644 --- a/client/src/setHtml.js +++ b/client/src/setHtml.js @@ -1,16 +1,17 @@ export default class setHtml { static credits() { return ` - <p>Julien Bouin 33%</p> - <p> Pseudo : Jogz </p> - <p> jeu préféré : Rocket League </p> - <p>Rayane Belguebli 33%</p> - <p> Pseudo : Rayanou </p> - <p> jeu préféré : Fifa </p> - <p>Mathis Decoster 33%</p> - <p>pseudo: Wakly</p> - <p>jeu préféré : Teamfight Tactics</p> - <p>Groupe H</p> + <h3>Groupe H</h3> + <h4> + <br> + <p>- Julien Bouin 33% / Pseudo : Jogz / jeu préféré : Rocket League </p> + <br> + <p>- Rayane Belguebli 33% / Pseudo : Rayanou / jeu préféré : Fifa </p> + <br> + <p>- Mathis Decoster 33% / pseudo: Wakly / jeu préféré : Teamfight Tactics</p> + <br> + + </h4> <button class="retourMenu">Retour au menu</button>`; } diff --git a/server/Projectile.js b/server/Projectile.js index 65e4717..07be489 100644 --- a/server/Projectile.js +++ b/server/Projectile.js @@ -6,7 +6,7 @@ export class Projectile extends Entite { vitesse; constructor(x, y, image) { - super(x, y, new Hitbox(122, 68, x, y), image); + super(x, y, new Hitbox(122 / 2, 68, x, y), image); this.vitesse = 10; } diff --git a/server/ScoreBoard.js b/server/ScoreBoard.js index 6c8bdf4..98fa4b2 100644 --- a/server/ScoreBoard.js +++ b/server/ScoreBoard.js @@ -13,12 +13,12 @@ export class GestionScore { scores.results.sort((a, b) => b.score - a.score); let html = - '<table><thead><tr><th>Nom</th><th>Score</th></tr></thead><tbody>'; + '<table><thead><tr><th><h4>Nom</h4></th><th><h4>Score</h4></th></tr></thead><tbody>'; const numberOfResults = Math.min(10, scores.results.length); for (let i = 0; i < numberOfResults; i++) { const result = scores.results[i]; - html += `<tr><td>${result.nom}</td><td>${result.score}</td></tr>`; + html += `<tr><td><h4>${result.nom}</h4></td><td><h4>${result.score}</h4></td></tr>`; } html += '</tbody></table>'; diff --git a/server/enemis.js b/server/enemis.js index cc61a3f..adf4385 100644 --- a/server/enemis.js +++ b/server/enemis.js @@ -10,11 +10,11 @@ export default class enemi extends Entite { difficulté; constructor(x, y, image, difficulté) { - super(x, y, new Hitbox(50 / 2, 66, x, y), image); + super(x, y, new Hitbox(50 / 3, 66 / 2, x, y), image); if (difficulté == 1) { this.vx = 3; this.vy = 0; - this.hitbox = new Hitbox(69 / 2, 57, this.x, this.y); + this.hitbox = new Hitbox(69 / 3, 57 / 2, this.x, this.y); } else if (difficulté == 2) { this.vx = 5; this.vy = 1; @@ -29,15 +29,6 @@ export default class enemi extends Entite { this.positionInitialeY = y; } - colision(x, y, image) { - return ( - x >= this.x && - x <= this.x + image.width && - y >= this.y && - y <= this.y + image.height - ); - } - getVies() { return this.vies; } diff --git a/server/index.js b/server/index.js index 672f8e0..24fdba5 100644 --- a/server/index.js +++ b/server/index.js @@ -308,7 +308,7 @@ function handleAvatarProjectileCollisions(avatar) { canLostLifeEnemi = false; setTimeout(function () { canLostLifeEnemi = true; - }, 1000 / 60); + }, 100); } } }); -- GitLab