I've been trying to create a skin/wardrobe system for a project that I am working on, but I found some problems with it.
Here is my code:
Here is the wardrobe screen code:
So...When the code is like that, it works fine. My real problem here, is when I try to add the skins from a label. Example:
The skin is unlocked and the button in wardrobe is created, but just along the game is not closed or reloaded. I don't know exactly what I am doing wrong, so your help would be appreciated.
ps. I'd also like to add empty slots for the wardrobe screen. For example, if the skin is locked it will show a slot with a lock inside. And even if there's no skin, it will show the empty slot image.
Here is my code:
Python:
init python:
class Skin(object):
def __init__(self, char, name, unlocked):
self.char = char
self.name = name
self.unlocked = unlocked
@property
def ButtonImage(self):
Output = "images/ui/newward/" + self.char + "_" + self.name + ".png" #### This is for the skin sprite that will show in the wardrobe.
return Output
@property
def ButtonHover(self):
Output = "images/ui/newward/" + self.char + "_" + self.name + "h.png" #### This is for the skin sprite that will show in the wardrobe when the mouse arrow is over the button.
return Output
def UnlockSkin(self):
if unlocked == False: ## I created this method after a little searching but didn't find the proper way to use it or even if it's coded right.
return True
skins = []
skins.append(Skin("kelly","outfit1", True))
skins.append(Skin("kelly","outfit2", True))
Python:
default kelly_skin = "" ### I use it to change the skin in the sprite.
image kelly = "images/kelly/body_[kelly_skin].png"
Python:
screen ward():
modal True
add "images/ui/wardrobe/bgward.png"
vbox:
grid 5 1:
allow_underfull True
xpos 700
ypos 120
spacing 20
for q in skins:
if q.unlocked:
hbox:
imagebutton:
idle q.ButtonImage #( "images/ui/wardrobe/{}.png".format( skins[i] ) )
hover q.ButtonHover #( "images/ui/wardrobe/{}h.png".format( skins[i] ) )
focus_mask True
action SetVariable("kelly_skin", q.name)
textbutton "X" text_style "base":
xpos 1215
ypos 95
action Hide("ward"), Call("kelly_actions") ##This button hides the wardrobe screen and returns to the character actions menu.
Python:
label mission1:
"This is the mission 1."
"Here is a new outfit for you."
$ skins.append(Skin("kelly","outfit2", True))
return
ps. I'd also like to add empty slots for the wardrobe screen. For example, if the skin is locked it will show a slot with a lock inside. And even if there's no skin, it will show the empty slot image.
Last edited: