Tint animated imagebuttons on hover

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
User avatar
Palas
Newbie
Posts: 15
Joined: Thu Feb 14, 2013 3:19 pm
Soundcloud: palasvuash
itch: pequigames
Location: Brazil
Contact:

Tint animated imagebuttons on hover

#1 Post by Palas »

Hello!

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:

Code: Select all

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")
I suppose a style definition would help? Such as:

Code: Select all

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?

Thanks in advance!

EDIT: See this post.
Last edited by Palas on Fri Dec 20, 2019 2:28 pm, edited 1 time in total.

User avatar
papillon
Arbiter of the Internets
Posts: 4107
Joined: Tue Aug 26, 2003 4:37 am
Completed: lots; see website!
Projects: something mysterious involving yuri, usually
Organization: Hanako Games
Tumblr: hanakogames
Contact:

Re: Tint animated imagebuttons on hover

#2 Post by papillon »

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.

User avatar
Palas
Newbie
Posts: 15
Joined: Thu Feb 14, 2013 3:19 pm
Soundcloud: palasvuash
itch: pequigames
Location: Brazil
Contact:

Re: Tint animated imagebuttons on hover

#3 Post by Palas »

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.

(Also, fucking love Black Closet ♥)

User avatar
Palas
Newbie
Posts: 15
Joined: Thu Feb 14, 2013 3:19 pm
Soundcloud: palasvuash
itch: pequigames
Location: Brazil
Contact:

Re: Tint animated imagebuttons on hover

#4 Post by Palas »

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.

Post Reply

Who is online

Users browsing this forum: No registered users