-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
47 lines (40 loc) · 1.09 KB
/
index.js
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
let scoreText = document.getElementById("scoreText");
let biscuitButton = document.querySelector("#biscuitButton");
let resetButton = document.getElementById("resetButton");
let buyAutoClicker = document.getElementById("buyAutoClicker");
let score = 0;
let amountOfAutoClickers = 0;
let canClick = true;
biscuitButton.onclick = function() {
if (canClick) {
score++;
scoreText.innerText = score;
canClick = false;
setTimeout( function() {
canClick = true;
}, 300);
}
}
resetButton.onclick = function() {
score = 0;
amountOfAutoClickers = 0;
scoreText.innerText = score;
}
buyAutoClicker.onclick = function() {
if (score < 100) {
console.log("no mony");
} else {
score -= 100;
amountOfAutoClickers++;
setInterval(autoClick, 1000);
}
function autoClick() {
scoreText.innerText = score;
score += amountOfAutoClickers;
scoreText.innerText = score;
}
}
/**function incrementScore() {
score++;
scoreText.innerText = score;
}**/