我制作了此方法,该方法执行了不止一次,而我的问题是每次调用都会重新开始播放音乐。有没有办法让音乐播放并避免在下一次通话中再次播放?
def schermataSconfitta(event):
global puntatoreSchermata
stampaImpiccato()
stampaLettereIndovinate()
stampaLettereSbagliate()
schermata.blit(testoSchermata["lose message"]("Game Over. The word was '" + ''.join(parolaCasuale) + "'", 1, nero),(100,50))
schermata.blit(testoSchermata["enter"]("Press SPACE to continue...", 1, nero),(100,100))
pygame.mixer.music.load("Suoni/gameover.mid")
pygame.mixer.music.set_volume(0.2)
pygame.mixer.music.play(999)
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_SPACE:
puntatoreSchermata = stringheSchermata["playAgain"]