如何在记忆游戏中添加计时器?

2024-06-01 22:17:47 发布

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

如果我想在游戏中添加计时器。我希望它从游戏开始到结束都出现在屏幕上,我应该添加什么代码?我应该在哪里添加代码

这就是游戏,我想我应该在第48行添加额外的代码,即“defmain()”。 http://inventwithpython.com/pygame/chapter3.html

def main():
    global FPSCLOCK, DISPLAYSURF
    pygame.init()
    FPSCLOCK = pygame.time.Clock()
    DISPLAYSURF = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT))

Tags: 代码comhttp游戏屏幕maindefhtml