在 Pygame Window 上替换文本
Replace Text On Pygame Window
我正在为我的 python 文件制作评分系统。我试过使用这个:
font = pygame.font.SysFont(None, 25)
text = font.render('Score: '+str(score), True, black)
gameDisplay.blit(text, [0,0])
由于某种原因,新乐谱覆盖在旧乐谱之上,您无法阅读。它产生了大量的数字。有没有办法替换文本?
在你的游戏循环中,你必须通过填充屏幕然后绘画来清除之前绘制的内容:
gameDisplay.fill(your_color_tuple)
# afterwards add your drawing code
我正在为我的 python 文件制作评分系统。我试过使用这个:
font = pygame.font.SysFont(None, 25)
text = font.render('Score: '+str(score), True, black)
gameDisplay.blit(text, [0,0])
由于某种原因,新乐谱覆盖在旧乐谱之上,您无法阅读。它产生了大量的数字。有没有办法替换文本?
在你的游戏循环中,你必须通过填充屏幕然后绘画来清除之前绘制的内容:
gameDisplay.fill(your_color_tuple)
# afterwards add your drawing code