我在使用 pygame 时遇到了麻烦......再次......这些天我发誓我会足够好,不必来这里寻求简单的答案......
无论如何,这次的问题是我试图在屏幕上打印带有变量的文本。
wordfont = pygame.font.SysFont("sans",12)
class Status:
def __init__(self):
self.a=30
def showme(self):
health = wordfont.render(("Your health: ", self.a,), 1, (255, 9, 12))
screen.blit(health, (150, 150))
它说它必须是字符串或 unicode ......但也许有某种方式?我再次提醒大家不要纠正我没有问到的任何事情。我知道可能有一些更简单的方法来做这些事情......