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 have an imagebutton for which I'd like to add a hover animation. The imagebutton itself is animated, however, so simply using a tinted version of it as a file to use as a "hover" parameter is impossible, or at least very undesirable. I'd like to tint the image somehow. However, im.MatrixColor doesn't seem to accept displayables as parameters. The code I'm currently using is as follows:
image the_animated_image_in_question:
"the_animeted_image_in_question_01.png"
0.04
"the_animeted_image_in_question_02.png"
0.04
"the_animeted_image_in_question_03.png"
#etc. It doesn't loop. I don't particularly care that the animation will start over as I hover the button either
screen the_screen_where_I_want_the_button():
imagebutton:
xalign 0.5 yalign 0.5
idle "the_animated_image_in_question"
hover #I have no idea???
action Jump("what_its_supposed_to_do")
style help_me:
hover_color "b22222" #that a nice color ain't it
But that dosn't seem to help, so I can't really figure out what to do. What am I missing? Or is it impossible to manipulate an animated image/displayable?
papillon wrote: ↑Sun Dec 15, 2019 12:43 pm
Could you define new images as tinted versions of the original frames and then build a hover animation out of those?
I don't think the style definition will help you at all. That sort of color setting usually only affects things drawn directly by the game, like text.
Yes, although I'm slightly worried about the performance burden of applying MatrixColor to each frame (we're talking 30 frames at 24fps, but I have 5 of these buttons and 3 of them appear at the same time) although, come to think of it, there might be no difference between that and somehow applying it to the animated image as a whole, performance-wise. At this point I might as well edit the frames themselves.
Thanks! I'll just try that and see if the game freezes or something like that.
So! A quick update - three animated buttons with a shitload of frames each turned out not to be a good idea after all. In any case, there doesn't seem to be a way to assign a color to animated images through Ren'Py itself. This thread though shows the best way I found to have animated buttons in general so I might as well try it.
I'll leave this as unsolved just in case someone has another idea, but for anyone who's trying to do the same as me: you're probably better off not doing it.