From 568e353bb0a2ec5db0150ac693a5f464c5c4dc25 Mon Sep 17 00:00:00 2001 From: Mathis Decoster <mathis.decoster.etu@univ-lille.fr> Date: Mon, 8 Apr 2024 10:01:56 +0200 Subject: [PATCH] =?UTF-8?q?update=20pour=20imunit=C3=A9=20avatar=20quand?= =?UTF-8?q?=20il=20ne=20joue=20pas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/main.js | 2 +- client/src/scoreboard.json | 21 +++++++++++++++++++++ server/index.js | 5 ++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/client/src/main.js b/client/src/main.js index 32989bf..e429789 100644 --- a/client/src/main.js +++ b/client/src/main.js @@ -165,7 +165,7 @@ document.addEventListener('keyup', handleKeyEvent); function handleKeyEvent(event) { keysPressed[event.keyCode] = event.type === 'keydown'; - if (event.key === ' ') { + if (event.key === ' ' && gameStarted) { socket.emit('shoot', { id: `${socket.id}`, shoot: true, diff --git a/client/src/scoreboard.json b/client/src/scoreboard.json index 87bdae8..1b0217e 100644 --- a/client/src/scoreboard.json +++ b/client/src/scoreboard.json @@ -76,6 +76,27 @@ "nom": "uu", "score": -15 }, + { + "score": -15 + }, + { + "score": -15 + }, + { + "score": -15 + }, + { + "score": -35 + }, + { + "score": 0 + }, + { + "score": -15 + }, + { + "score": -15 + }, { "score": -15 } diff --git a/server/index.js b/server/index.js index e2ced25..9efc6a0 100644 --- a/server/index.js +++ b/server/index.js @@ -325,7 +325,10 @@ function handleAvatarBonusCollisions(avatar) { if (bonus.hitbox.colision(avatar.hitbox)) { if (bonusNoms[bonus.getChoix()] == 'vie') { avatar.gagnerVie(); - } else if (bonusNoms[bonus.getChoix()] == 'invincibilite') { + } else if ( + bonusNoms[bonus.getChoix()] == 'invincibilite' || + !gameStarted + ) { avatar.setStatut('invincibilite'); avatar.setStatutTime(t.getTotalTime()); } -- GitLab