So I am currently trying to make a clicking game for a final project but I have no clue how to make the timer go during the game and stop the game once the timer is up.
I've tried to implement a sleep timer into the program like
import time
seconds = 60
for i in range(seconds):
print(str(seconds - i) + " seconds remain")
time.sleep(1)
but it doesn't go simultaneously with the clicking game. The code I made for the clicking game is:
def display(x,y):
global numClicks
clear()
numClicks +=1
drawString("Number of clicks: "+str(numClicks),
100,150,"Arial",28,"normal")
update()
numClicks = 0
beginGrfx(800,500)
onscreenclick(display)
endGrfx()
The clicking game works and the timer starts at 60 seconds but it doesn't count down after that. Is there a different timer code I should be using or what?