Professional Documents
Culture Documents
dressup_show = False
dressup_button_show = False
hair, glasses, tie, vest, skirt = 1, 1, 1, 1, 1 # default dressup items
hair_styles_num, glasses_styles_num, tie_styles_num, vest_styles_num,
skirt_styles_num = 8, 3, 6, 3, 3 # number of styles (files) for each dressup item
# define images as:
# "base.png" for the base image
# "hair1.png", "hair2.png", "hair3.png", ... - start with 1 and end with
(hair_styles_num)
# "glasses1.png", "glasses2.png", "glasses3.png", ... "tie1.png", "tie2.png", ...
"vest1.png", "vest2.png", ... "skirt1.png", "skirt2.png", ...
def draw_girl(st, at): # combine the dressup items into one displayable
return LiveComposite(
(257, 560), # image size
(0, 0), "base.png",
(0, 0), "hair%d.png"%hair, # (0, 0) is the position of each dressup item.
Because these images are saved with spacing around them, we don't need to
position them.
(0, 0), "glasses%d.png"%glasses,
(0, 0), "tie%d.png"%tie,
(0, 0), "vest%d.png"%vest,
(0, 0), "skirt%d.png"%skirt
),.1
def draw_girl_side(st, at): # same thing as above, just scaled and positioned
for the sideimage; there's probably more elegant solution than this...
return LiveComposite(
(257, 560),
(10, 400), im.FactorScale("base.png", .45, .45),
(10, 400), im.FactorScale("hair%d.png"%hair, .45, .45),
(10, 400), im.FactorScale("glasses%d.png"%glasses, .45, .45),
(10, 400), im.FactorScale("tie%d.png"%tie, .45, .45),
(10, 400), im.FactorScale("vest%d.png"%vest, .45, .45),
(10, 400), im.FactorScale("skirt%d.png"%skirt, .45, .45)
),.1
init:
image girl = DynamicDisplayable(draw_girl) # using DynamicDisplayable
ensures that any changes are visible immedietly
$ girl = Character('Girl', color="#c8ffc8", window_left_padding=120,
show_side_image=DynamicDisplayable(draw_girl_side))
screen dressup_button: # a button to call the dressup game
if dressup_button_show and not dressup_show:
vbox xalign 0.01 yalign 0.01: