pygame屏幕上的倒计时延迟?

2024-06-26 00:04:22 发布

您现在位置:Python中文网/ 问答频道 /正文

我创建了一个游戏,其中一个主要组件是倒计时计时器-但是这个计时器被延迟了,我无法推断原因。你知道吗

我是这样设置计时器的:

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))

非常感谢您的帮助!你知道吗


Tags: andtrue游戏goiftimeonesscreen