-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
64 lines (54 loc) · 1.83 KB
/
index.html
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<!--Juego de Memorizacipon-->
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Afina tu Memoria</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div id="score" class="score">
<p>Puntuación</p>
<label>Nivel: 1</label>
<label>Aciertos: 0</label>
</div>
<div class="gameboard">
<div id="celeste" class="color celeste left" data-color="celeste"></div>
<div id="violeta" class="color violeta right" data-color="violeta"></div>
<div id="naranja" class="color naranja left" data-color="naranja"></div>
<div id="verde" class="color verde right" data-color="verde"></div>
<button id="btnEmpezar" class="btn-start" onclick="empezarJuego()">Empezar a jugar!</button>
</div>
<div id="start" class="start hide">
<span class="count-down" id="countDown">5</span>
</div>
<script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script>
<script src="juego.js"></script>
<script>
const celeste = document.getElementById('celeste')
const violeta = document.getElementById('violeta')
const naranja = document.getElementById('naranja')
const verde = document.getElementById('verde')
const btnEmpezar = document.getElementById('btnEmpezar')
const start = document.getElementById('start')
const score = document.getElementById('score')
function empezarJuego() {
start.classList.toggle('hide')
sleep(3);
}
function sleep(seconds) {
if (seconds < 0) {
start.classList.toggle('hide')
window.juego = new Juego()
return;
}
start.children.item(0).textContent = seconds;
setTimeout(() => {
sleep(seconds - 1);
}, 1000);
}
</script>
</body>
</html>