Advertisement
irelephant

index.js

Apr 26th, 2024
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.45 KB | Source Code | 0 0
  1. //biscuit tapper v1.2 dev version
  2. let scoreText = document.getElementById("scoreText");
  3. let biscuitButton = document.querySelector("#biscuitButton");
  4. let resetButton = document.getElementById("resetButton");
  5. let buyAutoClicker = document.getElementById("buyAutoClicker");
  6. let amountOfAutoClickersText = document.getElementById("amountOfAutoClickersText");
  7. let score = 0;
  8. let amountOfAutoClickers = 0;
  9. let canClick = true;
  10.  
  11. console.log("Made by [email protected]; idea from cookie clicker by orteil \nCheated biscuits taste bad.")
  12. biscuitButton.onclick = function() {
  13.   if (canClick) {
  14.     score++;
  15.     scoreText.innerText = score;
  16.     canClick = false;
  17.  
  18.     setTimeout( function() {
  19.         canClick = true;
  20.     }, 250);
  21.     }
  22.   }
  23.  
  24.  
  25. resetButton.onclick = function() {
  26.     score = 0;
  27.     amountOfAutoClickers = 0;
  28.     scoreText.innerText = score;
  29.     amountOfAutoClickersText.innerText = amountOfAutoClickers;
  30. }
  31. buyAutoClicker.onclick = function() {
  32.     if (score < 100) {
  33.         console.log("no mony");
  34.     } else {
  35.         score -= 100;
  36.         amountOfAutoClickers++;
  37.         amountOfAutoClickersText.innerText = amountOfAutoClickers;
  38.         setInterval(autoClick, 4000);
  39.     }
  40.  
  41.    
  42.     function autoClick() {
  43.  
  44.         scoreText.innerText = score;    
  45.         score += amountOfAutoClickers;
  46.         scoreText.innerText = score;
  47.        
  48.     }
  49. }
  50. /**function incrementScore() {
  51.   score++;
  52.   scoreText.innerText = score;
  53. }**/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement