if pygame.sprite.collide_rect(ship,missile) == True:
ship.image = pygame.image.load("lose.jpg")
ship.image = ship.image.convert()
ship.rect = ship.image.get_rect()
break
我如何制作它以便在显示'lose.jpg'然后中断并退出程序时等待几秒钟?
答案 0 :(得分:2)
你可以试试这个:
def pause(time_to_wait):
clock = pygame.time.Clock()
total = 0
while True:
total += clock.tick()
if(total > time_to_wait):
return
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()