I've done it the simplest way I could think of. I made the big protagonist figure a character (named "chopro") with several layers of graphics, and I show him before starting a choice sequence. To change his expression, I need to change the variable that controls his face layer ("choice_exp"). Right now, the value of this variable is "choice_attentive", an attentive face. If I want a choice to make the protagonist figure smile, the variable's value needs to change to "choice_delighted". The figure should then immediately update with its new expression. But how can I make hovering a choice button alter the variable "choice_exp" to the value "choice_delighted"? And can I change the variable once more, back to "choice_attentive" when the choice button is no longer hovered?
Somehow, I need to attach the text string "choice_delighted" to a choice, preferably without this actually being contained in the text of the choice box. Then, I need to make hovering the choice alter the variable "choice_exp" to this string, and reverse it when the button is unhovered. Does anyone have any suggestions how I might pull this off?
This is how the protagonist figure's graphics is defined:
Code: Select all
#Choice screen protagonist figure
# Character definition
define chopro = Character('Choice', color="#f8f1e5", who_suffix = '', what_prefix='"', what_suffix='"')
# Sprite composition
default choice_background = "choice_background" #darkens everything behind the choice screen
default choice_overlay = "choice_overlay" #the blue and yellow stripes behind the protagonist figure
default choice_body = "choice_body" #protagonist figure's headless body
default choice_exp = "choice_attentive" #protagonist figure's head with facial expression
default choice_eff = "choice_none" #an extra layer where I can add effects like bruises, blushes, etc.
image chopro = LiveComposite(
(1920, 1080),
(0, 0), "images/char/choice/[choice_background].png",
(0, 0), "images/char/choice/[choice_overlay].png",
(0, 0), "images/char/choice/[choice_exp].png",
(0, 0), "images/char/choice/[choice_body].png",
(0, 0), "images/char/choice/[choice_eff].png"
)
Code: Select all
window hide
show chopro at left with easeinleft
menu:
"Disbelieve it":
hide chopro with easeoutleft
pro "Don't be silly, it's a bird."
"Pretend not to notice":
hide chopro with easeoutleft
pro "What? Where? There's nothing."
"Dude, that's totally a UFO":
hide chopro with easeoutleft
pro "DON'T ABDUCT ME!"
Code: Select all
## Choice screen
screen choice(items):
style_prefix "choice"
vbox:
for i in items:
textbutton i.caption action i.action
## When this is true, menu captions will be spoken by the narrator. When false,
## menu captions will be displayed as empty buttons.
define config.narrator_menu = True
style choice_vbox is vbox
style choice_button is button
style choice_button_text is button_text
style choice_vbox:
xalign 0.5
ypos 405
yanchor 0.5
spacing gui.choice_spacing
style choice_button is default:
properties gui.button_properties("choice_button")
hover_sound "sfx/click.wav" #This makes the button click when it is hovered
#activate_sound "sfx/click.wav" #This makes the button click when you click it
style choice_button_text is default:
properties gui.button_text_properties("choice_button")