[Solved] Weird interaction between screens

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
thelastsecret
Regular
Posts: 124
Joined: Tue Mar 01, 2022 1:32 pm
Completed: The Last Secret
Projects: Sweet Science – The Girls from Silversee Castle
itch: thelastsecret
Discord: TheLastSecret #5266
Contact:

[Solved] Weird interaction between screens

#1 Post by thelastsecret »

Here's a strange phenomenon:

In a cut scene, I have the following problem:
I use three screens:
- One is for displaying subtitles.
- One is for calling the subtitle screen with a timer and the number of the line to be shown.
- One is for the foreground of the graphics. The foreground has some animation running (using transforms).
Everything works as it should, but the ATL animation of the foreground resets every time the timer calls the subtitles.
The effect does not happen when I put the subtitles behind the animation, but the subtitles should obviously not be covered up by the animation, so this is not a workaround...

I am puzzled as why this actually causes a reset and why only if the screen is behind the one with the timer. is this a bug or is there a reason behind it? If somebody would have an idea on that, then this might be a first step in solving the problem...

Thank you in advance for your help!



Here's a simplified code sniplet:

Code: Select all

show screen subtitle_caller
show screen animation
pause 20

screen animation:
    add "foreground.png" at transform:
        zoom 5
        ease 20 zoom 1

screen subtitle_caller:
    timer 2 action [Hide("subline"),SetVariable("sublinenumber",0),Show("subline")]
    timer 5 action [Hide("subline"),SetVariable("sublinenumber",1),Show("subline")]

screen subline:
    text subtitle_for_cutscene[sublinenumber]
Last edited by thelastsecret on Sat Dec 16, 2023 7:30 am, edited 1 time in total.

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1030
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Weird interaction between screens

#2 Post by m_from_space »

Every transform that you not specifically mark as "animation" will be reset when shown again. So the solution is this:

Code: Select all

transform my_trans:
    animation
    zoom 5
    ease 20 zoom 1

# you better not use the word "animation" as a screen name, since it's a reserved Renpy keyword (you never know!)
screen my_animation():
    add "foreground" at my_trans

...
Here is the explanation by the way: https://www.renpy.org/doc/html/atl.html ... -statement

User avatar
thelastsecret
Regular
Posts: 124
Joined: Tue Mar 01, 2022 1:32 pm
Completed: The Last Secret
Projects: Sweet Science – The Girls from Silversee Castle
itch: thelastsecret
Discord: TheLastSecret #5266
Contact:

Re: Weird interaction between screens

#3 Post by thelastsecret »

Thank you so much! It works like magic!
I've spent a whole day trying to find a solution and then it is one word: animation.
That was a life saver. You (and everyone here on this super helpful forum) deserve a mention in the credits for the game! :)
m_from_space wrote: Sat Dec 16, 2023 7:23 am Every transform that you not specifically mark as "animation" will be reset when shown again. So the solution is this:

Code: Select all

transform my_trans:
    animation
    zoom 5
    ease 20 zoom 1

# you better not use the word "animation" as a screen name, since it's a reserved Renpy keyword (you never know!)
screen my_animation():
    add "foreground" at my_trans

...
Here is the explanation by the way: https://www.renpy.org/doc/html/atl.html ... -statement

Post Reply

Who is online

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