diff --git a/client/index.html b/client/index.html index f60bc22..e02102a 100644 --- a/client/index.html +++ b/client/index.html @@ -15,6 +15,12 @@ const socket = io(); let myRole = null; console.log("Connecte au serveur, id :", socket.id); + + socket.on("new_round", (startPos) => { + player.x = startPos.x; + player.y = startPos.y; + }); + socket.on("role", (role) => { console.log("Mon role :", role); myRole = role; @@ -87,6 +93,12 @@ drawPlayer(); } + function showGameOver(message){ + document.getElementById("gameOverMessage").textContent = message; + document.getElementById("gameOverScreen").style.display = "block"; + myRole = null; + } + document.addEventListener("keydown", (e) => { if (myRole !== "explorateur") return; @@ -114,9 +126,13 @@ if (result.correct){ console.log("Bonne porte ! Victoire (pour cette manche)."); } else { - console.log("Mauvaise porte. Partie terminee."); + showGameOver("Mauvaise porte. Vous avez perdu."); } }) +