added function to get packs
This commit is contained in:
parent
ed548bdcf5
commit
5ff6de4b58
1 changed files with 6 additions and 0 deletions
|
@ -25,6 +25,7 @@ class Textures():
|
||||||
self.images["TARGETS"].append(filename)
|
self.images["TARGETS"].append(filename)
|
||||||
|
|
||||||
self.pack = packName
|
self.pack = packName
|
||||||
|
else: logging.warn("Cannot find texture pack '{}'".format(packName))
|
||||||
|
|
||||||
def get_texture(self, objectName):
|
def get_texture(self, objectName):
|
||||||
filename = self.path + self.pack + "\\{0}.png".format(self.images[objectName.upper()])
|
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"]))])
|
filename = self.path + self.pack + "\\{}.png".format(self.images["TARGETS"][randint(0,len(self.images["TARGETS"]))])
|
||||||
return pygame.image.load(filename)
|
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"))
|
Level_Template = namedtuple('Level_Template', ("rows", "padding", "firebacks", "powerups"))
|
||||||
Levels = [
|
Levels = [
|
||||||
|
@ -51,6 +56,7 @@ def generate_random_level():
|
||||||
powerups = randint(0, 15)
|
powerups = randint(0, 15)
|
||||||
return Level_Template(rows, padding, firebacks, powerups)
|
return Level_Template(rows, padding, firebacks, powerups)
|
||||||
|
|
||||||
|
|
||||||
Sounds = {}
|
Sounds = {}
|
||||||
def init_sounds():
|
def init_sounds():
|
||||||
music_files = ["main.mp3", "fire.mp3"]
|
music_files = ["main.mp3", "fire.mp3"]
|
||||||
|
|
Reference in a new issue