diff --git a/views/pages/home.ejs b/views/pages/home.ejs index 33907e8..71a159e 100644 --- a/views/pages/home.ejs +++ b/views/pages/home.ejs @@ -42,7 +42,13 @@ // Handle Start Game Classic document.getElementById('start-game-classic').addEventListener('click', () => { const playerCount = document.getElementById('player-count').value; - window.location.href = `/game/classic/${playerCount}`; + let gameMode; + if (playerCount === '3p') { + gameMode = 'classic-3p'; + } else if (playerCount === '4p') { + gameMode = 'classic-4p'; + } + window.location.href = `/game?type=queue&gameMode=${gameMode}`; }); diff --git a/views/pages/rooms.ejs b/views/pages/rooms.ejs index 85dc9ec..a3ae44b 100644 --- a/views/pages/rooms.ejs +++ b/views/pages/rooms.ejs @@ -54,14 +54,22 @@ // Handle Join Room document.getElementById('join-room').addEventListener('click', () => { const roomId = document.getElementById('room-id').value; - window.location.href = `/game/custom/${roomId}`; + window.location.href = `/game?type=join&roomId=${roomId}`; }); // Handle Create Room document.getElementById('create-room').addEventListener('click', () => { - const gameMode = document.getElementById('game-mode').value; + const selectedGameMode = document.getElementById('game-mode').value; const playerCount = document.getElementById('player-count').value; - window.location.href = `/game/custom/${gameMode}/${playerCount}`; + let gameMode; + if (selectedGameMode === "classic") { + if (playerCount === "3p") { + gameMode = "classic-3p"; + } else if (playerCount === "4p") { + gameMode = "classic-4p"; + } + } + window.location.href = `/game?type=create&gameMode=${gameMode}`; });