[SOLVED] Image-Button Hover-Animation is stuck (Renpy 7.4.8.1895)

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
plastiekk
Regular
Posts: 112
Joined: Wed Sep 29, 2021 4:08 am
Contact:

[SOLVED] Image-Button Hover-Animation is stuck (Renpy 7.4.8.1895)

#1 Post by plastiekk »

Hello, I am currently working on several projects at the same time. Since my internet volume is limited I recently updated Renpy to 7.4.8.
Since then the hover effects on the image buttons don't work properly.
In the example below an image is zoomed out and back in. This also works the first time you point to it. But after a few more tries the "animation" of zooming is stuck. It takes about 3 seconds until it zooms in and out again. (Before the update it was correct).
Can anyone help me with this, is the script wrong?

Code: Select all

# images
image home_button:
    "images/hud/home.png"
image home_button_hover:
    "images/hud/home.png"
    linear .5 zoom 1.1
    linear .5 zoom 1.0
    repeat


screen city_map_navi():
               
    # Home Button
    hbox xalign 0.045 yalign 0.71 spacing 30:
          imagebutton:
            idle "home_button"
            hover "home_button_hover"
            hover_sound "/audio/hover.wav"
            hovered Show("tooltip_home_button") 
            unhovered Hide("tooltip_home_button")
            
            action Play("sound","/audio/_click.wav"), Function(renpy.jump, label="home_button_check")
              
    # Bar Button
    ...
Last edited by plastiekk on Mon Oct 11, 2021 6:59 am, edited 1 time in total.
Why on earth did I put the bread in the fridge?

User avatar
plastiekk
Regular
Posts: 112
Joined: Wed Sep 29, 2021 4:08 am
Contact:

Re: Image-Button Hover-Animation is stuck (Renpy 7.4.8.1895)

#2 Post by plastiekk »

Hi, after some searching I finally found the bug tracker on github. There this behavior was reported as a bug. Here is my working solution. Instead of 2 buttons just define a transform. Unfortunately I can't say if it works with complex transformations.

Code: Select all

# images
image home_button:
    "images/hud/home.png"

# transform
transform hover_button:
    on hover:
        linear .25 zoom 1.1
        linear .25 zoom 1.0
        repeat
    
    on idle:    
        linear .25 zoom 1.0    
    

# screen (which is called from a label in my case)
screen city_map_navi():
               
    # Home Button
    hbox xalign 0.045 yalign 0.71:
          imagebutton at hover_button:   # <- use transform "hover_button"
            idle "home_button"          # <- same image
            hover "home_button"         # <- same image
            hover_sound "/audio/hover.wav"
            hovered Show("tooltip_home_button") 
            unhovered Hide("tooltip_home_button")
            
            action Play("sound","/audio/_click.wav"), Function(renpy.jump, label="home_button_check")
              
    # Bar Button
    ...
Maybe this will be helpful for others who have the same problem.

Edit: Code typo corrected.
Why on earth did I put the bread in the fridge?

Post Reply

Who is online

Users browsing this forum: No registered users