-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
69 lines (27 loc) · 1.28 KB
/
main.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
var cookies = 0;
function cookieClick(number){
cookies = cookies + number;
document.getElementById("cookies").innerHTML = cookies;
};
function Test() {
cookieClick(180);
document.getElementById('MilkshakeButton').src='Rambo2.png'
}
function Test2() {
document.getElementById('MilkshakeButton').src='Rambo.png'
}
var cursors = 0;
function buyCursor(){
var cursorCost = Math.floor(10 * Math.pow(1.1,cursors)); //works out the cost of this cursor
if(cookies >= cursorCost){ //checks that the player can afford the cursor
cursors = cursors + 1; //increases number of cursors
cookies = cookies - cursorCost; //removes the cookies spent
document.getElementById('cursors').innerHTML = cursors; //updates the number of cursors for the user
document.getElementById('cookies').innerHTML = cookies; //updates the number of cookies for the user
};
var nextCost = Math.floor(10 * Math.pow(1.1,cursors)); //works out the cost of the next cursor
document.getElementById('cursorCost').innerHTML = nextCost; //updates the cursor cost for the user
};
window.setInterval(function(){
cookieClick(cursors);
}, 1000);