Since i had a bit to think of how to play movies in screens, not as part of it but simply to rewatch (like in otome games, for example), i though i could share the code.
First of all, the movie is not part of the screen you call it from itself, but in a seperate screen on its own. So all you need to show it is the movie screen and a button somewhere to show it from in your menu. So the screen where the button is doesnt matters. It can be in your main menu, in an extras screen or anywhere else. It also can be any button.
For this example i made a simple extras screen from which we call a opening movie.
Code: Select all
screen extras():
add "bg.png"
tag menu
## The button to call the movie.
textbutton _("Opening") xalign 0.5 yalign 0.5 action ShowMenu("opening_movie")
textbutton _("Return") xalign 1.0 yalign 1.0 action Return()
When showed, the movie immediatly plays at full size.
There is no back button, instead when clicking anywhere on the screen the movie will stop playing and jump back to where you came from (in our example, it will go back to the extras screen.) Otherwise, if you let it run till the end, once done, it will too jump back.
The code can be copy/pasted, simply follow the instructions:
Code: Select all
## Black Image
image black = "#000"
screen opening_movie():
## In case movie loads, ensures screen isnt empty.
add "black"
tag menu
## Change Size according to your movie size (x, y). Movie size should be the same as your game-screen size for this to cover the whole screen!
add Movie(size=(1920, 1080))
## Replace Opening.webm with your movie path/name.
on "show" action [Play("movie", "Opening.webm", loop=False), Stop("music")]
## Replace MainMenuMusic.ogg with your main menu music path/name.
on "hide" action [Stop("movie"), Play("music", "MainMenuMusic.ogg")]
## Replace Opening.webm with your movie path/name.
on "replace" action [Play("movie", "Opening.webm", loop=False), Stop("music")]
## Replace MainMenuMusic.ogg with your main menu music path/name.
on "replaced" action [Stop("movie"), Play("music", "MainMenuMusic.ogg")]
button:
xysize (config.screen_width, config.screen_height)
## Change screen name to where you came from.
action ShowMenu("extras")
## Replace 120 with the lenght of your movie (in seconds) & change screen name to where you came from.
timer 120 action ShowMenu("extras")
For more than one movie or to make a whole gallery for movies, you simply make a screen for each movie seperately and a button for each to show the screen (like in the example above).
If something doesnt works or your have any questions, feel free to ask!
I hope this helps!