#restrict gameover sound play
played=False #这一段在游戏循环外添加
elif life_num==0:
#stop music,sound and timer,play gameover music
pygame.mixer_music.stop()
pygame.mixer.stop()
pygame.time.set_timer(SUPPLY_TIME,0)
if not played:#从这里到最后为gg音效执行的代码
played=True
gameover_sound.play()
在写飞机大战时企图往gameover中加入音效,但是最终gg时没有能播放出来,求解 相关代码:
在单步调试时音效可以正常播放,求问应该怎么做