[SOLVED][Question] How to create a simple background transition loop with 2 images?

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
GammaBreak
Regular
Posts: 62
Joined: Thu Aug 06, 2020 10:04 pm
Contact:

[SOLVED][Question] How to create a simple background transition loop with 2 images?

#1 Post by GammaBreak » Thu Aug 06, 2020 10:39 pm

For my current visual novel project, my goal is to have a scene that involves a repetitive action. I essentially need 2 frames of animation, sort of a before/after state, and I am aiming for this to be its own separate scene/background, not character sprites.

I'm having a little trouble understanding how to transition back and forth between a scene as shown in the renpy tutorial. The code from the tutorial would work:

Code: Select all

image bg atl transitions:
    "bg washington"
    "bg whitehouse" with dissolve
    pause 1.0
    "bg washington" with dissolve
    pause 1.0
    repeat
Except I clearly don't understand how this functions, because every time I've tried to implement it, my game just skips this entire block. The parts I do understand are the pause lines and the repeat.

I declare two separate backgrounds in my script:

Code: Select all

image frame1= "images/bg frame1.png"
image frame2= "images/bg frame2.png"
Swapping out frame1/2 with "bg washington"/"bg whitehouse" doesn't work. I assume since these were strings that they are directly referencing image names, so I tried putting in my image names (bg frame1.png) into the quotes, and still nothing. Can someone assist me in understanding this?
Last edited by GammaBreak on Fri Aug 07, 2020 8:28 pm, edited 1 time in total.

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: [Question] How to create a simple background transition loop with 2 images?

#2 Post by hell_oh_world » Thu Aug 06, 2020 11:51 pm

if you've defined the images using the `image` statement then you can use them by putting the image names inside a set of quotes...

Code: Select all

image frame1 = "images/bg frame1.png"
image frame2 = "images/bg frame2.png"

image bg atl transitions:
    "frame1" with dissolve
    pause 1.0
    "frame2" with dissolve
    pause 1.0
    repeat

label start:
    scene bg atl transitions # should work iir
    pause
    return

screen something():
    add "bg atl transitions" # adding the images onto a screen, not related to the issue but shows that you need the image names inside quotes if they're defined using the `image` statement...

GammaBreak
Regular
Posts: 62
Joined: Thu Aug 06, 2020 10:04 pm
Contact:

Re: [Question] How to create a simple background transition loop with 2 images?

#3 Post by GammaBreak » Fri Aug 07, 2020 12:01 am

Okay, I was being a colossal idiot and not realizing that the

Code: Select all

image bg atl transitions:
    "frame1" with dissolve
    pause 1.0
    "frame2" with dissolve
    pause 1.0
    repeat
was a definition not to be placed within the label. Now it's starting to click, thank you very much.

Follow up question: once I've got this animation going, is it possible to have the text/dialogue auto-advance after pauses? It's a very basic animation and I can closely match the timing, and I was hoping to just sync some dialogue to the pauses. Basically something like

show animation
"dialogue" pause 1.0
"dialogue" pause 1.0
...

User avatar
hell_oh_world
Miko-Class Veteran
Posts: 777
Joined: Fri Jul 12, 2019 5:21 am
Projects: The Button Man
Organization: NILA
Github: hell-oh-world
Location: Philippines
Contact:

Re: [Question] How to create a simple background transition loop with 2 images?

#4 Post by hell_oh_world » Fri Aug 07, 2020 1:30 am

maybe you can do something like this through the use of text tags `w` and `nw`...
https://www.renpy.org/doc/html/text.html#text-tag-nw
https://www.renpy.org/doc/html/text.html#text-tag-w

Code: Select all

label start:
  show animation
  "dialogue1{w=1.0}{nw}" # w=1.0 simply acts like a pause that waits until it reaches one second before reaching the nw tag which forces the dialogue to dismiss itself without clicking...
  "dialogue2{w=1.0}{nw}"

GammaBreak
Regular
Posts: 62
Joined: Thu Aug 06, 2020 10:04 pm
Contact:

Re: [Question] How to create a simple background transition loop with 2 images?

#5 Post by GammaBreak » Fri Aug 07, 2020 3:40 am

Sounds interesting, will dig further. Thanks for the help!

Post Reply

Who is online

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