Hover animation problems [SOLVED]

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
yumepeh
Newbie
Posts: 4
Joined: Tue Jan 02, 2018 12:05 pm
Tumblr: yumepeh
Contact:

Hover animation problems [SOLVED]

#1 Post by yumepeh »

Hello there, I'm trying to make a visual novel using Ren'py and I've been stuck for hours, trying to figure out house to make a header to show up when hovered. After some time, this is what I got, and kinda worked:

Code: Select all

image header one:
    "header.png"
    size(1270, 169)
    
image header two:
    "headerbutton.png"
    size(213, 108)

default header_toggle = False

screen pull_header:
    if header_toggle:
        add "header one"
    else:
        add "header two"
        
    imagebutton:
        idle "headerbutton_idle.png" 
        xalign 0.5
        yalign 0
        hovered [SetVariable("header_toggle", True), With(slidedown)]
        unhovered [SetVariable("header_toggle", False), With(slidedown)]
        focus_mask None
        action NullAction()
but the major problem is: when I hover to the headerbutton, not only the header slides down, but also the whole screen! (like, with the character, text screen, background, and all of them).

secondly, there's two headerbuttons instead of one; one at the upper left of the game, and one at the middle; when i only wanted one headerbutton at the middle :(

what happened and how can I fix it? thanks in advance!! :')
Last edited by yumepeh on Sun Jan 07, 2018 5:34 am, edited 1 time in total.

User avatar
Empish
Veteran
Posts: 221
Joined: Thu Jan 14, 2016 9:52 pm
Projects: Efemural Hearts, It Ends With Graduation
itch: empish
Contact:

Re: Hover animation problems

#2 Post by Empish »

Looks like you followed my hovering tutorial. I tested it out with slidedown for an individual component and you're right, it does the transition on the whole screen. I tried it with a transform and that got it to slide down once, but not again after that. I'll look into this. Sorry for not realizing it before I made the tutorial.

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Hover animation problems

#3 Post by IrinaLazareva »

Code: Select all

image header one:
    "header.png"
    size(1270, 169)
    
image header two:
    "headerbutton.png"
    size(213, 108)

transform ff:
    yalign - 1.0
    linear 1 yalign 0.0
screen puone():
    tag pull
    add "header one" at ff
screen putwo():
    tag pull
    add "header two" at ff
    
screen pull_header():
    imagebutton:
        idle "headerbutton_idle.png" 
        xalign 0.5
        yalign 0
        hovered Show('puone')
        unhovered Show('putwo')
        focus_mask None
        action NullAction()
    on 'show' action Show('putwo') #set default (optional)
doc:
https://www.renpy.org/doc/html/atl.html ... n-language
https://www.renpy.org/doc/html/screens. ... -statement
https://www.renpy.org/doc/html/screen_actions.html#Show

yumepeh
Newbie
Posts: 4
Joined: Tue Jan 02, 2018 12:05 pm
Tumblr: yumepeh
Contact:

Re: Hover animation problems

#4 Post by yumepeh »

by Empish » Wed Jan 03, 2018 1:23 am

Looks like you followed my hovering tutorial. I tested it out with slidedown for an individual component and you're right, it does the transition on the whole screen. I tried it with a transform and that got it to slide down once, but not again after that. I'll look into this. Sorry for not realizing it before I made the tutorial.
aaa yes i did follow your tutorial!! no need to say sorry, it's my fault anyway because i tried doing things that are out of my own capability.. haha :?
your videos are my the source of my knowledge <3
i look forward to more of your videos!!
by IrinaLazareva » Wed Jan 03, 2018 2:49 am

image header one:
"header.png"
size(1270, 169)

image header two:
"headerbutton.png"
size(213, 108)

transform ff:
yalign - 1.0
linear 1 yalign 0.0
screen puone():
tag pull
add "header one" at ff
screen putwo():
tag pull
add "header two" at ff

screen pull_header():
imagebutton:
idle "headerbutton_idle.png"
xalign 0.5
yalign 0
hovered Show('puone')
unhovered Show('putwo')
focus_mask None
action NullAction()
on 'show' action Show('putwo') #set default (optional)
doc:
https://www.renpy.org/doc/html/atl.html ... n-language
https://www.renpy.org/doc/html/screens. ... -statement
https://www.renpy.org/doc/html/screen_actions.html#Show
wow this is exactly what i needed!! it works perfectly now
no words can express how thankful i am for your help :'D aaaaa thank you so much!

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: Hover animation problems

#5 Post by IrinaLazareva »

yumepeh wrote: Sun Jan 07, 2018 5:12 am wow this is exactly what i needed!! it works perfectly now
no words can express how thankful i am for your help :'D aaaaa thank you so much!
You are welcome :)

Post Reply

Who is online

Users browsing this forum: Bing [Bot]