【发布时间】:2021-07-22 23:13:22
【问题描述】:
def score():
global x_score, o_score
scoreFont = pygame.font.SysFont('Comic Sans', 20, bold=True)
SCORE = scoreFont.render(f'X {x_score} : {o_score} O', True, (0, 0, 0))
screen.blit(SCORE, ((WIDTH / 2) - (SCORE.get_width() / 2), HEIGHT + SCORE.get_height()))
-
WIDTH 和 HEIGHT = 屏幕宽度和高度
-
定义了 x 和 o 分数
-
pygame 和字体都是从一开始就初始化的
-
函数后调用
pygame.display.flip()
我的代码中的其他所有内容都显示了这个。谁能帮助我并告诉我在尝试显示分数时我做错了什么?
【问题讨论】:
标签: python pygame text-rendering