-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
164 lines (146 loc) · 5.48 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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
<html>
<style>
.coinsbutton {
margin-top:50px;
border-radius: 0px;
width:150px;
height: 150px;
background-color: red;
color: white;
}
.upgradebutton {
margin-top:50px;
border-radius: 0px;
width:150px;
height: 150px;
background-color: blue;
color: white;
}
.cpsbutton {
margin-top:50px;
border-radius: 0px;
width:150px;
height: 150px;
background-color: green;
color: white;
}
.resetbutton {
border-radius: 0px;
width:150px;
height: 150px;
background-color: red;
color: white;
}
#codeInput{
width: 100%;
height: 30%;
font-size: 30px;
}
.codeArea{
float: right;
border: black solid 1px;
width: 250px;
height: 200px;
}
.codeButton{
width: 100%;
height: 70%;
}
</style>
<body>
<button id="resetButton" class="resetbutton" onclick="ClearData()">Klik Om te opnieuw te begginen (Gebruik op eigen risico!)</button>
<div class="codeArea">
<input id="codeInput" placeholder='Geheime Code!'>
<button class="codeButton" onclick="CheckCode()">Check de code</button>
</div>
<div style="text-align: center;margin-top:200px">
<div id="pointsDiv" style="font-size: 30px"></div>
<div>
<button id="cpsButton" onclick="onCps()" class="cpsbutton"></button>
<button onclick="onCoinsClick()" class="coinsbutton">Klik voor Coins</button>
<button id="upgradeButton" onclick="onUpgrade()" class="upgradebutton"></button>
</div>
</div>
</body>
<script>
let points = localStorage.getItem('points') == null ? 0 : parseInt(localStorage.getItem('points'));
let upgrade = localStorage.getItem('upgrade') == null ? 1 : parseInt(localStorage.getItem('upgrade'));
let upgradePrice = localStorage.getItem('upgradePrice') == null ? 1 : parseInt(localStorage.getItem('upgradePrice'));
let buttonText = "Klik om te upgraden Kost:";
let cps = localStorage.getItem('cps') == null ? 1 : parseInt(localStorage.getItem('cps'));
let cpsPrice = localStorage.getItem('cpsPrice') == null ? 1 : parseInt(localStorage.getItem('cpsPrice'));
setButtonText();
setCps();
setCpsButton();
function onCoinsClick() {
points = points + (upgrade * 1);
document.getElementById('pointsDiv').innerText = points;
store();
}
function onUpgrade() {
if (points >= upgradePrice) {
points = points - upgradePrice;
document.getElementById('pointsDiv').innerText = points;
upgradePrice = upgradePrice * 4;
setButtonText();
upgrade = upgrade * 3;
store();
} else {
alert('Je hebt niet genoeg Coins om te upgraden');
}
}
function setButtonText(){
document.getElementById('upgradeButton').innerText = buttonText + upgradePrice;
}
function setCps() {
points = points + cps;
document.getElementById('pointsDiv').innerText = points;
setTimeout(function() { setCps();}, 1000);
store();
}
function onCps() {
if (points >= cpsPrice) {
points = points - cpsPrice;
document.getElementById('pointsDiv').innerText = points;
cpsPrice = cpsPrice * 4;
cps = cps * 2;
document.getElementById('cpsButton').innerText = 'Klik om automatische coins te upgraden Kost:' + cpsPrice;
store();
} else {
alert('Je hebt niet genoeg Coins om dat te upgraden')
}
}
function setCpsButton() {
document.getElementById('cpsButton').innerText = 'Klik om automatische coins te upgraden Kost:' + cpsPrice;;
}
function store() {
localStorage.setItem('points', points);
localStorage.setItem('upgrade', upgrade);
localStorage.setItem('upgradePrice', upgradePrice);
localStorage.setItem('cps', cps);
localStorage.setItem('cpsPrice', cpsPrice);
}
function ClearData() {
if (confirm('Weet je het zeker?') == true) {
points = 0;
cps = 1;
cpsPrice = 1;
upgradePrice = 1;
upgrade = 1;
store();
} else {
alert('Niet opnieuw begonnen')
}
}
function CheckCode() {
if (document.getElementById('codeInput').value == 'groep8a=beste') {
points += 10000000;
document.getElementById('codeInput').value = '';
alert('Je hebt de Geheime Code geraden!')
} else {
document.getElementById('codeInput').value = '';
alert('Teletubbies Lala, Po O-OOH. Je hebt het fout. Tip:Geen Hoofdletters.')
}
}
</script>
</html>