Advertisement
ithortureu

Untitled

Aug 10th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.    
  2.       //declare variables for points, multiplier, buy upgrade, b1 2 and 3 cost and count, make point updater
  3.     var points = 999999;
  4.     var clickcount = 0;
  5.     var pointMulti = 1;
  6.     var buyupgrade = 0;
  7.     var b1cost = 200;
  8.     var b1count = 0;
  9.     var b1multi = 1;
  10.     var b1pps = (b1count * 1) * b1multi;
  11.     var b2cost = 1000;
  12.     var b2count = 0;
  13.     var b2multi = 1;
  14.     var b2pps = (b2count * 4) * b2multi;
  15.     var b3cost  = 2000;
  16.     var b3count = 0;
  17.     var b3multi = 1;
  18.     var b3pps = (b3count * 10) * b3multi;
  19.     var b4cost = 4500;
  20.     var b4count = 0;
  21.     var b4multi = 1;
  22.     var b4pps = (b4count * 24) * b4multi;
  23.     var b5cost = 10000;
  24.     var b5count = 0;
  25.     var b5multi = 1;
  26.     var b5pps = (b5count * 56) * b5multi;
  27.     var b6cost = 25000;
  28.     var b6count = 0;
  29.     var b6multi = 1;
  30.     var b6pps = (b6count * 130) * b6multi;
  31.     var b7cost = 60000;
  32.     var b7count = 0;
  33.     var b7multi = 1;
  34.     var b7pps = (b7count * 315) * b7multi;
  35.     var b1m1cost = 1500;
  36.     var b1m1count = 0;
  37.     var b2m1cost = 4000;
  38.     var b2m1count = 0;
  39.     var b3m1count = 0;
  40.     var b3m1cost = 11000;
  41.     var ppstotal = 0;
  42.     var pointsfromclick = 0;
  43.     var totalpoints = 0;
  44.     var totalbuild = 0;
  45.     var statupdate = setInterval(updatestats, 250);
  46.     var currentpoints = setInterval(pointupdate, 250);
  47.    
  48.     //clicking on main button to add points
  49.     function addPoints() {
  50.         points += pointMulti;
  51.         clickcount++;
  52.         pointsfromclick += pointMulti;
  53.         totalpoints += pointMulti;
  54.         document.getElementById("clickcount").innerHTML = "You have " + clickcount + " total clicks.";
  55.         document.getElementById("pointsfromclick").innerHTML = "You have made " + pointsfromclick + " bread objects from clicking.";
  56.         document.getElementById("totalpointcount").innerHTML = "You have made " + totalpoints + " total bread objects.";
  57.         var pointsArea = document.getElementById("pointdisplay");
  58.         pointsArea.innerHTML = "You have " + Math.round(points) + " bread objects!";
  59.             if(points >= 100 && buyupgrade === 0) {
  60.             var multiply_button = document.getElementById("btn_multiply");
  61.             multiply_button.style.display = "inline";
  62.         }
  63.     }
  64.    
  65.     //make logic for doubling addpoints
  66.     function firstx2() {
  67.       if (buyupgrade === 0) {
  68.         pointMulti *= 2;
  69.         buyupgrade++;
  70.         points -= 100;
  71.         var multiplierArea = document.getElementById("multidisplay");
  72.         multiplierArea.innerHTML = "Your multiplier is: " + pointMulti;
  73.         var multiply_button = document.getElementById("btn_multiply");
  74.         multiply_button.style.display = "none";
  75.        
  76.       //logic for displaying first building upgrade
  77.       if (buyupgrade === 1) {
  78.         var firstbuild = document.getElementById("firstbuild");
  79.         firstbuild.style.display = "inline";
  80.         firstbuild.innerText = "Sliced bread maker. Cost " + Math.round(b1cost);
  81.        
  82.         var show2ndx2 = document.getElementById("secondx2");
  83.         multiply2.style.display = "inline";
  84.       }
  85.      
  86.       }
  87.     }
  88.    
  89.     //displays total points
  90.     function pointupdate() {
  91.       document.getElementById("pointdisplay").innerHTML = "You have " + Math.round(points) + " bread objects!";
  92.     }
  93.    
  94.     //what happens when you click first building button
  95.     function build1() {
  96.       if (points >= b1cost) {
  97.         points -= b1cost;
  98.         b1count++;
  99.         b1cost *= 1.10;
  100.         totalbuild++;
  101.         var build1add = setInterval(build1points, 1000);
  102.         updatepps();
  103.         //var b1multi = 1;
  104.         //var b1pps = (b1count * b1multi);
  105.         document.getElementById("b1").innerHTML = "You have " + b1count + " bread slicers! Making " + b1pps + " slices of bread per second. Each building is making " + 1 * b1multi + " slices of bread per second!";
  106.         firstbuild.innerText = "Sliced bread maker. Cost " + Math.round(b1cost);
  107.        
  108.         //display second building
  109.         var secondbuild = document.getElementById("secondbuild");
  110.         secondbuild.style.display = "inline";
  111.         secondbuild.innerText = "Sandwich bread machine. Cost: " + Math.round(b2cost);
  112.        
  113.       }
  114.     }
  115.    
  116.     //what happens when you click second building button
  117.     function build2() {
  118.       if (points >= b2cost) {
  119.         points -= b2cost;
  120.         b2count++;
  121.         b2cost *= 1.10;
  122.         totalbuild++;
  123.         var build2add = setInterval(build2points, 1000);
  124.         updatepps();
  125.         //var b2pps = (b2count * 4) * b2multi;
  126.         document.getElementById("b2").innerHTML = "You have " + b2count + " sandwich bread machines! Making " + b2pps + " sandwich buns per second. Each machine is making " + 4 * b2multi + " sandwich buns per second!";
  127.         secondbuild.innerText = "Sandwich bread machine. Cost " + Math.round(b2cost);
  128.        
  129.         //display third building
  130.         var thirdbuild = document.getElementById("thirdbuild");
  131.         thirdbuild.style.display = "inline";
  132.         thirdbuild.innerText = "Crouton maker. Cost " + Math.round(b3cost);
  133.       }
  134.     }
  135.    
  136.     //what happens when you click third building button
  137.     function build3() {
  138.       if (points >= b3cost) {
  139.         points -= b3cost;
  140.         b3count++;
  141.         b3cost *= 1.10;
  142.         totalbuild++;
  143.         var build3add = setInterval(build3points, 1000);
  144.         updatepps();
  145.         //var b3pps = (b3count * 10) * b3multi;
  146.         document.getElementById("b3").innerHTML = "You have " + b3count + " crouton makers! Making " + b3pps + " croutons per second. Each crouton maker is making " + 10 * b3multi + " points per second!"
  147.         thirdbuild.innerText = "Crouton maker. Cost " + Math.round(b3cost);
  148.        
  149.         //display fourth building
  150.         var fourthbuild = document.getElementById("fourthbuild");
  151.         fourthbuild.style.display = "inline";
  152.         fourthbuild.innerText = "Roll factory. Cost " + Math.round(b4cost);
  153.        
  154.         //first building first multiplier
  155.         if (b1m1count == 0) {
  156.           var firstbuildmulti1 = document.getElementById("firstbuildmulti1");
  157.           firstbuildmulti1.style.display = "inline";
  158.           firstbuildmulti1.innerText = " Sliced bread x2 multiplier. Cost: " + b1m1cost + ".";
  159.         }
  160.       }
  161.     }
  162.    
  163.     //what happens when you click on build4
  164.     function build4() {
  165.       if (points >= b4cost) {
  166.         points -= b4cost;
  167.         b4count++;
  168.         b4cost *= 1.10;
  169.         totalbuild++;
  170.         var build4add = setInterval(build4points, 1000);
  171.         updatepps();
  172.         document.getElementById("b4").innerHTML = "You have " + b4count + " roll factories! Making " + b4pps + " rolls per second. Each building is making " + 24 * b4multi + " rolls per second!"
  173.         fourthbuild.innerText = "Roll factory. Cost " + Math.round(b4cost);
  174.        
  175.         //display fifth building
  176.         var fifthbuild = document.getElementById("fifthbuild");
  177.         fifthbuild.style.display = "inline";
  178.         fifthbuild.innerText = "Baguette oven. Cost " + Math.round(b5cost);
  179.        
  180.         //second building second multiplier
  181.         if (b2m1count == 0) {
  182.           var secondbuildmulti1 = document.getElementById("secondbuildmulti1");
  183.           secondbuildmulti1.style.display = "inline";
  184.           secondbuildmulti1.innerText = "Sandwich bread x2 multiplier. Cost " + b2m1cost + ".";
  185.         }
  186.        
  187.       }
  188.     }
  189.    
  190.     function build5() {
  191.       if (points >= b5cost) {
  192.         points -= b5cost;
  193.         b5count++;
  194.         totalbuild++;
  195.         b5cost *= 1.10;
  196.         var build5add = setInterval(build5points, 1000);
  197.         updatepps();
  198.         document.getElementById("b5").innerHTML = "You have " + b5count + " baguette ovens! Making " + b5pps + " baguettes per second. Each building is making " + 56 * b5multi + " baguettes per second!";
  199.         fifthbuild.innerText = "Baguette oven. Cost " + Math.round(b5cost);
  200.        
  201.         if (b3m1count == 0) {
  202.           var thirdbuildmulti1 = document.getElementById("thirdbuildmulti1");
  203.           thirdbuildmulti1.style.display = "inline";
  204.           thirdbuildmulti1.innerText = "Crouton maker x2 multiplier. Cost " + b3m1cost + ".";
  205.         }
  206.        
  207.         var sixthbuild = document.getElementById("sixthbuild")
  208.         sixthbuild.style.display = "inline";
  209.         sixthbuild.innerText = "Bagel production line. Cost " + Math.round(b6cost);
  210.       }
  211.     }
  212.    
  213.     function build6() {
  214.       if (points >= b6cost) {
  215.         points -= b6cost;
  216.         b6count++;
  217.         totalbuild++;
  218.         b6cost *= 1.10;
  219.         var build6add = setInterval(build6points, 1000);
  220.         updatepps();
  221.         document.getElementById("b6").innerHTML = "You have " + b6count + " bagel production lines! Making " + b6pps + " bagels per second. Each building is making " + 130 * b6multi + " bagels per second!";
  222.         sixthbuild.innerText = "Bagel production line. Cost " + Math.round(b6cost);
  223.        
  224.         var seventhbuild = document.getElementById("seventhbuild")
  225.         seventhbuild.style.display = "inline";
  226.         seventhbuild.innerText = "Soft pretzel manufacturer. Cost " + Math.round(b7cost);
  227.       }
  228.     }
  229.    
  230.     function build7() {
  231.       if (points >= b7cost) {
  232.         points -= b7cost;
  233.         b7count++;
  234.         totalbuild++;
  235.         b7cost *= 1.10;
  236.         var build7add = setInterval(build7points, 1000);
  237.         updatepps();
  238.         document.getElementById("b7").innerHTML = "You have " + b7count + " soft pretzel manufacturers! Making " + b7pps + " soft pretzels per second. Each building is making " + 315 * b7multi + " soft pretzels per second";
  239.         seventhbuild.innerText = "Soft pretzel manufacturer. Cost " + Math.round(b7cost);
  240.       }
  241.     }
  242.    
  243.     //add points for build1
  244.     function build1points() {
  245.       points += (1 * b1multi);
  246.       totalpoints += (1 * b1multi);
  247.     }
  248.    
  249.     //add points for build2
  250.     function build2points() {
  251.       points += (4 * b2multi);
  252.       totalpoints += (4 * b2multi);
  253.     }
  254.    
  255.     //add points for build3
  256.     function build3points() {
  257.       points += (10 * b3multi);
  258.       totalpoints += (10 * b3multi);
  259.     }
  260.    
  261.     function build4points() {
  262.       points += (24 * b4multi);
  263.       totalpoints += (24 * b4multi);
  264.     }
  265.    
  266.     function build5points() {
  267.       points += (56 * b5multi);
  268.       totalpoints += (56 * b5multi);
  269.     }
  270.    
  271.     function build6points() {
  272.       points += (130 * b6multi);
  273.       totalpoints += (130 * b6multi);
  274.     }
  275.    
  276.     function build7points() {
  277.       points += (315 * b7multi);
  278.       totalpoints += (315 * b7multi);
  279.     }
  280.    
  281.     //second x2, display multiplier
  282.     function secondx2() {
  283.       if (buyupgrade == 1 && points >= 1000) {
  284.         pointMulti *= 2;
  285.         points -= 1000;
  286.         buyupgrade++;
  287.         document.getElementById("multidisplay").innerHTML = "Your multiplier is: " + pointMulti;
  288.         multiply2.style.display = "none";
  289.        
  290.         if (buyupgrade == 2 && 5000) {
  291.           multiply3.style.display = "inline";
  292.         }
  293.       }
  294.     }
  295.    
  296.     function thirdx2() {
  297.       if (buyupgrade == 2 && points >= 5000) {
  298.         pointMulti *= 2;
  299.         points -= 5000;
  300.         buyupgrade++;
  301.         document.getElementById("multidisplay").innerHTML = "Your multiplier is: " + pointMulti;
  302.         multiply3.style.display = "none";
  303.       }
  304.     }
  305.    
  306.     function build1multi1() {
  307.       if (points >= b1m1cost) {
  308.         points -= b1m1cost;
  309.         b1multi *= 2;
  310.         b1m1count++;
  311.         updatepps();
  312.         var build1multi1 = document.getElementById("firstbuildmulti1");
  313.         firstbuildmulti1.style.display = "none";
  314.         document.getElementById("b1").innerHTML = "You have " + b1count + " bread slicers! Making " + b1pps + " slices of bread per second. Each building is making " + 1 * b1multi + " sliced of bread per second!";
  315.       }
  316.     }
  317.    
  318.     function build2multi1() {
  319.       if (points >= b2m1cost) {
  320.         points -= b2m1cost;
  321.         b2multi *= 2;
  322.         b2m1count++;
  323.         updatepps();
  324.         var build2multi1 = document.getElementById("secondbuildmulti1");
  325.         secondbuildmulti1.style.display = "none";
  326.         document.getElementById("b2").innerHTML = "You have " + b2count + " of sandwich bread makers! Making " + b2pps + " sandwich buns per second. Each building is making " + 4 * b2multi + " sandwich buns per second!";
  327.       }
  328.     }
  329.    
  330.     function build3multi1() {
  331.       if (points >= b3m1cost) {
  332.         points -= b3m1cost;
  333.         b3multi *= 2;
  334.         b3m1count++;
  335.         updatepps();
  336.         var build3multi1 = document.getElementById("thirdbuildmulti1");
  337.         thirdbuildmulti1.style.display = "none";
  338.         document.getElementById("b3").innerHTML = "You have " + b3count + " crouton makers! Making " + b3pps + " croutons per second. Each crouton maker is making " + 10 * b3multi + " croutons per second!";
  339.       }
  340.     }
  341.    
  342.     function updatepps(){
  343.       b1pps = (b1count * 1) * b1multi;
  344.       b2pps = (b2count * 4) * b2multi;
  345.       b3pps = (b3count * 10) * b3multi;
  346.       b4pps = (b4count * 24) * b4multi;
  347.       b5pps = (b5count * 56) * b5multi;
  348.       b6pps = (b6count * 130) * b6multi;
  349.       b7pps = (b7count * 315) * b7multi;
  350.       ppstotal = b1pps + b2pps + b3pps + b4pps + b5pps + b6pps + b7pps;
  351.       document.getElementById("ppstotal").innerHTML = "Your total bread objects per second is " + ppstotal + "!";
  352.     }
  353.    
  354.     function updatestats() {
  355.       document.getElementById("totalpointcount").innerHTML = "You have made " + totalpoints + " total points."
  356.       document.getElementById("totalbuild").innerHTML = "You have " + totalbuild + " total buildings."
  357.     }
  358.    
  359.     function switchtab(evt, pagename) {
  360.       var i, tabcontent, tablinks;
  361.       tabcontent = document.getElementsByClassName("tabcontent");
  362.       for (i = 0; i < tabcontent.length; i++) {
  363.         tabcontent[i].style.display = "none";
  364.       }
  365.       tablinks = document.getElementsByClassName("tablinks");
  366.       for (i = 0; i < tablinks.length; i++) {
  367.         tablinks[i].className = tablinks[i].className.replace(" active", "");
  368.       }
  369.       document.getElementById(pagename).style.display = "block";
  370.       evt.currentTarget.className += "active";
  371.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement