Animate screen with imagebutton

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
Sehaf
Regular
Posts: 58
Joined: Thu Feb 25, 2010 9:22 pm
Projects: Demon Lord & Yuki Academy
Deviantart: Sehad
Location: Sweden
Contact:

Animate screen with imagebutton

#1 Post by Sehaf »

Hi, I'm trying to animate the removal of a screen with images when using an image button. Code goes like this:

Code: Select all

screen potion_brake:
    
    imagebutton :
        idle "effects/blank.png"
        hover "effects/blank.png"
        action [ Hide("potion_brake"), SetVariable("potions_staple", 0), ToggleVariable("staple_check") ]
    
    if potions_staple >= 1:
        add "fx bottle1" at potion_wiggle xpos 460 ypos 2
    if potions_staple >= 2:
        add "fx bottle2" at potion_wiggle xpos 380 ypos 140
    if potions_staple >= 3:
        add "fx bottle3" at potion_wiggle xpos 540 ypos 140

The image button is a large transparent png that works fine removing the screen and everything works grate. But I wish that when screen was hidden, that it was so with an animation that moved the screen (and most importantly) the "fx bottle" ellements I have added to the screen in a downward motion of sort.

I made this one:

Code: Select all

    transform potion_fall:
        on hide:
            linear 0.5 ypos 800
But no mather where I put it I only get errors stating that this does not work one way or another.
Are there anyone who know how to do this? Did not find any previous post that came close enough to what I'm doing in a way that it would solve my problem.
I'm a GameMaker!
My Portfolio: http://www.bluepipestudio.com

User avatar
vollschauer
Veteran
Posts: 231
Joined: Sun Oct 11, 2015 9:38 am
Github: vollschauer
Contact:

Re: Animate screen with imagebutton

#2 Post by vollschauer »

How about using a transition?

Code: Select all

Hide("potion_brake", transition=moveoutbottom)
or use the wipe or slide transitions ....

https://www.renpy.org/doc/html/transitions.html

User avatar
Sehaf
Regular
Posts: 58
Joined: Thu Feb 25, 2010 9:22 pm
Projects: Demon Lord & Yuki Academy
Deviantart: Sehad
Location: Sweden
Contact:

Re: Animate screen with imagebutton

#3 Post by Sehaf »

I tried just that with the transition I had made myself noted in OP, but realize now that your purposed solution that it was a transform, so most likely therefor it did not work.

However, Now I tried with what you suggested and while it does not crash, there is no animation still.
It only disappear the same way as if I had not applied a transition at all. Blinking away that is.

What could I do so that it is removed properly?
I'm a GameMaker!
My Portfolio: http://www.bluepipestudio.com

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]