1
Fork 0

added function to get packs

This commit is contained in:
Jake Howard 2015-05-11 22:17:04 +01:00
parent ed548bdcf5
commit 12465b75ff

View file

@ -25,6 +25,7 @@ class Textures():
self.images["TARGETS"].append(filename)
self.pack = packName
else: logging.warn("Cannot find texture pack '{}'".format(packName))
def get_texture(self, objectName):
filename = self.path + self.pack + "\\{0}.png".format(self.images[objectName.upper()])
@ -34,6 +35,10 @@ class Textures():
filename = self.path + self.pack + "\\{}.png".format(self.images["TARGETS"][randint(0,len(self.images["TARGETS"]))])
return pygame.image.load(filename)
def list_packs(self):
return [x[0] for x in os.walk(self.path)]
Level_Template = namedtuple('Level_Template', ("rows", "padding", "firebacks", "powerups"))
Levels = [
@ -51,6 +56,7 @@ def generate_random_level():
powerups = randint(0, 15)
return Level_Template(rows, padding, firebacks, powerups)
Sounds = {}
def init_sounds():
music_files = ["main.mp3", "fire.mp3"]