forked from JohnnyBC2022/ZombiesDevGame
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscript6.js
More file actions
25 lines (21 loc) · 654 Bytes
/
script6.js
File metadata and controls
25 lines (21 loc) · 654 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
document.addEventListener("keydown", function (event) {
if (event.key === "Enter") {
const puntosActuales = obtenerPuntos();
if (puntosActuales > 0) {
window.location.href = "../story/story-kitchen.html";
} else {
window.location.href = "../game-over.html";
}
}
});
document.addEventListener("DOMContentLoaded", function () {
actualizarPuntuacion();
});
function actualizarPuntuacion() {
const puntosElement = document.getElementById("points");
const puntosActuales = obtenerPuntos();
puntosElement.textContent = puntosActuales;
}
function obtenerPuntos() {
return parseInt(localStorage.getItem("puntos"));
}