【发布时间】:2014-12-22 22:09:23
【问题描述】:
我正在编写我正在制作的游戏的介绍代码,这里的介绍是将一系列图像以 4 秒的时间延迟传送。问题是,使用 time.sleep 方法也会弄乱主循环,因此程序会在这段时间内“挂起”。请问有什么建议吗? [Intro 和 TWD 是声音对象]
a=0
while True:
for event in pygame.event.get():
if event.type==QUIT:
pygame.quit()
sys.exit()
Intro.stop()
TWD.stop()
if a<=3:
screen.blit(pygame.image.load(images[a]).convert(),(0,0))
a=a+1
if a>1:
time.sleep(4)
Intro.play()
if a==4:
Intro.stop()
TWD.play()
pygame.display.update()
【问题讨论】:
-
sys.exit()退出程序。之后的代码没有运行。
标签: python time pygame timedelay