I'm following a tutorial that involves pygame zero and adapting it to create a pygame program, but am haing issues with my timer. The time_left variable is set to 10 earlier, here is the rest of the code to do with the timer:
def update_time_left():
global time_left
if time_left:
time_left = time_left - 1
else:
game_over()
clock.schedule_interval(update_time_left, 1.0)
will the clock.schedule_interval() part work in pygame? And if not is there anything else I can use instead?
schedule_interval
doesn't exist in pygame. See pygame.time
module. schedule_interval
it is a method of the class Clock
in pygame zero. See Pygame Zero - Built-in Objects.
In pygame you can create a timer event. See the answers to the question Python 3.8 pygame timer? or Countdown timer in Pygame.