- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
有没有办法将多首歌曲加载到 Pygame 中?我不是在谈论这样的音效;
crash_sound = pygame.mixer.Sound("crash.ogg")
#and
pygame.mixer.Sound.play(crash)
pygame.mixer.music.load("chill_music.ogg")
#and
pygame.mixer.music.stop()
最佳答案
I need this feature, because it let's me set it to a '-1' value making it play over and over again, which I'm pretty sure you can't do with the sound effect
play()
begin sound playback
play(loops=0, maxtime=0, fade_ms=0) -> Channel
The loops argument controls how many times the sample will be repeated after being played the first time. ... If loops is set to -1 the Sound will loop indefinitely (though you can still call stop() to stop it).
Sound
类(class)。
but I want two different songs for two different levels
pygame.mixer.music.load(...)
再次使用另一个声音文件。它将停止播放当前文件并开始播放新文件。
The difference between the music playback and regular Sound playback is that the music is streamed, and never actually loaded all at once...
pygame.mixer.music
是要走的路。如果您不介意完全加载文件,可以使用
Sound
类(class)。
关于pygame - 如何将多首歌曲/轨道加载到 pygame 中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59817691/
我是一名优秀的程序员,十分优秀!