Hello dear Ren'Py people,
I'm pretty new to Ren'Py, so maybe this is a dumb question.
But I've been struggling with this for a week now, and couldn't find any solution yet.
So, I have a movie as background, and I there are sections (like a door, or a character) and when hovered over them, a button should appear next to them or within them (like walk, or talk). I figured, because my background is a movie, I can't use imagemap and set my movie as ground and set hotspots.
So I came up with an ugly workaround: I used an imagemap and added an idle image with 1% opacity, and I have the hover button image as hover. But when I hover, there's this flickering of the button. There must be an elegant solution to this. I'm really hoping for your (beginner-friendly)help.
My code so far:
screen SewersOverlayScreen():
add Movie(play="images/backgrounds/sewers.webm")
imagebutton:
focus_mask True
idle "images/Overlays/SewersOverlayBoy.png" #<- The image with 1% opacity
hover "images/Btns/TalkBtnSewersBoy.png"
hover_sound "audio/FX/softKlick.wav"
action Jump("SomeLabel")
Attached is an image that displays my actual setup.
Invisible idle problem – Can't make the buttons work the way I want to
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.
Invisible idle problem – Can't make the buttons work the way I want to
- Attachments
-
- reddit renpy question1.png
- (2.26 MiB) Not downloaded yet
- m_from_space
- Eileen-Class Veteran
- Posts: 1029
- Joined: Sun Feb 21, 2021 3:36 am
- Contact:
Re: Invisible idle problem – Can't make the buttons work the way I want to
I think the reason for the flickering is that the hover image doesn't contain the 1% opacity parts. But it has to. Otherwise in the moment you hover, it's switching out the image, which means you're not hovering it anymore, which switches back, then forth and back and forth.JonuFilms wrote: ↑Mon Jan 29, 2024 10:57 am But when I hover, there's this flickering of the button. There must be an elegant solution to this. I'm really hoping for your (beginner-friendly)help.
My code so far:
screen SewersOverlayScreen():
add Movie(play="images/backgrounds/sewers.webm")
imagebutton:
focus_mask True
idle "images/Overlays/SewersOverlayBoy.png" #<- The image with 1% opacity
hover "images/Btns/TalkBtnSewersBoy.png"
hover_sound "audio/FX/softKlick.wav"
action Jump("SomeLabel")
So just create the original image (with the 1% opacity parts) and as the hover image, add the buttons, but do not remove the opacity parts.
Re: Invisible idle problem – Can't make the buttons work the way I want to
Thanks a lot!
That worked. I also figured out an alternative way by having an imagemap and as ground I added an invisbible rectancle (1920*1080).
Both way are not perfect though, because it's not only the actual button illustration (TalkBtnSewersBoy) that is clickable but also the area around it. I guess I'll have to live with that.
That worked. I also figured out an alternative way by having an imagemap and as ground I added an invisbible rectancle (1920*1080).
Both way are not perfect though, because it's not only the actual button illustration (TalkBtnSewersBoy) that is clickable but also the area around it. I guess I'll have to live with that.
- m_from_space
- Eileen-Class Veteran
- Posts: 1029
- Joined: Sun Feb 21, 2021 3:36 am
- Contact:
Re: Invisible idle problem – Can't make the buttons work the way I want to
Your 1% approach with a focus_mask sounded fine to me. Why switch to a rectangle?JonuFilms wrote: ↑Wed Jan 31, 2024 4:16 am Thanks a lot!
That worked. I also figured out an alternative way by having an imagemap and as ground I added an invisbible rectancle (1920*1080).
Both way are not perfect though, because it's not only the actual button illustration (TalkBtnSewersBoy) that is clickable but also the area around it. I guess I'll have to live with that.
Who is online
Users browsing this forum: Ahrefs [Bot], boundsoul, Imperf3kt