How to play an animation with no loop in renpy?

TheTypist

Active Member
Donor
Game Developer
Sep 7, 2017
694
4,185
Just a quick question which I'm sure isn't too difficult but I can't figure it out. I'm trying to play an animation and I want it to end on the last frame instead of looping and I don't want it to show the render before it either, just want it to stay on the last frame till the next animation starts. All my animations have needed to be looped until now so I can't figure it out...
 

TheTypist

Active Member
Donor
Game Developer
Sep 7, 2017
694
4,185
image sexy = Movie(play="sexy_movie", loop=False)
I did this, but it ends the movie entirely and falls back to the last render before it. I want it to remain on the last frame or jump to the next render once it ends either or would be better than falling back to the previous render
 

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
I did this, but it ends the movie entirely and falls back to the last render before it. I want it to remain on the last frame or jump to the next render once it ends either or would be better than falling back to the previous render
Oh yeah, I had this problem once now you mention it, I solved it by using the old movie playing method as it does not loop by default.
$ renpy.movie_cutscene("your_movie")

I have no idea if there is a better way though.
 
  • Like
Reactions: Luderos

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,979
16,236
I have no idea if there is a better way though.
I haven't tested it, but apparently the image parameter for Movie have been extended in recent versions of Ren'py ; or at least the doc improved to extend its behavior.
Initially it was an image/movie to display if the movie couldn't be played, but now the documentation end with, "the image will also be used if the video plays, and then the movie ends". So apparently if you define the movie like this :
Code:
image sexy = Movie(play="sexy_movie", loop=False, image="Last_frame.jpg")
it should do it.
 

mickydoo

Fudged it again.
Game Developer
Jan 5, 2018
2,446
3,557
I haven't tested it, but apparently the image parameter for Movie have been extended in recent versions of Ren'py ; or at least the doc improved to extend its behavior.
Initially it was an image/movie to display if the movie couldn't be played, but now the documentation end with, "the image will also be used if the video plays, and then the movie ends". So apparently if you define the movie like this :
Code:
image sexy = Movie(play="sexy_movie", loop=False, image="Last_frame.jpg")
it should do it.
I hope so, I'll try it in a day or three when I put an animation in, and if it does I will replace the one I used the old method with. The issue with the cutscene way, because it wasn't defined as an image I couldn't get the gallery to pick it up, pissed me off to no end.
 

TheTypist

Active Member
Donor
Game Developer
Sep 7, 2017
694
4,185
I haven't tested it, but apparently the image parameter for Movie have been extended in recent versions of Ren'py ; or at least the doc improved to extend its behavior.
Initially it was an image/movie to display if the movie couldn't be played, but now the documentation end with, "the image will also be used if the video plays, and then the movie ends". So apparently if you define the movie like this :
Code:
image sexy = Movie(play="sexy_movie", loop=False, image="Last_frame.jpg")
it should do it.
Thank you! Your solution worked. I just used the last frame from the animation as the image and it worked exactly as I wanted. You're a legend
 

Knyghtblade

Newbie
Nov 3, 2017
64
15
But for me it didnt work. :( It just skips right over the movie onto the next line of text.

image full1 = Movie(play="full1", loop=False, image="e1100.png")
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,611
2,258
But for me it didnt work. :( It just skips right over the movie onto the next line of text.

image full1 = Movie(play="full1", loop=False, image="e1100.png")

That line only creates a displayable called "full1" which happens to be a movie file.
You would still need a separate line to actually show it.

Usually that would be scene full1 or a variation on that theme.

image statements are processed by RenPy as the game starts. RenPy scans through all the source code and deals with them (more or less) before anything else happens. Same with other statements like default or define. As such, those lines can appear anywhere in the code (though it's usually a good idea to place them together somewhere near the top of the code). As such, it's not so much "skipping right over it", as processing it long before you seem to assume. By the time the code actually runs, lines like image and define are ignored.
 
  • Like
Reactions: La'Zaa

Knyghtblade

Newbie
Nov 3, 2017
64
15
Brilliant - that's what I was missing.

I previously had been using the $ renpy.movie_cutscene("your_movie") command which doesnt need a secondary call command, but has less functionality.

This was a huge help. Thanks!