Bug fixes. Improvements to play_randiom
This commit is contained in:
parent
4e6b6ded7c
commit
8d90030011
@ -74,12 +74,15 @@ def initialize_gui(gameTitle):
|
|||||||
time.sleep(soundData['game-intro'].get_length())
|
time.sleep(soundData['game-intro'].get_length())
|
||||||
return soundData
|
return soundData
|
||||||
|
|
||||||
def play_random(soundName):
|
def play_random(sounds, soundName, pause = False):
|
||||||
key = []
|
key = []
|
||||||
for i in sounds.keys():
|
for i in sounds.keys():
|
||||||
if re.match("^" + soundName + ".*", i):
|
if re.match("^" + soundName + ".*", i):
|
||||||
key.append(i)
|
key.append(i)
|
||||||
psounds[random.choice(key)].play()
|
randomKey = random.choice(key)
|
||||||
|
sounds[randomKey].play()
|
||||||
|
if pause == True:
|
||||||
|
time.sleep(sounds[randomKey].get_length())
|
||||||
|
|
||||||
def instructions():
|
def instructions():
|
||||||
# Read in the instructions file
|
# Read in the instructions file
|
||||||
|
Loading…
Reference in New Issue
Block a user