added username input on title screen

This commit is contained in:
2023-03-15 10:39:12 -07:00
parent 83438a275b
commit da67f0dc54
2 changed files with 22 additions and 1 deletions

View File

@ -49,4 +49,17 @@ button.play {
button.play:hover { button.play:hover {
background-color: #20b13f; background-color: #20b13f;
cursor: pointer; cursor: pointer;
}
input.username {
font-family: Baloo2, sans-serif;
font-size: 200%;
border: none;
padding: 4px 16px;
margin: 18px;
border-radius: 12px;
}
input.username:focus {
border: none;
outline: none;
} }

View File

@ -10,13 +10,21 @@
<h1 class="name"> <h1 class="name">
RUNIC RUNIC
</h1> </h1>
<input id="runic_username" class="username" placeholder="Username" maxlength="16"><br>
<button class="play" onclick="play()"> <button class="play" onclick="play()">
PLAY PLAY
</button> </button>
</div> </div>
<script> <script>
var usernameinput = document.getElementById("runic_username");
function play() { function play() {
window.location = "game.html"; var username = usernameinput.value;
if (username != "") {
window.location = "game.html" + "?name=" + username;
}
else {
window.location = "game.html";
}
} }
</script> </script>
</body> </body>