[Workaround] Prevent 'show' from stopping previous animation

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
IsharaComix
Newbie
Posts: 19
Joined: Tue Jan 06, 2009 11:17 pm
Projects: @CameliaGirls
Location: NC, USA
Contact:

[Workaround] Prevent 'show' from stopping previous animation

#1 Post by IsharaComix »

Let's say I've got a character who's slowly fading in for the duration of a scene.

Code: Select all

show IsharaComix:
    alpha 0.0
    linear 100.0 alpha 1.0
As the player goes through the dialogue, the character starts fading in. However, if I start another show, the previous animation block stops, and the alpha remains wherever it was when it was interrupted.

Code: Select all

show IsharaComix:
    zoom 2.0
    "ishara/happyshara.png"
Is it possible to keep the old animation going simultaneously with the new one?
Last edited by IsharaComix on Tue Jul 22, 2014 7:31 pm, edited 1 time in total.

User avatar
Jellyfishe
Newbie
Posts: 8
Joined: Mon Jul 07, 2014 8:52 pm
Contact:

Re: Prevent 'show' from stopping previous animation block

#2 Post by Jellyfishe »

Try adding:

Code: Select all

 linear 100.0 alpha 1.0 
after you call:

Code: Select all

 "ishara/happyshara.png"

User avatar
Milkymalk
Miko-Class Veteran
Posts: 753
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: Prevent 'show' from stopping previous animation block

#3 Post by Milkymalk »

That would make it take another 100 seconds to finish. But you could start a timer when the first transformation starts and call the second linear statement with the remaining time.
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)

User avatar
Jellyfishe
Newbie
Posts: 8
Joined: Mon Jul 07, 2014 8:52 pm
Contact:

Re: Prevent 'show' from stopping previous animation block

#4 Post by Jellyfishe »

Try it out on renpy yourself. I wouldn't be suggesting this if it doesn't work. Pick a smaller number and recreate the situation in a script file.

IsharaComix
Newbie
Posts: 19
Joined: Tue Jan 06, 2009 11:17 pm
Projects: @CameliaGirls
Location: NC, USA
Contact:

Re: Prevent 'show' from stopping previous animation block

#5 Post by IsharaComix »

Milkymalk wrote:That would make it take another 100 seconds to finish. But you could start a timer when the first transformation starts and call the second linear statement with the remaining time.
Yeah, that's the problem, but Jellyfishe gave me an idea.

Code: Select all

init python:
    def slowly_fade_in(trans, st, at):
        trans.alpha = (1.0*.01*at)
        return 0
        if at > 100.0:
            return None
I create a function that calculates the desired alpha as a function of time. After the sprite has been on the screen for 100 seconds, alpha is guaranteed to be 1.0.

Every time I do a show, I do this:

Code: Select all

show isharacomix:
    parallel:
        "ishara/happyshara.png"
        zoom 2.0
    parallel:
        function slowly_fade_in
There doesn't seem to be much of a performance hit - I thought doing something like this might screw up prediction. But it runs fast enough and gets the job done.

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot]