repl.it
@austinsanims/

Custom_ClickerGame

HTML, CSS, JS

No description

fork
loading
Files
  • index.html
  • script.js
  • style.css
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>repl.it</title>
    <link href="style.css" rel="stylesheet" type="text/css" />
  </head>
  <body>
    <button onclick="addClick()">placeholder</button>
    <button onclick="buy('clickerItem')">buy clicker (<div id="priceClicker"></div>)</button>
    <div id="displayTheClicks"></div>
    <script>
      var counter = 0
      var priceClicker = 10
      var priceSpeedClicker = 50
      var clickerNum = 0
      var speedClickerNum = 0
      function addClick() {
        counter++
        document.getElementById('displayTheClicks').innerHTML = counter.toString();
        
      };
      if(document.getElementById('displayTheClicks').innerHTML != counter.toString()) {
        document.getElementById('displayTheClicks').innerHTML = counter.toString();
      }
      function buy(item) {
        if(item === 'clickerItem') {
          if (counter >= priceClicker) {
            counter = counter - priceClicker
            clickerNum++
            priceClicker = priceClicker+2
            }
        }
      }
      function clickerClicking() {
        var i;
if(clickerNum > 0) {
          sleep(100)
          counter++}
        }
      
      function sleep (time) {
  return new Promise((resolve) => setTimeout(resolve, time));

}
    </script>
  </body>
</html>
result
console