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.
I'm trying to use two videos for hover and idle states of a button. The normal route of using them as `background` and `hover_background` will cause them reset when the button is hovered.
As a workaround I've tried:
screen video_test_screen:
default over = 0
add "video_idle"
add "video_hover" at video_alpha(over)
button:
align (0.5, 0.5) background "#333" hover_background "#192"
text "test"
hovered SetScreenVariable("over", 1)
unhovered SetScreenVariable("over", 0)
action NullAction()
But looks like when two videos are played over each other, the top video stays visible despite it's alpha transform.
I wonder if anybody ever tried doing this and got something working?
Last edited by Kia on Thu Mar 28, 2024 2:06 am, edited 1 time in total.
and using them as background/hover_background works with a single caveat: hover video is only started when button is hovered for the first time. Then it is played uninterrupted as intended. It won't work if you want to synchronize both videos, but if the only goal is to not restart animations each time, then it works. I alsotried using idle_child / hover_child in hope that it will keep animation timebase, but it seems that the problem lies in the fact that movies are not started until shown.
Thank you Ocelot, it works like a charm.
We have `side_mask` that ensures the video and its mask stay in sync, I imagine if we could do another split, we can fit two videos and two masks in the same video file, to use in buttons and such. But there aren't that many developers that are looking for a functionality like that.
I personally would have just created a frame displaying the video, then placed an invisible button over top of that. With a little tweaking, this is also an option.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.
Imperf3kt wrote: ↑Thu Mar 28, 2024 2:26 am
I personally would have just created a frame displaying the video, then placed an invisible button over top of that. With a little tweaking, this is also an option.
My test was kind of the same, but for some reason, two videos placed over each other causes some odd behaviors, when it comes to applying a transform to one of them.