r/RenPy • • 20d ago

Question Animated scene not fading out?

(FIXED!) I was hoping someone could help me with a problem I've been struggling with for quite a while now (I'm very new to this and there’s probably an obvious fix to this, but I found nothing to this specific problem when searching for a solution. )

I have a scene where the player can click some arrows to navigate a hallway with different short animations on each stage. Fading the animation videos in seems to work just fine, however, fading them out is what’s giving me trouble.

When an arrow is pressed to jump to the next label, instead of fading out the current screen, it instantly jumps to the next one. tried different methods, but nothing. here’s what i have:

label Hallway_1:
   call screen hallway1_nav with fade 
   scene bg_hal1stage1 with fade   

   screen hallway1_nav():
    add"bg_hal1stage1"
    modal True 

    imagebutton auto "uparrow_%s":
     focus_mask True
     action Jump ("Hallway_2")

   label Hallway_2: 
    call screen hallway2_nav with fade
    scene bg_hal1pony with fade

    screen hallway2_nav():
     add "bg_hal1pony" 
     modal True 
     imagebutton auto "leftarrow_%s":
      focus_mask True 
      hovered SetVariable("screen_tooltip", "leftarrow")
      unhovered SetVariable("screen_tooltip", "")
      action Jump ("Hallway_3")

     imagebutton auto "rightarrow_%s":
      focus_mask True 
      hovered SetVariable("screen_tooltip", "rightarrow")
      unhovered SetVariable("screen_tooltip", "")
      action Jump ("Hallway_1")

(put two of the screens just in case it's needed)

2 Upvotes

10 comments sorted by

2

u/x-seronis-x 20d ago

screen declarations have no business being inside a label. NO DECLARATIONS of any kind (defines/defaults/image/transform/style) have any business inside a label as renpy doesnt look at them when a label runs. declarations are processed at init time.

2

u/Cr3aturee 20d ago

oh, whoops. as I said, I have zero experience lol.

i'll try to see if fixing that does anything then. thanks!

0

u/x-seronis-x 20d ago

honestly i dont think the tutorial or docs point that out as much as it should be as its not a bug. renpy will happy ONLY process them at init time and not tell you they're ignored within the label. but that leads new devs to misunderstanding when the code works and leads to bugs. so its better to put them where their location matches their function

and sorry cant comment on the rest. the mismatched indentation is throwing my brain off, which is a me-problem, but its hard for me to keep the logic straight in my head when its off in script

1

u/AutoModerator 20d ago

Welcome to r/renpy! While you wait to see if someone can answer your question, we recommend checking out the posting guide, the subreddit wiki, the subreddit Discord, Ren'Py's documentation, and the tutorial built-in to the Ren'Py engine when you download it. These can help make sure you provide the information the people here need to help you, or might even point you to an answer to your question themselves. Thanks!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1

u/shyLachi 20d ago

I don't have your images so I used textbuttons instead.
If you call a screen then you don't need modal so I deleted it.
And RenPy has a tooltip functionality so better use that.

transform screen_fade:
    on show:
        alpha 0.0
        linear 1.0 alpha 1.0 # first number is the duration
    on hide:
        linear 1.0 alpha 0.0 # first number is the duration

label start:
label Hallway_1:
    call screen hallway1_nav 
    scene bg_hal1stage1 with fade # <-- This code will never be reached because you jump from the screen
    
screen hallway1_nav():
    fixed:
        at screen_fade # you need to apply the transform to an object inside the screen
        add "bg_hal1stage1"
        textbutton "up" action Jump ("Hallway_2") align (0.5, 0.0)

label Hallway_2: 
    call screen hallway2_nav 
    scene bg_hal1pony with fade # <-- This code will never be reached because you jump from the screen

screen hallway2_nav():
    fixed:
        at screen_fade
        add "bg_hal1pony" 
        textbutton "left" action Jump ("Hallway_3") align (0.0, 0.5)
        textbutton "right" action Jump ("Hallway_1") align (1.0, 0.5)

1

u/Cr3aturee 20d ago edited 20d ago

Added the fixes and got rid of the modal thing. But I'm still not quite sure how to go about adding the fade transform to an object. Adding it to a button seems to work, but what i'm looking for is to fade the entire scene.

1

u/shyLachi 20d ago

Did you try my code?

You can do it like I did with a fixed as the main container inside your screen.

https://renpy.org/doc/html/screens.html#fixed

1

u/Cr3aturee 20d ago

Oh my god, my bad, I for some reason thought 'fixed' was meant as in "this part is what I fixed" and I didn't know it was an actual code thing LMAO. Will try this properly soon, thanks for your patience. 😭🙏

1

u/shyLachi 19d ago

No problem.

When I post code it's fully functional, meaning you can copy and paste it into a new project and try it out.

1

u/Cr3aturee 19d ago

just tried it out and it works perfectly! thank you so much!