added rudimentary start screen

This commit is contained in:
Joshua Perry 2022-04-28 20:22:43 +01:00
parent 3cc0125afb
commit 50bd1b8763
1 changed files with 13 additions and 4 deletions

View File

@ -1,14 +1,23 @@
/*Add events to webpage*/
function loadScripts() {
function showDisplay(mode) {
for (let element of document.body.getElementsByTagName("*")) {
element.style.display = mode;
}
}
function load() {
document.addEventListener("keydown", getKey)
document.addEventListener("keyup", stop)
setInterval(move, 10);
document.getElementById("start").addEventListener("click", startGame)
showDisplay("none");
document.getElementById("start").style.display = "block";
}
function startGame() {
var button = document.getElementById("start");
button.style.display = "none";
showDisplay("block");
document.getElementById("start").style.display = "none";
}
document.addEventListener("DOMContentLoaded", loadScripts);
document.addEventListener("DOMContentLoaded", load);