create dict with filenames
This commit is contained in:
parent
73537ee635
commit
f22cd5a191
@ -8,13 +8,16 @@ from os.path import isfile, join
|
||||
import pygame
|
||||
import time
|
||||
|
||||
SoundFolder = 'sounds'
|
||||
|
||||
def initialize_gui(gameTitle):
|
||||
# start pygame
|
||||
pygame.init()
|
||||
# start the display (required by the event loop)
|
||||
pygame.display.set_mode((320, 200))
|
||||
pygame.display.set_caption(gameTitle)
|
||||
# Load sounds from the sound directory
|
||||
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
|
||||
# Load sounds from the sound directory and creates a dict like that {'bottle': 'bottle.ogg'}
|
||||
soundFiles = {f.split('.')[0]:f for f in listdir(SoundFolder) if isfile(join(SoundFolder, f))}
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user