forked from taxes-bad/tax-free-society
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauto.js
23 lines (20 loc) · 944 Bytes
/
auto.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//setting up the variables for ease of reference
var money = ""
var AutoPrinters = ""
var AutoPrinterCost = 10
function BuyAutoPrinter() {
if (money >= AutoPrinterCost) {
money = money - AutoPrinterCost;
AutoPrinters++;
AutoPrinterCost = Math.round(AutoPrinterCost * 1.2);
document.getElementById('TotalMoney').innerHTML = money;
document.getElementById('TotalAutoPrinters').innerHTML = AutoPrinters;
document.getElementById('AutoPrinterCost').innerHTML = AutoPrinterCost;
}
}
//making the auto printers automatically print money.
var autoPrinting = setInterval(function() {money = money + AutoPrinters, document.getElementById('TotalMoney').innerHTML = money} , 1000)
//1000ms = 1 second
document.getElementById('TotalMoney').innerHTML = money;
document.getElementById('AutoPrinterCost').innerHTML = AutoPrinterCost;
document.getElementById('TotalAutoPrinters').innerHTML = AutoPrinters;