added rudimentary start screen
This commit is contained in:
parent
3cc0125afb
commit
50bd1b8763
|
|
@ -1,14 +1,23 @@
|
||||||
/*Add events to webpage*/
|
/*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("keydown", getKey)
|
||||||
document.addEventListener("keyup", stop)
|
document.addEventListener("keyup", stop)
|
||||||
setInterval(move, 10);
|
setInterval(move, 10);
|
||||||
document.getElementById("start").addEventListener("click", startGame)
|
document.getElementById("start").addEventListener("click", startGame)
|
||||||
|
|
||||||
|
showDisplay("none");
|
||||||
|
document.getElementById("start").style.display = "block";
|
||||||
}
|
}
|
||||||
|
|
||||||
function startGame() {
|
function startGame() {
|
||||||
var button = document.getElementById("start");
|
showDisplay("block");
|
||||||
button.style.display = "none";
|
document.getElementById("start").style.display = "none";
|
||||||
}
|
}
|
||||||
document.addEventListener("DOMContentLoaded", loadScripts);
|
document.addEventListener("DOMContentLoaded", load);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue