1
我有一小段代码,如果一个if语句满足正在播放一次,它由一个声音:制作Pygame的播放声音ONCE
for block in block_list:
if block.rect.y >= 650 and health >=25 and score < 70:
player_list.remove(player)
all_sprites_list.remove(player)
font = pygame.font.Font("freesansbold.ttf", 30)
label = font.render("SCORE TARGET NOT MET", 1, YELLOW)
labelRect = label.get_rect()
labelRect.center = (400, 250)
error.play()
laser.stop()
但是在打“错误”的声音,就继续循环直到pygame窗口关闭。有什么方法可以编辑我的代码,以便“错误”音效仅播放一次?
谢谢。