Advertisement
ithortureu

Untitled

Aug 20th, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.34 KB | None | 0 0
  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 b1upg = 0;
  36. var b1m1cost = 500;
  37. var b2upg = 0;
  38. var b2m1cost = 2500;
  39. var b3upg = 0;
  40. var b3m1cost = 5000;
  41. var b4upg = 0;
  42. var b4m1cost = 11500;
  43. var b5upg = 0;
  44. var b5m1cost = 25000;
  45. var b6upg = 0;
  46. var b6m1cost = 62500;
  47. var b7upg = 0;
  48. var b7m1cost = 150000;
  49. var ppstotal = 0;
  50. var pointsfromclick = 0;
  51. var totalpoints = 0;
  52. var totalbuild = 0;
  53. var statupdate = setInterval(updatestats, 250);
  54. var currentpoints = setInterval(pointupdate, 250);
  55.  
  56. //clicking on main button to add points
  57. //clicking on main button to add points
  58. function addPoints() {
  59. points += pointMulti;
  60. clickcount++;
  61. pointsfromclick += pointMulti;
  62. totalpoints += pointMulti;
  63. document.getElementById("clickcount").innerHTML = "You have " + clickcount + " total clicks.";
  64. document.getElementById("pointsfromclick").innerHTML = "You have made " + pointsfromclick + " bread objects from clicking.";
  65. document.getElementById("totalpointcount").innerHTML = "You have made " + totalpoints + " total bread objects.";
  66. var pointsArea = document.getElementById("pointdisplay");
  67. pointsArea.innerHTML = "You have " + Math.round(points) + " bread objects!";
  68. if(points >= 1 && buyupgrade === 0) {
  69. var multiply_button = document.getElementById("btn_multiply");
  70. multiply_button.style.display = "inline";
  71. }
  72. }
  73.  
  74. //make logic for doubling addpoints
  75. function firstx2() {
  76. if (buyupgrade === 0) {
  77. pointMulti *= 2;
  78. buyupgrade++;
  79. points -= 100;
  80. var multiplierArea = document.getElementById("multidisplay");
  81. multiplierArea.innerHTML = "Your multiplier is: " + pointMulti;
  82. var multiply_button = document.getElementById("btn_multiply");
  83. multiply_button.style.display = "none";
  84.  
  85. //logic for displaying first building upgrade
  86. if (buyupgrade === 1) {
  87. var firstbuild = document.getElementById("firstbuild");
  88. firstbuild.style.display = "inline";
  89. firstbuild.innerText = "Sliced bread maker. Cost " + Math.round(b1cost);
  90.  
  91. var show2ndx2 = document.getElementById("secondx2");
  92. multiply2.style.display = "inline";
  93. }
  94.  
  95. }
  96. }
  97.  
  98. //displays total points
  99. function pointupdate() {
  100. document.getElementById("pointdisplay").innerHTML = "You have " + Math.round(points) + " bread objects!";
  101.  
  102. if (points < b1cost) {
  103. document.getElementById("firstbuild").disabled = true;
  104. }
  105. if (points < b2cost) {
  106. document.getElementById("secondbuild").disabled = true;
  107. }
  108. if (points < b3cost) {
  109. document.getElementById("thirdbuild").disabled = true;
  110. }
  111. if (points < b4cost) {
  112. document.getElementById("fourthbuild").disabled = true;
  113. }
  114. if (points < b5cost) {
  115. document.getElementById("fifthbuild").disabled = true;
  116. }
  117. if (points < b6cost) {
  118. document.getElementById("sixthbuild").disabled = true;
  119. }
  120. if (points < b7cost) {
  121. document.getElementById("seventhbuild").disabled = true;
  122. }
  123.  
  124. if (points >= b1cost) {
  125. document.getElementById("firstbuild").disabled = false;
  126. }
  127. if (points >= b2cost) {
  128. document.getElementById("secondbuild").disabled = false;
  129. }
  130. if (points >= b3cost) {
  131. document.getElementById("thirdbuild").disabled = false;
  132. }
  133. if (points >= b4cost) {
  134. document.getElementById("fourthbuild").disabled = false;
  135. }
  136. if (points >= b5cost) {
  137. document.getElementById("fifthbuild").disabled = false;
  138. }
  139. if (points >= b6cost) {
  140. document.getElementById("sixthbuild").disabled = false;
  141. }
  142. if (points >= b7cost) {
  143. document.getElementById("seventhbuild").disabled = false;
  144. }
  145. }
  146.  
  147. //what happens when you click first building button
  148. function build1() {
  149. if (points >= b1cost) {
  150. points -= b1cost;
  151. b1count++;
  152. b1cost *= 1.10;
  153. totalbuild++;
  154. var build1add = setInterval(build1points, 1000);
  155. //var b1multi = 1;
  156. //var b1pps = (b1count * b1multi);
  157. updatepps();
  158. 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!";
  159. firstbuild.innerText = "+" + b1multi + "PPS. Cost: " + Math.round(b1cost);
  160. updatepps();
  161.  
  162. //display second building
  163. var secondbuild = document.getElementById("secondbuild");
  164. secondbuild.style.display = "inline";
  165. secondbuild.innerText = "Sandwich bread machine. Cost: " + Math.round(b2cost);
  166.  
  167. }
  168. }
  169.  
  170. //what happens when you click second building button
  171. function build2() {
  172. if (points >= b2cost) {
  173. points -= b2cost;
  174. b2count++;
  175. b2cost *= 1.10;
  176. totalbuild++;
  177. var build2add = setInterval(build2points, 1000);
  178. //var b2pps = (b2count * 4) * b2multi;
  179. updatepps();
  180. 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!";
  181. secondbuild.innerText = secondbuild.innerText = "+" + b2multi * 4 + "PPS. Cost: " + Math.round(b2cost);
  182. updatepps();
  183.  
  184. //display third building
  185. var thirdbuild = document.getElementById("thirdbuild");
  186. thirdbuild.style.display = "inline";
  187. thirdbuild.innerText = "Crouton maker. Cost " + Math.round(b3cost);
  188. }
  189. }
  190.  
  191. //what happens when you click third building button
  192. function build3() {
  193. if (points >= b3cost) {
  194. points -= b3cost;
  195. b3count++;
  196. b3cost *= 1.10;
  197. totalbuild++;
  198. var build3add = setInterval(build3points, 1000);
  199. //var b3pps = (b3count * 10) * b3multi;
  200. updatepps();
  201. document.getElementById("b3").innerHTML = "You have " + b3count + " crouton makers! Making " + b3pps + " croutons per second. Each crouton maker is making " + 10 * b3multi + " points per second!"
  202. thirdbuild.innerText = thirdbuild.innerText = "+" + b3multi * 10 + "PPS. Cost: " + Math.round(b3cost);
  203. updatepps();
  204.  
  205. //display fourth building
  206. var fourthbuild = document.getElementById("fourthbuild");
  207. fourthbuild.style.display = "inline";
  208. fourthbuild.innerText = "Roll factory. Cost " + Math.round(b4cost);
  209. }
  210. }
  211.  
  212. //what happens when you click on build4
  213. function build4() {
  214. if (points >= b4cost) {
  215. points -= b4cost;
  216. b4count++;
  217. b4cost *= 1.10;
  218. totalbuild++;
  219. var build4add = setInterval(build4points, 1000);
  220. updatepps();
  221. document.getElementById("b4").innerHTML = "You have " + b4count + " roll factories! Making " + b4pps + " rolls per second. Each building is making " + 24 * b4multi + " rolls per second!";
  222. fourthbuild.innerText = fourthbuild.innerText = "+" + b4multi * 24 + "PPS. Cost: " + Math.round(b4cost);
  223. updatepps();
  224.  
  225. //display fifth building
  226. var fifthbuild = document.getElementById("fifthbuild");
  227. fifthbuild.style.display = "inline";
  228. fifthbuild.innerText = "Baguette oven. Cost " + Math.round(b5cost);
  229.  
  230. }
  231. }
  232.  
  233. function build5() {
  234. if (points >= b5cost) {
  235. points -= b5cost;
  236. b5count++;
  237. totalbuild++;
  238. b5cost *= 1.10;
  239. var build5add = setInterval(build5points, 1000);
  240. updatepps();
  241. document.getElementById("b5").innerHTML = "You have " + b5count + " baguette ovens! Making " + b5pps + " baguettes per second. Each building is making " + 56 * b5multi + " baguettes per second!";
  242. fifthbuild.innerText = fifthbuild.innerText = "+" + b5multi * 56 + "PPS. Cost: " + Math.round(b5cost);
  243. updatepps();
  244.  
  245. var sixthbuild = document.getElementById("sixthbuild");
  246. sixthbuild.style.display = "inline";
  247. sixthbuild.innerText = "Bagel production line. Cost " + Math.round(b6cost);
  248. }
  249. }
  250.  
  251. function build6() {
  252. if (points >= b6cost) {
  253. points -= b6cost;
  254. b6count++;
  255. totalbuild++;
  256. b6cost *= 1.10;
  257. var build6add = setInterval(build6points, 1000);
  258. updatepps();
  259. document.getElementById("b6").innerHTML = "You have " + b6count + " bagel production lines! Making " + b6pps + " bagels per second. Each building is making " + 130 * b6multi + " bagels per second!";
  260. sixthbuild.innerText = sixthbuild.innerText = "+" + b6multi * 130 + "PPS. Cost: " + Math.round(b6cost);
  261. updatepps();
  262.  
  263. var seventhbuild = document.getElementById("seventhbuild")
  264. seventhbuild.style.display = "inline";
  265. seventhbuild.innerText = "Soft pretzel manufacturer. Cost " + Math.round(b7cost);
  266. }
  267. }
  268.  
  269. function build7() {
  270. if (points >= b7cost) {
  271. points -= b7cost;
  272. b7count++;
  273. totalbuild++;
  274. b7cost *= 1.10;
  275. var build7add = setInterval(build7points, 1000);
  276. updatepps();
  277. 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";
  278. seventhbuild.innerText = seventhbuild.innerText = "+" + b7multi * 315 + "PPS. Cost: " + Math.round(b7cost);
  279. updatepps();
  280. }
  281. }
  282.  
  283. //add points for build1
  284. function build1points() {
  285. points += (1 * b1multi);
  286. totalpoints += (1 * b1multi);
  287. }
  288.  
  289. //add points for build2
  290. function build2points() {
  291. points += (4 * b2multi);
  292. totalpoints += (4 * b2multi);
  293. }
  294.  
  295. //add points for build3
  296. function build3points() {
  297. points += (10 * b3multi);
  298. totalpoints += (10 * b3multi);
  299. }
  300.  
  301. function build4points() {
  302. points += (24 * b4multi);
  303. totalpoints += (24 * b4multi);
  304. }
  305.  
  306. function build5points() {
  307. points += (56 * b5multi);
  308. totalpoints += (56 * b5multi);
  309. }
  310.  
  311. function build6points() {
  312. points += (130 * b6multi);
  313. totalpoints += (130 * b6multi);
  314. }
  315.  
  316. function build7points() {
  317. points += (315 * b7multi);
  318. totalpoints += (315 * b7multi);
  319. }
  320.  
  321. //second x2, display multiplier
  322. function secondx2() {
  323. if (buyupgrade == 1 && points >= 1000) {
  324. pointMulti *= 2;
  325. points -= 1000;
  326. buyupgrade++;
  327. document.getElementById("multidisplay").innerHTML = "Your multiplier is: " + pointMulti;
  328. multiply2.style.display = "none";
  329.  
  330. if (buyupgrade == 2 && 5000) {
  331. multiply3.style.display = "inline";
  332. }
  333. }
  334. }
  335.  
  336. function thirdx2() {
  337. if (buyupgrade == 2 && points >= 5000) {
  338. pointMulti *= 2;
  339. points -= 5000;
  340. buyupgrade++;
  341. document.getElementById("multidisplay").innerHTML = "Your multiplier is: " + pointMulti;
  342. multiply3.style.display = "none";
  343. }
  344. }
  345.  
  346. var check1 = setInterval(ucheck1, 100);
  347. var offbutton = setInterval(buttonoff, 100);
  348.  
  349. function ucheck1() {
  350. if (b1upg == 0 && b1count >= 1) {
  351. b1c1.style.display="inline";
  352. }
  353. if (b2upg == 0 && b2count >= 1) {
  354. b2c1.style.display="inline";
  355. }
  356. if (b3upg == 0 && b3count >= 1) {
  357. b3c1.style.display="inline";
  358. }
  359. if (b4upg == 0 && b4count >= 1) {
  360. b4c1.style.display="inline";
  361. }
  362. if (b5upg == 0 && b5count >= 1) {
  363. b5c1.style.display="inline";
  364. }
  365. if (b6upg == 0 && b6count >= 1) {
  366. b6c1.style.display="inline";
  367. }
  368. if (b7upg == 0 && b7count >= 1) {
  369. b7c1.style.display="inline";
  370. }
  371. }
  372.  
  373. function b1m1() {
  374. if (points >= b1m1cost) {
  375. points -= b1m1cost;
  376. b1upg++;
  377. b1multi *= 2;
  378. updatepps();
  379. b1c1.style.display = "none";
  380. 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!";
  381. firstbuild.innerText = "+" + b1multi + "PPS. Cost: " + Math.round(b1cost);
  382. }
  383. }
  384.  
  385. function b2m1() {
  386. if (points >= b2m1cost) {
  387. points -= b2m1cost;
  388. b2upg++;
  389. b2multi *= 2;
  390. updatepps();
  391. b2c1.style.display = "none";
  392. 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!";
  393. secondbuild.innerText = secondbuild.innerText = "+" + b2multi * 4 + "PPS. Cost: " + Math.round(b2cost);
  394. }
  395. }
  396.  
  397. function b3m1() {
  398. if (points >= b3m1cost) {
  399. points -= b3m1cost;
  400. b3upg++;
  401. b3multi *= 2;
  402. updatepps();
  403. b3c1.style.display = "none";
  404. document.getElementById("b3").innerHTML = "You have " + b3count + " crouton makers! Making " + b3pps + " croutons per second. Each crouton maker is making " + 10 * b3multi + " points per second!"
  405. thirdbuild.innerText = thirdbuild.innerText = "+" + b3multi * 10 + "PPS. Cost: " + Math.round(b3cost);
  406. }
  407. }
  408.  
  409. function b4m1() {
  410. if (points >= b4m1cost) {
  411. points -= b4m1cost;
  412. b4upg++;
  413. b4multi *= 2;
  414. updatepps();
  415. b4c1.style.display = "none";
  416. document.getElementById("b4").innerHTML = "You have " + b4count + " roll factories! Making " + b4pps + " rolls per second. Each building is making " + 24 * b4multi + " rolls per second!"
  417. fourthbuild.innerText = fourthbuild.innerText = "+" + b4multi * 24 + "PPS. Cost: " + Math.round(b4cost);
  418. }
  419. }
  420.  
  421. function b5m1() {
  422. if (points >= b5m1cost) {
  423. points -= b5m1cost;
  424. b5upg++;
  425. b5multi *= 2;
  426. updatepps();
  427. b5c1.style.display = "none";
  428. document.getElementById("b5").innerHTML = "You have " + b5count + " baguette ovens! Making " + b5pps + " baguettes per second. Each building is making " + 56 * b5multi + " baguettes per second!";
  429. fifthbuild.innerText = fifthbuild.innerText = "+" + b5multi * 56 + "PPS. Cost: " + Math.round(b5cost);
  430. }
  431. }
  432.  
  433. function b6m1() {
  434. if (points >= b6m1cost) {
  435. points -= b6m1cost;
  436. b6upg++;
  437. b6multi *= 2;
  438. updatepps();
  439. b6c1.style.display = "none";
  440. document.getElementById("b6").innerHTML = "You have " + b6count + " bagel production lines! Making " + b6pps + " bagels per second. Each building is making " + 130 * b6multi + " bagels per second!";
  441. sixthbuild.innerText = sixthbuild.innerText = "+" + b6multi * 130 + "PPS. Cost: " + Math.round(b6cost);
  442. }
  443. }
  444.  
  445. function b7m1() {
  446. if (points >= b7m1cost) {
  447. points -= b7m1cost;
  448. b7upg++;
  449. b7multi *= 2;
  450. updatepps();
  451. b7c1.style.display = "none";
  452. document.getElementById("b3").innerHTML = "You have " + b3count + " crouton makers! Making " + b3pps + " croutons per second. Each crouton maker is making " + 10 * b3multi + " points per second!"
  453. seventhbuild.innerText = seventhbuild.innerText = "+" + b7multi * 315 + "PPS. Cost: " + Math.round(b7cost);
  454. }
  455. }
  456. function updatepps(){
  457. b1pps = (b1count * 1) * b1multi;
  458. b2pps = (b2count * 4) * b2multi;
  459. b3pps = (b3count * 10) * b3multi;
  460. b4pps = (b4count * 24) * b4multi;
  461. b5pps = (b5count * 56) * b5multi;
  462. b6pps = (b6count * 130) * b6multi;
  463. b7pps = (b7count * 315) * b7multi;
  464. ppstotal = b1pps + b2pps + b3pps + b4pps + b5pps + b6pps + b7pps;
  465. document.getElementById("ppstotal").innerHTML = "Your total bread objects per second is " + ppstotal + "!";
  466. }
  467.  
  468. function updatestats() {
  469. document.getElementById("totalpointcount").innerHTML = "You have made " + totalpoints + " total points."
  470. document.getElementById("totalbuild").innerHTML = "You have " + totalbuild + " total buildings."
  471. }
  472.  
  473. /*function buttonoff() {
  474. if (points < b1cost) {
  475. document.getElementById("firstbuild").disabled = true;
  476. }
  477. if (points < b2cost) {
  478. document.getElementById("secondbuild").disabled = true;
  479. }
  480. if (points < b3cost) {
  481. document.getElementById("thirdbuild").disabled = true;
  482. }
  483. if (points < b4cost) {
  484. document.getElementById("fourthbuild").disabled = true;
  485. }
  486. if (points < b5cost) {
  487. document.getElementById("fifthbuild").disabled = true;
  488. }
  489. if (points < b6cost) {
  490. document.getElementById("sixthbuild").disabled = true;
  491. }
  492. if (points < b7cost) {
  493. document.getElementById("seventhbuild").disabled = true;
  494. }
  495.  
  496. if (points >= b1cost) {
  497. document.getElementById("firstbuild").disabled = false;
  498. }
  499. if (points >= b2cost) {
  500. document.getElementById("secondbuild").disabled = false;
  501. }
  502. if (points >= b3cost) {
  503. document.getElementById("thirdbuild").disabled = false;
  504. }
  505. if (points >= b4cost) {
  506. document.getElementById("fourthbuild").disabled = false;
  507. }
  508. if (points >= b5cost) {
  509. document.getElementById("fifthbuild").disabled = false;
  510. }
  511. if (points >= b6cost) {
  512. document.getElementById("sixthbuild").disabled = false;
  513. }
  514. if (points >= b7cost) {
  515. document.getElementById("seventhbuild").disabled = false;
  516. }
  517. }*/
  518.  
  519. function switchtab(evt, pagename) {
  520. var i, tabcontent, tablinks;
  521. tabcontent = document.getElementsByClassName("tabcontent");
  522. for (i = 0; i < tabcontent.length; i++) {
  523. tabcontent[i].style.display = "none";
  524. }
  525. tablinks = document.getElementsByClassName("tablinks");
  526. for (i = 0; i < tablinks.length; i++) {
  527. tablinks[i].className = tablinks[i].className.replace(" active", "");
  528. }
  529. document.getElementById(pagename).style.display = "block";
  530. evt.currentTarget.className += "active";
  531. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement