Textbutton Image?
Posted: Tue Jun 16, 2020 11:15 pm
Hello guys!
Is it possible to show an image by clicking in a textbutton?
Is it possible to show an image by clicking in a textbutton?
Supporting creators of visual novels and story-based games since 2003.
https://lemmasoft.renai.us/forums/
Code: Select all
screen mop():
add "image.png" xalign 0.5 yalign 0.5
textbutton "Return" action Hide("mop") xalign 1.0
Could you give more information about what the actual use case is? Because there may be more efficient ways to do what you want.
Code: Select all
image mood = mood_img
define mood_img = "happy.png"
screen mood_image:
add "mood_img"
screen mood_screen:
use mood_image
vbox:
xalign 0.90
yalign 1.0
textbutton "Happy" action SetVariable("mood_img", "happy.png")
textbutton "Sad" action SetVariable("mood_img", "sad.png")
Code: Select all
# variable with string value
default current_mood = "happy"
# using interpolation makes this image dynamic... it updates automatically to show the correct image
image mood = "images/[current_mood].png"
screen mood_image:
add "mood"
screen mood_screen:
use mood_image
vbox:
xalign 0.90
yalign 1.0
textbutton "Happy" action SetVariable("current_mood", "happy")
textbutton "Sad" action SetVariable("current_mood", "sad")
# Note we change the variable not the image
# As the image is dynamic, it will pick up the change to the variable