ソースを参照

improved interface

master
mort 8年前
コミット
33840a95c6
2個のファイルの変更16行の追加1行の削除
  1. 15
    1
      es/script.js
  2. 1
    0
      index.html

+ 15
- 1
es/script.js ファイルの表示

@@ -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 ファイルの表示

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

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


読み込み中…
キャンセル
保存