Hey there! So, I'm working on my game and I sort of am hitting a snag in how I want it to look.
So, I have an image button, and as a standard for them they have the idle image and the image for when the mouse hovers on them. It does this switch instantly.
What I'm struggling with is that instead of having it just instantly switch, I'd like if they could fade in and out of eachother, kind of like so (apologies for the ugly gif):
For reference, here's the two images I'm using:
idle
hover
If anyone could help me with this I'd be greatly appreciative!
Making An Imagebutton's idle image fade to it's hover 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.
- Velvetique
- Newbie
- Posts: 15
- Joined: Tue Mar 14, 2017 10:37 pm
- Contact:
- dGameBoy101b
- Regular
- Posts: 31
- Joined: Sun Aug 12, 2018 8:32 am
- itch: dgameboy101b
- Contact:
Re: Making An Imagebutton's idle image fade to it's hover image?
You can use the show button action with the hovered and unhovered attributes of a screen button to switch between two different screens of the idle button and the hovered button to use transitions between the two states. Here is an example.
You can use any transition you want (including custom defined transitions) to switch between the two states or even have different states depending on which direction the button state is switching. This does mean you will have to layer screens for multiple buttons at the same time and ensure that each of those screens have modal set to false with unique tags for each button.
Code: Select all
screen fadeButtonHover():
modal false
tag fadeButton1
imagebutton:
idle "button_hover.png"
unhovered Show("fadeButtonIdle",transition=dissolve)
action Jump("start")
screen fadeButtonIdle():
modal false
tag fadeButton1
imagebutton:
idle "button_idle.png"
hovered Show("fadeButtonHover",transition=dissolve)
action NullAction()
- Velvetique
- Newbie
- Posts: 15
- Joined: Tue Mar 14, 2017 10:37 pm
- Contact:
Re: Making An Imagebutton's idle image fade to it's hover image?
Exactly what I was needing, thank you so much! This helps a ton.
- dGameBoy101b
- Regular
- Posts: 31
- Joined: Sun Aug 12, 2018 8:32 am
- itch: dgameboy101b
- Contact:
Re: Making An Imagebutton's idle image fade to it's hover image?
It might be possible to get this to work using an atl tranform with "on" event handlers, since the transform can be passed "hover" and "idle" events from the button, but I haven't been able to get it to work yet.
Who is online
Users browsing this forum: Google [Bot]