Clock isn't working. I have tried all I can

I want a game to play for a set amount of time, say 2 minutes, and then display the scores to the user when the timer runs out. Below is the code.
I used three clocks. gameEndInterval clock is not working as I want. I want it to monitor the time the user will spend playing the game.

Thank.

TimerInterval ?

Set the TimerInterval property of your clock gameEndInterval to 1000 ( I.e. 1 second) and set your global variable timeInterval to 120

Taifun

1 Like

I don't trust '=' as a limit test.
It's paper thin.
What will happen if you somehow pass that number?
You would proceed forever.

It is more robust to use a >= test.

1 Like

@Taifun Thanks so much; it worked. Appreciate all who contributed; thanks a lot.

Exactly, at least not with small TimerIntervals.

Agreed, however in the give example this is not relevant, because the value is incremented inside the Timer event

Taifun

1 Like

Thank you for your comments.

This is a perfect opportunity for me to introduce the latest addition to my collection of defensive programming metaphors, entitled Never Enough Suspenders:

5 Likes

Please, can you explain the idea behind your solution?

Well, 1 Minute does have 60 seconds and 2 minutes do have 120 seconds...

As you are counting manually the seconds in the timer Event you also can set the timer interval to 120000 and remove the if statement to get the same result

Taifun

1 Like

That was detail. Thank a lot

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

Please, help me get this to display on the screen
Taifun answered the question on how to get it to work here Clock isn't working. I have tried all I can but I have been having issue on how to display it.

Please, @Taifun

To display what?

If you check this link to the previous question Clock isn't working. I have tried all I can, i was able to code the timer for the app but I am having on how to display it on the app.

And again:

Show an example of what should be displayed (and post your blocks & aia).

Do not worry, i have been able to solve it