pygame.mixer.init()
songs = ["sugar-1.mp3","sugar-2.mp3","sugar-3.mp3"]
current = 0
while True:
if not (pygame.mixer.music.get_busy()):
pygame.mixer.music.load(songs[current])
pygame.mixer.music.set_volume(0.5)
pygame.mixer.music.play()
current = current + 1
if current > len(songs) - 1:
current = 0
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
看了一眼doc。试了一下 感觉这样应该没啥问题了。只是感觉写在循环里。 如果以后游戏做大了会出事情吧。
展开
作者回复: 真的大型游戏也不会真的拿来做代码测试用