Side Image Left/Right
Posted: Sat Feb 17, 2018 3:39 am
I recently converted my side images to LiveComposite() and ConditionSwitch(). My original code used Image() and had an xalign set based on the sprite. Some of my sprites were set to the left and other's to the right. I don't know how to add an xalign to LiveComposite or ConditionSwitch and I realize I need an extra pair of eyes to fix this. This was the old code:
The position of the side image was based on the yalign and xalign and when transformed it would only switch places depending on the character speaking. In the new code is there a place to add a position? The transform and the config.side_image_change_transform haven't changed. I don't want to add a xalign to the transform because some sprites need to be on the left and the other's on the right. Current code of side image used.
Code: Select all
transform change_transform(old, new):
contains:
old
alpha 1.0
linear 0.3 alpha 0.0
contains:
new
alpha 0.0
linear 0.3 alpha 1.0
define config.side_image_change_transform = change_transform
image side mary_face = ConditionSwitch(
"rf == 'base'", Image("images/side_mary.png", yalign=1.0, xalign=1.0),
"rf == 'angry'", Image("images/side_mary angry.png", yalign=1.0, xalign=1.0),
"rf == 'sad'", Image("images/side_mary sad.png", yalign=1.0, xalign=1.0),
"rf == None", Image("images/side_side_mary.png", yalign=1.0, xalign=1.0)
)Code: Select all
image side erin_small = LiveComposite(
(617, 653),
(0, 0), "ebase.png",
(135, 241),
ConditionSwitch(
"efe == 'norm'", ConditionSwitch("str(ep) == 'type1'", "eyes type1","str(ep) == 'type2'","eyes type2","str(ep) == 'type3'", "eyes type3"),
"efe == 'glance'", ConditionSwitch("str(ep) == 'type1'", "eyes type1_glance","str(ep) == 'type2'","eyes type2_glance","str(ep) == 'type3'", "eyes type3_glance"),
"efe == 'nar'", ConditionSwitch("str(ep) == 'type1'", "eyes type1_nar","str(ep) == 'type2'","eyes type2_nar","str(ep) == 'type3'", "eyes type3_nar"),
"efe == 'sur'", ConditionSwitch("str(ep) == 'type1'", "eyes type1_sur","str(ep) == 'type2'","eyes type2_sur","str(ep) == 'type3'", "eyes type3_sur")
),
(179, 360), ConditionSwitch("efm == 'close'", "images/mouth.png","efm == 'part'", "images/mouth-part.png","efm == 'open'", "images/mouth-yell.png"),
(113, 203), ConditionSwitch("efb == 'norm'", "images/b.png","efb == 'nar'", "images/b-frown.png","efb == 'huh'", "images/b-huh.png","efb == 'sad'", "images/b-sad.png","efb == 'sur'", "images/b-sur.png"))