From d7a054cd1fa90c32a86ac11c4b98034212b4d413 Mon Sep 17 00:00:00 2001 From: Guerrero96 Date: Mon, 15 Apr 2024 19:51:54 -0500 Subject: [PATCH] html ready up button --- html/index.html | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/html/index.html b/html/index.html index 585d204..6216920 100644 --- a/html/index.html +++ b/html/index.html @@ -60,6 +60,7 @@ +
Waiting for players...
Players in Lobby:
@@ -88,6 +89,7 @@ document.getElementById("lobby-status").innerHTML = "Waiting for other players..."; } else if (msg.action === "join") { document.getElementById("lobby-status").innerHTML = "Joined the game!"; + document.getElementById("readyButton").style.display = "inline"; // Show ready button after joining } }; @@ -109,6 +111,13 @@ alert("Please enter a username."); } }); + + // Add event listener for the Ready Up button + document.getElementById("readyButton").addEventListener("click", function() { + // Send a message to the server indicating that the player is ready + connection.send(JSON.stringify({ action: "ready" })); + document.getElementById("readyButton").disabled = true; // Disable the button after clicking + });