-2
我一直在做一個遊戲;其中一個主要組件是一個倒數計時器 - 但是這個計時器被延遲了,我無法推斷出原因。我希望它每秒減少一次,但是它似乎每6秒減少一次。倒數計時器以延遲方式遞減?
這裏是我怎麼也設置定時器起來:
loops = 0
minute = 1
tens = 0
ones = 0
#Timer Calculation
screen.blit(cloudSky, (0,0))
if go == True:
loops = loops + 1
if (loops % 60)== 0:
if ones == 0 and tens == 0 and minute != 0:
tens = 6
ones = 0
minute = minute - 1
if ones == 0 and tens != 0:
ones = 9
tens = tens - 1
elif ones != 0:
ones = ones - 1
elif tens == 0 and ones == 0:
tens = 5
minute = minute - 1
elif ones == 0 and tens != 0:
tens = tens - 1
if minute <= 0 and tens == 0 and ones == 0:
go = False
我打印在屏幕上用下面的代碼:
#Draw Clock Time
time = timeFont.render(str (minute)+ ":" + str (tens) + str (ones), True, WHITE)
screen.blit(time, (750,10))
任何幫助,不勝感激!