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

View file

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