Invisible idle problem – Can't make the buttons work the way I want to

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
JonuFilms
Newbie
Posts: 3
Joined: Mon Jan 29, 2024 9:32 am
Contact:

Invisible idle problem – Can't make the buttons work the way I want to

#1 Post by JonuFilms »

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.
Attachments
reddit renpy question1.png
(2.26 MiB) Not downloaded yet

User avatar
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

#2 Post by m_from_space »

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")
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.

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.

JonuFilms
Newbie
Posts: 3
Joined: Mon Jan 29, 2024 9:32 am
Contact:

Re: Invisible idle problem – Can't make the buttons work the way I want to

#3 Post by JonuFilms »

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.

User avatar
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

#4 Post by m_from_space »

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.
Your 1% approach with a focus_mask sounded fine to me. Why switch to a rectangle?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], boundsoul, Imperf3kt