How do you create a counter using variables?


I’m making a clicker game. I need help

1 Like


Declare your score tracking variable.

var score =0;

Then, inside the button press code, increase the
value of score.
score +=1;



Here’s a quick example that should help!
cookieClicker.wick (1.8 KB)



Also, you may want to look at the button and interactive text tutorial video!

The general idea is

  1. Create a button that can be clicked
  2. Create a variable in the project that we can store a number in.
  3. Increase that number everytime a click happens!

After we do this, we can use those points to create a purchasing system, prizes, etc… Let us know if you’d like help at that step!

1 Like


Thanks for the help! :smiley:

1 Like