Proper way to add a background movie behind sprites?

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
AHAKuo
Regular
Posts: 41
Joined: Tue Feb 06, 2018 11:10 am
Projects: SoUnd Is ToxIc
Organization: AHAKuo
Tumblr: ahakuo
Deviantart: ahakuo
Contact:

Proper way to add a background movie behind sprites?

#1 Post by AHAKuo »

I have already tried to do this by adding this command:

image movie = Movie(size=(1920, 1080), xpos=0, ypos=0, xanchor=0, yanchor=0)

play movie "/videos/corruptedscene.avi" loop

show movie with dissolve
After adding that code in, everything was working ok. However, let's say I were to save the game and exit while a video was playing in the background by that command, the next time around when I load up the save, the video wouldn't be there anymore. It's as if the game code doesn't remember playing it.

Is that supposed to happen?

Or is the code faulty?

Big thanks!
Working on:

Image

irredeemable
Regular
Posts: 78
Joined: Thu Feb 08, 2018 7:57 am
Contact:

Re: Proper way to add a background movie behind sprites?

#2 Post by irredeemable »

That's not how the movie displayable works. In your defense, the documentation isn't exactly clear on this and many of the examples you'll find elsewhere are just plain wrong (I didn't realize this until recently either and my game uses movies extensively). The 'play' statement doesn't take the name of a displayable, it takes the name of a channel. Basically 'image movie..." and "show movie..." are doing nothing here as you haven't specified a file in the definition of the displayable, your movie is only playing because the play statement has been told to play a particular file on the channel 'movie'.

This code should work for what you're attempting:

Code: Select all

image whatever = Movie(play="/videos/curruptedscene.avi")

label start:
    show whatever
    "Save and reload here, movie should still be playing."

User avatar
AHAKuo
Regular
Posts: 41
Joined: Tue Feb 06, 2018 11:10 am
Projects: SoUnd Is ToxIc
Organization: AHAKuo
Tumblr: ahakuo
Deviantart: ahakuo
Contact:

Re: Proper way to add a background movie behind sprites?

#3 Post by AHAKuo »

irredeemable wrote: Thu Feb 22, 2018 3:48 pm That's not how the movie displayable works. In your defense, the documentation isn't exactly clear on this and many of the examples you'll find elsewhere are just plain wrong (I didn't realize this until recently either and my game uses movies extensively). The 'play' statement doesn't take the name of a displayable, it takes the name of a channel. Basically 'image movie..." and "show movie..." are doing nothing here as you haven't specified a file in the definition of the displayable, your movie is only playing because the play statement has been told to play a particular file on the channel 'movie'.

This code should work for what you're attempting:

Code: Select all

image whatever = Movie(play="/videos/curruptedscene.avi")

label start:
    show whatever
    "Save and reload here, movie should still be playing."
OMG! Thank you so much! This is perfect! I can't thank you enough :D
Working on:

Image

Post Reply

Who is online

Users browsing this forum: No registered users