Try to fix the problem with cut scenes sometimes not playing in the correct position and at the correct volume.
This commit is contained in:
parent
7902dfacd1
commit
df7945e3b6
15
__init__.py
15
__init__.py
@ -681,13 +681,24 @@ def cut_scene(sounds, soundName):
|
|||||||
"""
|
"""
|
||||||
pygame.event.clear()
|
pygame.event.clear()
|
||||||
pygame.mixer.stop()
|
pygame.mixer.stop()
|
||||||
|
|
||||||
|
# Get the reserved channel (0) for cut scenes
|
||||||
channel = pygame.mixer.Channel(0)
|
channel = pygame.mixer.Channel(0)
|
||||||
|
|
||||||
|
# Apply the appropriate volume settings
|
||||||
|
# Use sfxVolume since cut scenes are sound effects
|
||||||
|
# Multiply by masterVolume for global volume control
|
||||||
|
channel.set_volume(sfxVolume * masterVolume, sfxVolume * masterVolume)
|
||||||
|
|
||||||
|
# Play the sound
|
||||||
channel.play(sounds[soundName])
|
channel.play(sounds[soundName])
|
||||||
|
|
||||||
while pygame.mixer.get_busy():
|
while pygame.mixer.get_busy():
|
||||||
event = pygame.event.poll()
|
for event in pygame.event.get():
|
||||||
if event.type == pygame.KEYDOWN and event.key in [pygame.K_ESCAPE, pygame.K_RETURN, pygame.K_SPACE]:
|
if event.type == pygame.KEYDOWN and event.key in [pygame.K_ESCAPE, pygame.K_RETURN, pygame.K_SPACE]:
|
||||||
pygame.mixer.stop()
|
pygame.mixer.stop()
|
||||||
pygame.event.pump()
|
return
|
||||||
|
pygame.time.delay(10)
|
||||||
|
|
||||||
def play_random_falling(sounds, soundName, player_x, object_x, start_y,
|
def play_random_falling(sounds, soundName, player_x, object_x, start_y,
|
||||||
currentY=0, max_y=20, existing_channel=None):
|
currentY=0, max_y=20, existing_channel=None):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user