[Solved]Can I use 'hide' with transforms and 'at'?

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
Nazon
Regular
Posts: 32
Joined: Thu Sep 22, 2016 10:03 am
Contact:

[Solved]Can I use 'hide' with transforms and 'at'?

#1 Post by Nazon » Fri Mar 23, 2018 7:25 pm

If I want to show character sprite with "fading in from nowhere" effect I use transform:

Code: Select all

transform fadein_from_right:
    ease 0.0 xoffset 10 alpha 0.0
    ease 0.5 xoffset 0 alpha 1.0

Code: Select all

show eileen at fadein_from_right
But how I can make a charater sprite to move slightly to the right and hide?

The command

Code: Select all

transform fadeout_to_right:
    ease 0.5 xoffset 10 alpha 0.0

hide eileen at fadeout_to_right
doesn't work, the sprite just dissappears without effect.

Is it possible to use transforms with 'hide' ?
Last edited by Nazon on Sun Mar 25, 2018 3:05 pm, edited 1 time in total.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 752
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Can I use 'hide' with transforms and 'at'?

#2 Post by Milkymalk » Fri Mar 23, 2018 10:14 pm

You can use the "on" statement to tell Ren'Py to apply a certain ATL block when something is shown or hidden:
https://www.renpy.org/doc/html/atl.html#on-statement
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

Nazon
Regular
Posts: 32
Joined: Thu Sep 22, 2016 10:03 am
Contact:

Re: Can I use 'hide' with transforms and 'at'?

#3 Post by Nazon » Sat Mar 24, 2018 1:19 pm

Milkymalk wrote:
Fri Mar 23, 2018 10:14 pm
You can use the "on" statement to tell Ren'Py to apply a certain ATL block when something is shown or hidden:
https://www.renpy.org/doc/html/atl.html#on-statement
Thank you.
Yes, but in that case, I need to specify this 'on hide' command in a 'show' statement.
Something like this:

Code: Select all

transform fadeout_to_right:
    ease 0.5 xoffset 10 alpha 0.0

Code: Select all

show eileen:
        on hide:
            fadeout_to_right

"Good bye!"

hide eileen
But what if I can't use 'on hide' with the 'show' command and have to mention my transform effect only with a 'hide' command? (Special circumstances.)

I also tried

Code: Select all

hide eileen:
      on hide:
            fadeout_to_right
but it doesn't work this way.

User avatar
Milkymalk
Miko-Class Veteran
Posts: 752
Joined: Wed Nov 23, 2011 5:30 pm
Completed: Don't Look (AGS game)
Projects: KANPEKI! ★Perfect Play★
Organization: Crappy White Wings
Location: Germany
Contact:

Re: Can I use 'hide' with transforms and 'at'?

#4 Post by Milkymalk » Sat Mar 24, 2018 8:00 pm

Why is it that you can't use 'on' with the 'show' statement?

You can also include 'on hide' inside a transform:

Code: Select all

transform fade_and_slide:  
    on show:
	 ease 0.0 xoffset 10 alpha 0.0
	 ease 0.5 xoffset 0 alpha 1.0
    on hide:
        ease 0.5 xoffset 10 alpha 0.0
        
label start:
    show eileen at fade_and_slide
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Ocelot
Eileen-Class Veteran
Posts: 1883
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Can I use 'hide' with transforms and 'at'?

#5 Post by Ocelot » Sun Mar 25, 2018 12:37 am

I believe, the idea is to use different animations in different cases:

Code: Select all

show eileen
e "Let's split up and search this haunted house alone!"
e "Where should I go?"
menu:
    "To the left":
        hide eileen # should exit left
    "To the right":
        hide eileen # should exit right
I would consider using transitions here: https://www.renpy.org/doc/html/transitions.html
In particular Dissolve, Move and ComposeTransition. Maybe you would have to define your own. Sadly documentatio on defining your own transition is nonexistent, so you will have to figure it out yourself.
< < insert Rick Cook quote here > >

Nazon
Regular
Posts: 32
Joined: Thu Sep 22, 2016 10:03 am
Contact:

Re: Can I use 'hide' with transforms and 'at'?

#6 Post by Nazon » Sun Mar 25, 2018 11:40 am

Milkymalk wrote:
Sat Mar 24, 2018 8:00 pm
Why is it that you can't use 'on' with the 'show' statement?

You can also include 'on hide' inside a transform:

Code: Select all

transform fade_and_slide:  
    on show:
	 ease 0.0 xoffset 10 alpha 0.0
	 ease 0.5 xoffset 0 alpha 1.0
    on hide:
        ease 0.5 xoffset 10 alpha 0.0
        
label start:
    show eileen at fade_and_slide
Well, it's a long story...
Yes, I can include 'on hide' in the first transform block, but unfortunatelly there should be two separate blocks. One for 'show' transform and another for 'hide'.


Ocelot wrote:
Sun Mar 25, 2018 12:37 am
I believe, the idea is to use different animations in different cases:
Not exactly, but something like this.
Ocelot wrote:
Sun Mar 25, 2018 12:37 am
I would consider using transitions here: https://www.renpy.org/doc/html/transitions.html
Sure, I also tried to perform 'with mycomposetransition' , but I couldn't create a transition that would do the same effects as the transform block.

So, as a workaround I am using another 'show' statement:

Code: Select all

transform fadein_from_right:
    ease 0.0 xoffset 10 alpha 0.0
    ease 0.5 xoffset 0 alpha 1.0

Code: Select all

transform fadeout_to_right:
    on hide:    
        ease 0.5 xoffset 10 alpha 0.0

Code: Select all

show eileen at fadein_from_right
"Hello."
"And good bye."
show eileen at fadeout_to_right #As far as I understand, this would not show the same image two times, but will change transition to 'fadeout_to_right'
hide eileen #Now the image would be hidden with 'fadeout_to_right' effect

Post Reply

Who is online

Users browsing this forum: Google [Bot]