Advertisement
ithortureu

Untitled

Aug 20th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.58 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. if (b2count == 0) {
  163. //display second building
  164. var secondbuild = document.getElementById("secondbuild");
  165. secondbuild.style.display = "inline";
  166. secondbuild.innerText = "Sandwich bread machine. Cost: " + Math.round(b2cost);
  167. }
  168.  
  169. }
  170. }
  171.  
  172. //what happens when you click second building button
  173. function build2() {
  174. if (points >= b2cost) {
  175. points -= b2cost;
  176. b2count++;
  177. b2cost *= 1.10;
  178. totalbuild++;
  179. var build2add = setInterval(build2points, 1000);
  180. //var b2pps = (b2count * 4) * b2multi;
  181. updatepps();
  182. 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!";
  183. secondbuild.innerText = secondbuild.innerText = "+" + b2multi * 4 + "PPS. Cost: " + Math.round(b2cost);
  184. updatepps();
  185.  
  186. if (b3count == 0) {
  187. //display third building
  188. var thirdbuild = document.getElementById("thirdbuild");
  189. thirdbuild.style.display = "inline";
  190. thirdbuild.innerText = "Crouton maker. Cost " + Math.round(b3cost);
  191. }
  192. }
  193. }
  194.  
  195. //what happens when you click third building button
  196. function build3() {
  197. if (points >= b3cost) {
  198. points -= b3cost;
  199. b3count++;
  200. b3cost *= 1.10;
  201. totalbuild++;
  202. var build3add = setInterval(build3points, 1000);
  203. //var b3pps = (b3count * 10) * b3multi;
  204. updatepps();
  205. document.getElementById("b3").innerHTML = "You have " + b3count + " crouton makers! Making " + b3pps + " croutons per second. Each crouton maker is making " + 10 * b3multi + " points per second!"
  206. thirdbuild.innerText = thirdbuild.innerText = "+" + b3multi * 10 + "PPS. Cost: " + Math.round(b3cost);
  207. updatepps();
  208.  
  209. if (b4count == 0) {
  210. //display fourth building
  211. var fourthbuild = document.getElementById("fourthbuild");
  212. fourthbuild.style.display = "inline";
  213. fourthbuild.innerText = "Roll factory. Cost " + Math.round(b4cost);
  214. }
  215. }
  216. }
  217.  
  218. //what happens when you click on build4
  219. function build4() {
  220. if (points >= b4cost) {
  221. points -= b4cost;
  222. b4count++;
  223. b4cost *= 1.10;
  224. totalbuild++;
  225. var build4add = setInterval(build4points, 1000);
  226. updatepps();
  227. document.getElementById("b4").innerHTML = "You have " + b4count + " roll factories! Making " + b4pps + " rolls per second. Each building is making " + 24 * b4multi + " rolls per second!";
  228. fourthbuild.innerText = fourthbuild.innerText = "+" + b4multi * 24 + "PPS. Cost: " + Math.round(b4cost);
  229. updatepps();
  230.  
  231. if (b5count == 0) {
  232. //display fifth building
  233. var fifthbuild = document.getElementById("fifthbuild");
  234. fifthbuild.style.display = "inline";
  235. fifthbuild.innerText = "Baguette oven. Cost " + Math.round(b5cost);
  236. }
  237.  
  238. }
  239. }
  240.  
  241. function build5() {
  242. if (points >= b5cost) {
  243. points -= b5cost;
  244. b5count++;
  245. totalbuild++;
  246. b5cost *= 1.10;
  247. var build5add = setInterval(build5points, 1000);
  248. updatepps();
  249. document.getElementById("b5").innerHTML = "You have " + b5count + " baguette ovens! Making " + b5pps + " baguettes per second. Each building is making " + 56 * b5multi + " baguettes per second!";
  250. fifthbuild.innerText = fifthbuild.innerText = "+" + b5multi * 56 + "PPS. Cost: " + Math.round(b5cost);
  251. updatepps();
  252.  
  253. if (b6count == 0) {
  254. var sixthbuild = document.getElementById("sixthbuild");
  255. sixthbuild.style.display = "inline";
  256. sixthbuild.innerText = "Bagel production line. Cost " + Math.round(b6cost);
  257. }
  258. }
  259. }
  260.  
  261. function build6() {
  262. if (points >= b6cost) {
  263. points -= b6cost;
  264. b6count++;
  265. totalbuild++;
  266. b6cost *= 1.10;
  267. var build6add = setInterval(build6points, 1000);
  268. updatepps();
  269. document.getElementById("b6").innerHTML = "You have " + b6count + " bagel production lines! Making " + b6pps + " bagels per second. Each building is making " + 130 * b6multi + " bagels per second!";
  270. sixthbuild.innerText = sixthbuild.innerText = "+" + b6multi * 130 + "PPS. Cost: " + Math.round(b6cost);
  271. updatepps();
  272.  
  273. if (b7count == 0) {
  274. var seventhbuild = document.getElementById("seventhbuild")
  275. seventhbuild.style.display = "inline";
  276. seventhbuild.innerText = "Soft pretzel manufacturer. Cost " + Math.round(b7cost);
  277. }
  278. }
  279. }
  280.  
  281. function build7() {
  282. if (points >= b7cost) {
  283. points -= b7cost;
  284. b7count++;
  285. totalbuild++;
  286. b7cost *= 1.10;
  287. var build7add = setInterval(build7points, 1000);
  288. updatepps();
  289. 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";
  290. seventhbuild.innerText = seventhbuild.innerText = "+" + b7multi * 315 + "PPS. Cost: " + Math.round(b7cost);
  291. updatepps();
  292. }
  293. }
  294.  
  295. //add points for build1
  296. function build1points() {
  297. points += (1 * b1multi);
  298. totalpoints += (1 * b1multi);
  299. }
  300.  
  301. //add points for build2
  302. function build2points() {
  303. points += (4 * b2multi);
  304. totalpoints += (4 * b2multi);
  305. }
  306.  
  307. //add points for build3
  308. function build3points() {
  309. points += (10 * b3multi);
  310. totalpoints += (10 * b3multi);
  311. }
  312.  
  313. function build4points() {
  314. points += (24 * b4multi);
  315. totalpoints += (24 * b4multi);
  316. }
  317.  
  318. function build5points() {
  319. points += (56 * b5multi);
  320. totalpoints += (56 * b5multi);
  321. }
  322.  
  323. function build6points() {
  324. points += (130 * b6multi);
  325. totalpoints += (130 * b6multi);
  326. }
  327.  
  328. function build7points() {
  329. points += (315 * b7multi);
  330. totalpoints += (315 * b7multi);
  331. }
  332.  
  333. //second x2, display multiplier
  334. function secondx2() {
  335. if (buyupgrade == 1 && points >= 1000) {
  336. pointMulti *= 2;
  337. points -= 1000;
  338. buyupgrade++;
  339. document.getElementById("multidisplay").innerHTML = "Your multiplier is: " + pointMulti;
  340. multiply2.style.display = "none";
  341.  
  342. if (buyupgrade == 2 && 5000) {
  343. multiply3.style.display = "inline";
  344. }
  345. }
  346. }
  347.  
  348. function thirdx2() {
  349. if (buyupgrade == 2 && points >= 5000) {
  350. pointMulti *= 2;
  351. points -= 5000;
  352. buyupgrade++;
  353. document.getElementById("multidisplay").innerHTML = "Your multiplier is: " + pointMulti;
  354. multiply3.style.display = "none";
  355. }
  356. }
  357.  
  358. var check1 = setInterval(ucheck1, 100);
  359. var offbutton = setInterval(buttonoff, 100);
  360.  
  361. function ucheck1() {
  362. if (b1upg == 0 && b1count >= 1) {
  363. b1c1.style.display="inline";
  364. }
  365. if (b2upg == 0 && b2count >= 1) {
  366. b2c1.style.display="inline";
  367. }
  368. if (b3upg == 0 && b3count >= 1) {
  369. b3c1.style.display="inline";
  370. }
  371. if (b4upg == 0 && b4count >= 1) {
  372. b4c1.style.display="inline";
  373. }
  374. if (b5upg == 0 && b5count >= 1) {
  375. b5c1.style.display="inline";
  376. }
  377. if (b6upg == 0 && b6count >= 1) {
  378. b6c1.style.display="inline";
  379. }
  380. if (b7upg == 0 && b7count >= 1) {
  381. b7c1.style.display="inline";
  382. }
  383. }
  384.  
  385. function b1m1() {
  386. if (points >= b1m1cost) {
  387. points -= b1m1cost;
  388. b1upg++;
  389. b1multi *= 2;
  390. updatepps();
  391. b1c1.style.display = "none";
  392. 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!";
  393. firstbuild.innerText = "+" + b1multi + "PPS. Cost: " + Math.round(b1cost);
  394. }
  395. }
  396.  
  397. function b2m1() {
  398. if (points >= b2m1cost) {
  399. points -= b2m1cost;
  400. b2upg++;
  401. b2multi *= 2;
  402. updatepps();
  403. b2c1.style.display = "none";
  404. 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!";
  405. secondbuild.innerText = secondbuild.innerText = "+" + b2multi * 4 + "PPS. Cost: " + Math.round(b2cost);
  406. }
  407. }
  408.  
  409. function b3m1() {
  410. if (points >= b3m1cost) {
  411. points -= b3m1cost;
  412. b3upg++;
  413. b3multi *= 2;
  414. updatepps();
  415. b3c1.style.display = "none";
  416. document.getElementById("b3").innerHTML = "You have " + b3count + " crouton makers! Making " + b3pps + " croutons per second. Each crouton maker is making " + 10 * b3multi + " points per second!"
  417. thirdbuild.innerText = thirdbuild.innerText = "+" + b3multi * 10 + "PPS. Cost: " + Math.round(b3cost);
  418. }
  419. }
  420.  
  421. function b4m1() {
  422. if (points >= b4m1cost) {
  423. points -= b4m1cost;
  424. b4upg++;
  425. b4multi *= 2;
  426. updatepps();
  427. b4c1.style.display = "none";
  428. document.getElementById("b4").innerHTML = "You have " + b4count + " roll factories! Making " + b4pps + " rolls per second. Each building is making " + 24 * b4multi + " rolls per second!"
  429. fourthbuild.innerText = fourthbuild.innerText = "+" + b4multi * 24 + "PPS. Cost: " + Math.round(b4cost);
  430. }
  431. }
  432.  
  433. function b5m1() {
  434. if (points >= b5m1cost) {
  435. points -= b5m1cost;
  436. b5upg++;
  437. b5multi *= 2;
  438. updatepps();
  439. b5c1.style.display = "none";
  440. document.getElementById("b5").innerHTML = "You have " + b5count + " baguette ovens! Making " + b5pps + " baguettes per second. Each building is making " + 56 * b5multi + " baguettes per second!";
  441. fifthbuild.innerText = fifthbuild.innerText = "+" + b5multi * 56 + "PPS. Cost: " + Math.round(b5cost);
  442. }
  443. }
  444.  
  445. function b6m1() {
  446. if (points >= b6m1cost) {
  447. points -= b6m1cost;
  448. b6upg++;
  449. b6multi *= 2;
  450. updatepps();
  451. b6c1.style.display = "none";
  452. document.getElementById("b6").innerHTML = "You have " + b6count + " bagel production lines! Making " + b6pps + " bagels per second. Each building is making " + 130 * b6multi + " bagels per second!";
  453. sixthbuild.innerText = sixthbuild.innerText = "+" + b6multi * 130 + "PPS. Cost: " + Math.round(b6cost);
  454. }
  455. }
  456.  
  457. function b7m1() {
  458. if (points >= b7m1cost) {
  459. points -= b7m1cost;
  460. b7upg++;
  461. b7multi *= 2;
  462. updatepps();
  463. b7c1.style.display = "none";
  464. document.getElementById("b3").innerHTML = "You have " + b3count + " crouton makers! Making " + b3pps + " croutons per second. Each crouton maker is making " + 10 * b3multi + " points per second!"
  465. seventhbuild.innerText = seventhbuild.innerText = "+" + b7multi * 315 + "PPS. Cost: " + Math.round(b7cost);
  466. }
  467. }
  468. function updatepps(){
  469. b1pps = (b1count * 1) * b1multi;
  470. b2pps = (b2count * 4) * b2multi;
  471. b3pps = (b3count * 10) * b3multi;
  472. b4pps = (b4count * 24) * b4multi;
  473. b5pps = (b5count * 56) * b5multi;
  474. b6pps = (b6count * 130) * b6multi;
  475. b7pps = (b7count * 315) * b7multi;
  476. ppstotal = b1pps + b2pps + b3pps + b4pps + b5pps + b6pps + b7pps;
  477. document.getElementById("ppstotal").innerHTML = "Your total bread objects per second is " + ppstotal + "!";
  478. }
  479.  
  480. function updatestats() {
  481. document.getElementById("totalpointcount").innerHTML = "You have made " + totalpoints + " total points."
  482. document.getElementById("totalbuild").innerHTML = "You have " + totalbuild + " total buildings."
  483. }
  484.  
  485. /*function buttonoff() {
  486. if (points < b1cost) {
  487. document.getElementById("firstbuild").disabled = true;
  488. }
  489. if (points < b2cost) {
  490. document.getElementById("secondbuild").disabled = true;
  491. }
  492. if (points < b3cost) {
  493. document.getElementById("thirdbuild").disabled = true;
  494. }
  495. if (points < b4cost) {
  496. document.getElementById("fourthbuild").disabled = true;
  497. }
  498. if (points < b5cost) {
  499. document.getElementById("fifthbuild").disabled = true;
  500. }
  501. if (points < b6cost) {
  502. document.getElementById("sixthbuild").disabled = true;
  503. }
  504. if (points < b7cost) {
  505. document.getElementById("seventhbuild").disabled = true;
  506. }
  507.  
  508. if (points >= b1cost) {
  509. document.getElementById("firstbuild").disabled = false;
  510. }
  511. if (points >= b2cost) {
  512. document.getElementById("secondbuild").disabled = false;
  513. }
  514. if (points >= b3cost) {
  515. document.getElementById("thirdbuild").disabled = false;
  516. }
  517. if (points >= b4cost) {
  518. document.getElementById("fourthbuild").disabled = false;
  519. }
  520. if (points >= b5cost) {
  521. document.getElementById("fifthbuild").disabled = false;
  522. }
  523. if (points >= b6cost) {
  524. document.getElementById("sixthbuild").disabled = false;
  525. }
  526. if (points >= b7cost) {
  527. document.getElementById("seventhbuild").disabled = false;
  528. }
  529. }*/
  530.  
  531. function switchtab(evt, pagename) {
  532. var i, tabcontent, tablinks;
  533. tabcontent = document.getElementsByClassName("tabcontent");
  534. for (i = 0; i < tabcontent.length; i++) {
  535. tabcontent[i].style.display = "none";
  536. }
  537. tablinks = document.getElementsByClassName("tablinks");
  538. for (i = 0; i < tablinks.length; i++) {
  539. tablinks[i].className = tablinks[i].className.replace(" active", "");
  540. }
  541. document.getElementById(pagename).style.display = "block";
  542. evt.currentTarget.className += "active";
  543. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement