added function to get packs
This commit is contained in:
parent
ed548bdcf5
commit
12465b75ff
1 changed files with 6 additions and 0 deletions
|
@ -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"]
|
||||
|
|
Reference in a new issue