-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
104 lines (99 loc) · 4.17 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta http-equiv="Content-Security-Policy" content="default-src * data: gap: https://ssl.gstatic.com; style-src * 'unsafe-inline'; script-src * 'unsafe-inline' 'unsafe-eval'">
<link rel="stylesheet" href="components/loader.css">
<link rel="stylesheet" href="css/style.css">
<script src="components/loader.js"></script>
<script src="js/NoSleep.js"></script>
<script>
var clicks = 0;
function monsterCatched(id)
{
if (document.getElementById(id).getAttribute('src') != "./img/MonsterCrossedOut.png") {
document.getElementById(id).src = "./img/MonsterCrossedOut.png";
clicks += 1;
}
if (clicks >= 9) {
navigator.vibrate([60,60,180]);
wonAndNewGame = confirm('Herzlichen Glückwunsch, Du hast gewonnen!\nNoch eine Runde?');
if (wonAndNewGame) {
startNewGame();
}
}
}
function startNewGame() {
clicks = 0;
for (var i = 1; i < 11; i++) {
document.getElementById("Monster" + i).src = "./img/" + i + ".png";
}
}
function newGameOnConfirm() {
/*Abfragen reduzieren für einen schnelleren Spielverlauf
resetGame = confirm('Neues Spiel?');
if (resetGame) {
startNewGame();
}*/
startNewGame();
}
function toggleDarkness() {
var element = document.body;
element.classList.toggle("dark-mode");
if (document.getElementById('toggleDarknessOption').getAttribute('src') == "./img/darkmode_black.png") {
document.getElementById('toggleDarknessOption').src = "./img/darkmode_white.png";
document.getElementById('NewGame').src = "./img/nochmal_white.png";
} else {
document.getElementById('toggleDarknessOption').src = "./img/darkmode_black.png";
document.getElementById('NewGame').src = "./img/nochmal_black.png";
}
}
window.onload = (event) => {
var noSleep = new NoSleep();
noSleep.enable();
};
</script>
</head>
<body>
<center>
<h1>MonsterDicer</h1>
<h2>A Monster slicing dice game</h2>
</center>
<br>
<table align="center">
<tr>
<td align="center"><img class="rotatingMonster" id="Monster1" onclick="monsterCatched('Monster1')" src="./img/1.png" width="110"></td>
<td align="center"><img class="rotatingMonster" id="Monster2" onclick="monsterCatched('Monster2')" src="./img/2.png" width="110"></td>
<td align="center"><img class="rotatingMonster" id="Monster3" onclick="monsterCatched('Monster3')" src="./img/3.png" width="110"></td>
</tr>
<tr>
<td align="center"><img class="rotatingMonster" id="Monster4" onclick="monsterCatched('Monster4')" src="./img/4.png" width="110"></td>
<td align="center"><img class="rotatingMonster" id="Monster5" onclick="monsterCatched('Monster5')" src="./img/5.png" width="110"></td>
<td align="center"><img class="rotatingMonster" id="Monster6" onclick="monsterCatched('Monster6')" src="./img/6.png" width="110"></td>
</tr>
<tr>
<td align="center"><img class="rotatingMonster" id="Monster7" onclick="monsterCatched('Monster7')" src="./img/7.png" width="110"></td>
<td align="center"><img class="rotatingMonster" id="Monster8" onclick="monsterCatched('Monster8')" src="./img/8.png" width="110"></td>
<td align="center"><img class="rotatingMonster" id="Monster9" onclick="monsterCatched('Monster9')" src="./img/9.png" width="110"></td>
</tr>
<tr>
<td align="center"></td>
<td align="center"></td>
<td align="center"></td>
</tr>
<tr>
<td align="center"><p onclick="toggleDarkness()"><img id="toggleDarknessOption" src="./img/darkmode_black.png" width="55"><br>Dark Mode</p></td>
<td align="center"></td>
<td align="right"><p onclick="newGameOnConfirm()"><img id="NewGame" src="./img/nochmal_black.png" width="55"><br>Nochmal!</p></td>
</tr>
</table>
<br>
<br>
<br>
<p align = "center">
Dies ist die Webumsetzung der Companion App zu MonsterDicer, a monster slicing dice game. Mehr auf
<a href="#" onclick="window.open('http://www.monsterdicer.com', '_system', 'location=yes');">http://www.monsterdicer.com</a>
</p>
</body>
</html>