added reset button

This commit is contained in:
Yannik
2023-06-23 22:49:49 +02:00
parent 0561cf374c
commit 0c43d6d104
2 changed files with 10 additions and 0 deletions

View File

@@ -11,6 +11,7 @@
</head> </head>
<body onpageshow="load()"> <body onpageshow="load()">
<p onclick="resetGame()">&nbsp;<u>Reset</u></p>
<div hidden="true" class="box" id="fight"> <div hidden="true" class="box" id="fight">
<img draggable="false" id="enemy-texture"><br> <img draggable="false" id="enemy-texture"><br>
<p><span id="enemy-name"></span> Leben: <span id="enemy-health"></span></p> <p><span id="enemy-name"></span> Leben: <span id="enemy-health"></span></p>

View File

@@ -40,6 +40,15 @@ function load(isJump = false) {
nextDlg(false); //Skip to first nextDlg(false); //Skip to first
}); });
} }
function resetGame() {
if (confirm("Willst du wirklich deinen gesamten Fortschritt im Spiel löschen?") == true) {
localStorage.setItem("dlgPointer", "0");
localStorage.setItem("dlgKeyMain", "main");
localStorage.setItem("weaponDamage", "1");
localStorage.setItem("weaponName", "Fäuste");
location.reload();
}
}
//change current dialogue lines with dictionary keys //change current dialogue lines with dictionary keys
function changeDlg(dlgKey) { function changeDlg(dlgKey) {
if (typeof dlgFile[dlgKey] === "string") { if (typeof dlgFile[dlgKey] === "string") {