1
我想添加一个启动画面pygame的,但我不能得到它的工作,这里是代码:pygame的闪屏
def game_intro():
intro = true
while intro:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
quit()
gamedisplay.fill(WHITE)
largeText = pygame.font.Font('Arial',155)
textSurf, textRect = text_objects("test", largeText)
textRect.centre = ((display_width/2), (display_height/2))
gamedisplay.blit(textSurf, textRect)
pygame.display.update()
clock.tick(15)
,这里是我得到的错误:
File "/Users/harrisonj11/NetBeansProjects/game_test_jakob/src/game_test_jakob.py", line 188, in <module>
game_intro()
File
"/Users/harrisonj11/NetBeansProjects/game_test_jakob/src/game_test_jakob.py", line 172, in game_intro
intro = true
NameError: name 'true' is not defined
感谢,似乎工作,但它只是现在空白scren现在 –
请问空白启动画面的另一个问题,并提供一个最小的代码示例,我们可以运行,因此它更容易帮助你。 答案解决了您发布的错误追踪;如果你满意,你可以考虑接受它。 –
'gamedisplay.fill(WHITE)'很可能是你获得白屏的原因;那么你可能必须刷新它或交换缓冲区。 –