Browse Source

improved interface

master
mort 8 years ago
parent
commit
33840a95c6
2 changed files with 16 additions and 1 deletions
  1. 15
    1
      es/script.js
  2. 1
    0
      index.html

+ 15
- 1
es/script.js View File

@@ -17,4 +17,18 @@ function startGame() {
}

document.querySelector("#startGameBtn").addEventListener("click", startGame);
document.querySelector("#restartGameBtn").addEventListener("click", startGame);
document.querySelector("#restartGameBtn").addEventListener("click", () => {
location.hash = "game";
location.reload();
});
document.querySelector("#storyBtn").addEventListener("click", () => {
location.hash = "";
location.reload();
});

window.addEventListener("load", () => {
if (location.hash.substring(1) === "game") {
startGame();
console.log("starting");
}
});

+ 1
- 0
index.html View File

@@ -77,6 +77,7 @@

<div class="view game-over">
<h1>Game over.</h1>
<button id="storyBtn">Back</button>
<button id="restartGameBtn">Restart</button>
</div>


Loading…
Cancel
Save