Little fixing up for different sounds

This commit is contained in:
Vishal 2025-01-15 21:33:23 +05:30 committed by GitHub
parent 0e96a25d81
commit 8119aa1203
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -8,6 +8,8 @@ from typing import override
import bauiv1 as bui import bauiv1 as bui
import random
class HelpWindow(bui.MainWindow): class HelpWindow(bui.MainWindow):
"""A window providing help on how to play.""" """A window providing help on how to play."""
@ -402,7 +404,7 @@ class HelpWindow(bui.MainWindow):
color=(1, 0.7, 0.3), color=(1, 0.7, 0.3),
selectable=False, selectable=False,
enable_sound=False, enable_sound=False,
on_activate_call=bui.getsound('spazAttack01').play, on_activate_call=bui.WeakCall(self._play_sound, 'spazAttack0', 4),
) )
txt_scale = getres(f'{self._r}.punchInfoTextScale') txt_scale = getres(f'{self._r}.punchInfoTextScale')
@ -430,7 +432,7 @@ class HelpWindow(bui.MainWindow):
color=(1, 0.3, 0.3), color=(1, 0.3, 0.3),
selectable=False, selectable=False,
enable_sound=False, enable_sound=False,
on_activate_call=bui.getsound('explosion01').play, on_activate_call=bui.WeakCall(self._play_sound, 'explosion0', 5),
) )
txt = bui.Lstr(resource=f'{self._r}.bombInfoText').evaluate() txt = bui.Lstr(resource=f'{self._r}.bombInfoText').evaluate()
@ -459,7 +461,7 @@ class HelpWindow(bui.MainWindow):
color=(0.5, 0.5, 1), color=(0.5, 0.5, 1),
selectable=False, selectable=False,
enable_sound=False, enable_sound=False,
on_activate_call=bui.getsound('spazPickup01').play, on_activate_call=bui.WeakCall(self._play_sound, 'spazPickup0', 1),
) )
txtl = bui.Lstr(resource=f'{self._r}.pickUpInfoText') txtl = bui.Lstr(resource=f'{self._r}.pickUpInfoText')
@ -487,7 +489,7 @@ class HelpWindow(bui.MainWindow):
color=(0.4, 1, 0.4), color=(0.4, 1, 0.4),
selectable=False, selectable=False,
enable_sound=False, enable_sound=False,
on_activate_call=bui.getsound('spazJump01').play, on_activate_call=bui.WeakCall(self._play_sound, 'spazJump0', 4),
) )
txt = bui.Lstr(resource=f'{self._r}.jumpInfoText').evaluate() txt = bui.Lstr(resource=f'{self._r}.jumpInfoText').evaluate()
@ -643,6 +645,9 @@ class HelpWindow(bui.MainWindow):
res_scale=0.5, res_scale=0.5,
) )
def _play_sound(self, text: str, num: int):
bui.getsound(text + str(random.randint(1, num))).play()
@override @override
def get_main_window_state(self) -> bui.MainWindowState: def get_main_window_state(self) -> bui.MainWindowState:
# Support recreating our window for back/refresh purposes. # Support recreating our window for back/refresh purposes.