Hey everyone,
I'm working on a visual novel and wondering if there's a way to make images interactive. Specifically, when a player clicks on an image displayed using an image tag in a dialogue, I want to trigger an action, like increasing the image size.
mc "Come on, after me.{image=smile.png}"
I want the image displayed by {image=smile.png} to increase in size when a player clicks on it.
Any advice or suggestions on how to achieve this would be greatly appreciated. Thanks!
Image Tag
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.
- Donmai
- Eileen-Class Veteran
- Posts: 1960
- Joined: Sun Jun 10, 2012 1:45 am
- Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
- Projects: Slumberland
- Location: Brazil
- Contact:
Re: Image Tag
You are describing an image button: https://www.renpy.org/doc/html/screens.html#imagebutton
This tutorial may be too advanced but it will show you some things you can do with clickable characters:
This tutorial may be too advanced but it will show you some things you can do with clickable characters:
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)
TOIRE NO HANAKO (A Story About Fear)
- m_from_space
- Miko-Class Veteran
- Posts: 975
- Joined: Sun Feb 21, 2021 3:36 am
- Contact:
Re: Image Tag
In Renpy you can basically make every image interactive and clickable, but not images that are placed via image tags. They are used for things like emojis or indicators and as far as I know not able to receive any events.
On the other hand - I just tried this - you can actually use a ConditionSwitch() (which is a special displayable) as an image tag as well, so from the outside you could change the appearance of an on-screen in-dialogue image. Which is funny. But as I said, you cannot make it receive any hover or click events. The only thing possible would be that the player hovers over a specific area in the say screen, that triggers the ConditionSwitch() values to change.
Hmm, now that I think of it, maybe it's possible to do a trick here. Letting the say screen show an invisible copy of the dialogue text, and trying to figure out where to place an invisible button, that's right over the image, that was placed within the text. And this button could then of course receive events and change the values for the ConditionSwitch().
Too complicated. Do you really need it? What's the point?
- Ocelot
- Lemma-Class Veteran
- Posts: 2407
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
- Contact:
Re: Image Tag
You can get a reaction on clicking by emberdding your image within {a} tag:
If you want reactions on hover, you need to be more inventive and remember that image tag can accept not only image files but also images. And you can put arbitrary displayables into those:
https://drive.google.com/file/d/18--4EE ... p=drivesdk
And if you don't need drastic changes like completely changing displayable on hover, you can simply rely on displayable style properties instead, so there would be only a single displayable definition within image, without any explicit event handlers.
Code: Select all
"Click here: {a=jump:somewhere}{image=target.png}{/a}"
https://drive.google.com/file/d/18--4EE ... p=drivesdk
Code: Select all
image inline_text:
TextButton("X", clicked=NullAction())
on idle:
TextButton("X", clicked=NullAction())
on hover:
TextButton("O", clicked=Jump("end"))
label start:
scene
"{image=inline_text}"
return
label end:
"end"
return
Last edited by Ocelot on Wed Jan 03, 2024 5:01 pm, edited 1 time in total.
< < insert Rick Cook quote here > >
Re: Image Tag
Thank you, that solves it!
Who is online
Users browsing this forum: Bing [Bot]