-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
88 lines (75 loc) · 2.45 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
<!DOCTYPE html>
<script>
var cookies = 0;
var numAutoClickers = 0;
var numGrowth = 0;
var cookiesPerSecond = 0;
function update()
{
document.getElementById('text').value = cookies;
document.getElementById('cps').innerHTML = 'you make ' + (numAutoClickers * (Math.pow(2, (numGrowth))))
+ ' cookies per second';
}
function addCookies()
{
cookies += (numAutoClickers * (Math.pow(2, (numGrowth))));
update();
}
function clickCookie()
{
cookies += Math.pow(2, numGrowth);
document.getElementById('text').value = cookies;
}
function load()
{
cookies = parseInt(localStorage.getItem("cookies"));
document.getElementById('text').value = cookies;
}
function save()
{
localStorage.setItem("cookies", cookies);
}
function buyAutoClicker()
{
if(cookies >= (numAutoClickers + 1) * 10)
{
cookies -= (numAutoClickers + 1) * 10;
numAutoClickers += 1;
document.getElementById('outputAutoClicker').innerHTML = 'you have ' + numAutoClickers + ' autoclickers';
document.getElementById('derp').innerHTML = 'buy an Auto Clicker (' + ((numAutoClickers + 1 ) * 10) + ')';
update();
}
}
function abuseGrowth()
{
if(cookies >= (numGrowth + 1) * 30)
{
cookies -= (numGrowth + 1) * 30;
numGrowth += 1;
document.getElementById('outputGrowth').innerHTML = 'you have abused exponential growth ' + numGrowth + ' times';
document.getElementById('growth').innerHTML = 'abuse exponential growth (' + ((numGrowth + 1) * 30) + ')';
update();
}
}
setInterval (addCookies, 1000)
</script>
<html>
<body>
<h1 class = "title">Best Clicker Game ever</h1>
<img src="../img/cookie.jpg" alt="we failed" onclick='clickCookie()' style="width:500px;height:500px;">
<br><br>
you got:
<input type = "text" id="text" disabled style = text-align:center>
Cookies
<p id = 'cps'> you make 0 cookies per second</p>
<button onclick='save()'> Save </button>
<button onclick = 'load()'> Load </button>
<br><br>
<p id ='outputAutoClicker'>you have 0 Auto Clickers</p>
<button id = "derp" onclick = 'buyAutoClicker()'> buy an Auto Clicker (10) </button>
<br>
<br>
<p id ='outputGrowth'>you have abused exponential growth 0 times</p>
<button id = "growth" onclick = 'abuseGrowth()'> abuse exponential growth (30)</button>
</body>
</html>