Creating a click counter game with a timer

Hi,

I am trying to sent a click counter game on App Lab.
I have created the clickcounter and the timer.

When the button is clicked, the clicks are counted and the timer begins.

However, the timer isn’t counting down properly.

Here is the code:

I am unsure what I am doing wrong.

Hello, @katrina.shea1
The reason your code doesn’t work is because each time the button is clicked, you start an entirely new loop that subtracts the time by 1.
To combat this, I would suggest putting the entire timedLoop inside an if statement that checks if the variable clickCount is equal to 1. This should stop the incorrect counting down.

example:
if(clickCount==1){ timedLoop code here }

Hope this helps!

1 Like

You are amazing!
That did the trick!

Thank you so much!

1 Like