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!

2 Likes

You are amazing!
That did the trick!

Thank you so much!

1 Like

Can you also help me with the gamification of this thing? I am actually planning it for my students. I want to add a speed calculation which would be simply total clicks divided by total time but the custom timer throws me off. I saw a working example on this click counter. Please guide.

Do you have a project started? Share a link.

I’m a bit confused with what you mean, but if you have an example project you can share it may help a little.
Thanks in advance!