Using a random midi file for background music during the game
Most of the midi files are classical piano files from: http://www.piano-midi.de
This commit is contained in:
parent
6663c94221
commit
c0ba0915f7
BIN
background.mid
BIN
background.mid
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7
ty.py
7
ty.py
|
@ -109,7 +109,7 @@ class GameRunner(object):
|
|||
size = None
|
||||
clock = None
|
||||
tick = 30
|
||||
background_music = False
|
||||
background_music = True
|
||||
font = None
|
||||
spool = None
|
||||
|
||||
|
@ -147,7 +147,10 @@ class GameRunner(object):
|
|||
def runloop(self):
|
||||
run = True
|
||||
if self.background_music:
|
||||
pygame.mixer.music.load('background.mid')
|
||||
music_dir = os.path.join('sound', 'background')
|
||||
song = random.choice(os.listdir(music_dir))
|
||||
logging.debug('Using %s for background music' % song)
|
||||
pygame.mixer.music.load(os.path.join('sound', 'background', song))
|
||||
pygame.mixer.music.play(-1, 0.0)
|
||||
|
||||
story_title = None
|
||||
|
|
Loading…
Reference in New Issue