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:
R. Tyler Ballance 2010-02-13 17:47:31 -08:00
parent 6663c94221
commit c0ba0915f7
74 changed files with 5 additions and 2 deletions

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
View File

@ -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