[SOLVED] How can I force an animated background and sprite to show at the same time.

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
Thailandian
Regular
Posts: 30
Joined: Tue Jun 01, 2021 6:24 am
Contact:

[SOLVED] How can I force an animated background and sprite to show at the same time.

#1 Post by Thailandian »

I have an animated background of a landscape, and several sprites (also animated) of 2 characters sitting in the cab of a truck.

Here is some of the code for the images:

Code: Select all

image ch01_truck_bg_trog = Movie(play="videos/ch01_truck_bg_trog_01.webm", loop=True, start_image="videos/ch01_truck_bg_trog_01.jpg", image="videos/ch01_truck_bg_trog_01.jpg") #background image
image bg ch01_truck_trog_01 = Movie(play="videos/bg ch01_truck_trog_01.webm", loop=False, side_mask=True, start_image="videos/bg ch01_truck_trog_01.png", image="videos/bg ch01_truck_trog_02.png") #1st sprite
image bg ch01_truck_trog_02 = Movie(play="videos/bg ch01_truck_trog_02.webm", loop=False, side_mask=True, start_image="videos/bg ch01_truck_trog_02.png", image="videos/bg ch01_truck_trog_03.png") #2nd sprite
# etc.
I reaslise that the bg tag is a bit confusing, but the first image is constant, whereas the other images replace each other, so that much works.
My problem is that the landscape background movie plays for about 1/2 second before the first character sprite shows, even though I call them together:

Code: Select all

scene ch01_truck_bg_trog with dissolve
show bg ch01_truck_trog_01
tr smiling "G’day there. Name’s Corey Meyer but everyone calls me Trog."
show bg ch01_truck_trog_02
I guess this may be, in part, due to slow hardware, but I would prefer that both the background and foreground were ready to roll before dissolving from the previous scene.
It may be worth mentioning that once sprite shows, further sprites replace each other without delay - there is no returning to only the background while the next sprite loads.

So my question is: is there some way to force the background and first sprite to appear simultaneously?

As always, any ideas at all would be most welcome.
Last edited by Thailandian on Wed May 18, 2022 9:10 am, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: How can I force an animated background and sprite to show at the same time.

#2 Post by Alex »

Thailandian wrote: Mon May 16, 2022 9:16 am ...My problem is that the landscape background movie plays for about 1/2 second before the first character sprite shows, even though I call them together:

Code: Select all

scene ch01_truck_bg_trog with dissolve
show bg ch01_truck_trog_01
tr smiling "G’day there. Name’s Corey Meyer but everyone calls me Trog."
show bg ch01_truck_trog_02
I guess this may be, in part, due to slow hardware, but I would prefer that both the background and foreground were ready to roll before dissolving from the previous scene.
It may be worth mentioning that once sprite shows, further sprites replace each other without delay - there is no returning to only the background while the next sprite loads.

So my question is: is there some way to force the background and first sprite to appear simultaneously?

As always, any ideas at all would be most welcome.
Yes, 'dissolve' transition takes 0.5 seconds by default. Try it like

Code: Select all

scene ch01_truck_bg_trog
show bg ch01_truck_trog_01
with dissolve # <---
tr smiling "G’day there. Name’s Corey Meyer but everyone calls me Trog."
show bg ch01_truck_trog_02
https://www.renpy.org/doc/html/transiti ... r-dissolve
https://www.renpy.org/doc/html/displayi ... -statement

Thailandian
Regular
Posts: 30
Joined: Tue Jun 01, 2021 6:24 am
Contact:

Re: How can I force an animated background and sprite to show at the same time.

#3 Post by Thailandian »

Thanks Alex - that is exactly what I needed.

Post Reply

Who is online

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