1
Fork 0

added code for calling target image manually

This commit is contained in:
Jake Howard 2015-05-19 12:16:56 +01:00
parent cce185db01
commit 33df9d2ecf
1 changed files with 8 additions and 4 deletions

View File

@ -32,10 +32,14 @@ class Textures():
filename = self.path + self.pack + "\\{0}.png".format(self.images[objectName.upper()]) filename = self.path + self.pack + "\\{0}.png".format(self.images[objectName.upper()])
return pygame.image.load(filename) return pygame.image.load(filename)
def get_target_texture(self): def get_target_texture(self, ID=False):
index = randint(0,len(self.images["TARGETS"])-1) if len(self.images["TARGETS"]) >=1 else 0 if not ID:
filename = self.path + self.pack + "\\{}.png".format(self.images["TARGETS"][randint(0,len(self.images["TARGETS"])-1)]) index = randint(0,len(self.images["TARGETS"])-1) if len(self.images["TARGETS"]) >=1 else 0
return pygame.image.load(filename) filename = self.path + self.pack + "\\{}.png".format(self.images["TARGETS"][index])
return [pygame.image.load(filename), index]
else:
filename = self.path + self.pack + "\\target{}.png".format(int(ID))
return [pygame.image.load(filename), ID]
def list_packs(self): def list_packs(self):
return [x[0].replace(self.path, "") for x in os.walk(self.path)] return [x[0].replace(self.path, "") for x in os.walk(self.path)]