Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <head>
- <title>Idle Cola Factory</title>
- <script>
- var clicker = (
- colas:0,
- upgrades: {
- colas_machine:{
- amount:0,
- cost:10,
- cps:1,
- name:"Cola Machine"
- }
- }
- );
- function thing_clicked(thing){
- clicker.upgrades[thing].amount++
- update_upgrades();
- ]
- function thing_clicked(thing){
- if(clicker.upgrades[thing.cost <= clicker.colas]){
- clicker.colas-=clicker.upgrades[thing].cost;
- clicker.upgrades.amount[thing]++;
- clicker.upgrades[thing].cost += Math.round(clicker.upgrades[thing].cost*0.15)
- update_upgrades();
- }
- }
- function update_upgrades(){
- document.querySelector("#upgrades").innerHTML="";
- }
- function updatecount(){
- setInterval(() =>{
- for{i in clicker.upgrades){
- clicker.colas+=clicker.upgrades[i].amount*clicker.upgrades[1].cps/20
- }
- document.querySelector("#colas").innerHTML = "You Have "+String(clicker.colas).split(".")[0]+ colas"
- },50];
- }
- </script>
- </head>
- <body onload="updatecount()">
- <h1 id="colas">You Have Made 0 Colas.</h1>
- <button onclick="
- clicker.colas++">Make 1 Cola</button>
- <div id="upgrades">
- </div>
- </body>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement