我有一个正在倒计时的游戏,在倒计时结束时,我想在屏幕上显示文本“Missle Away!”3秒钟。我有下面的代码,但当我运行它时,文本永远不会显示。如果我删除延迟,文本将显示,但当然它不会在3秒钟后消失
def missle_call():
global missle_active
global active
while missle_active == True:
gameDisplay.blit(radarbg, (700, 100)) # clears the countdown text by writing the background image over it
TextSurf, TextRect = big_text_objects("Missle Away!" , large_base_font) # set font & text
TextRect.center = (950, 300) # set location of text
gameDisplay.blit(TextSurf, TextRect) # render text to screen
pygame.time.delay(3000) # continue to show text on screen for 3 seconds
gameDisplay.blit(radarbg, (700, 100)) # cover text on display by blitting the background image on it
active = False # reset the launch execution to not launched
return
else:
return
仅当^{} 或^{} 时,显示才会更新
被称为。此外,您还必须在显示更新在窗口中可见之前^{} 处理事件:
相关问题 更多 >
编程相关推荐