Textbutton Image?
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Textbutton Image?
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?
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Textbutton Image?
Create a screen that has the image on it. Have the button show the screen.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Re: Textbutton Image?
Thanks trooper6
So, is it the only way?
I mean I'll need too many screens
So, is it the only way?
I mean I'll need too many screens
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: Textbutton Image?
Code: Select all
screen mop():
add "image.png" xalign 0.5 yalign 0.5
textbutton "Return" action Hide("mop") xalign 1.0
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Textbutton Image?
Could you give more information about what the actual use case is? Because there may be more efficient ways to do what you want.
Also you can pass a variable to a screen, for example, you could pass an image to that screen. So, one screen, passing whichever image you need.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
Re: Textbutton Image?
So, in my game I have a side menu made of textbuttons, in the center of the screen there is an image that I want to change when one of the buttons is clicked.
Something like if I click on "Happy Button" the centered image will change to "Happy image"
I can do it with screens but I'll need lots of them
Also I'm trying to use variable something like this:
I don't know I'm a bit confused right now
Something like if I click on "Happy Button" the centered image will change to "Happy image"
I can do it with screens but I'll need lots of them
Also I'm trying to use variable something like this:
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")
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Textbutton Image?
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
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Re: Textbutton Image?
Guys, I really love you
It works perfectely thanks, thanks, thanks
It works perfectely thanks, thanks, thanks
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot], Ocelot, WladekProd