我试图为我正在制作的游戏创建一个标题屏幕,但当我运行程序时,它只是一个黑色的画布。没有标题,一切正常,游戏(这是一个迷宫)运行完美,但如果我试图添加我的标题fcn一切都搞砸了。 当运行我的程序时,我调用:
game_intro()
game_loop() #the fcn that stores my game code
这是我的标题fcn代码:
def game_intro():
intro = True
while intro == True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
screen.fill((WHITE))
largeText = pygame.font.Font(None, 115)
TextSurf, TextRect = text_objects("H&D: Hedges and Dragons", largeText)
TextRect.center = ((DISPLAY_WIDTH/2), (DISPLAY_HEIGHT/2))
screen.blit(TextSurf, TextRect)
pygame.display.update()
clock.tick(FPS)
我感谢任何帮助或建议!你知道吗
您需要在while循环之前初始化pygame:
相关问题 更多 >
编程相关推荐