[SOLVED] Trouble with animation and repeat . . . Please help

Acehole_Studios

Newbie
Game Developer
Nov 23, 2018
61
144
I’m having a major issue with animation in renpy. I have followed everything in forums and what is listed in the renpy documentation, it doesn’t work for me. I feel like there is one thing that is missing and everyone knows what that key is except for me. I am doing my first visual novel and everything has been smooth until I reached this point. I been stuck for over a week and it’s driving me crazy.
Ok let’s go down the rabbit hole.
With my visual novel, I don’t layer the characters over a background. Since I have everything in this format, I use the scene command for everything.
Example:
scene e01s03p20
zoey "{i}You got this Zoey!{/i}"

Now, let’s talk about animation. Movies are nothing but a ton of still images that are played one after the other. So that is what I’m trying to do. All forum show this:
image eileen animated:
"eileen_happy.png"
pause 1.0
"eileen_vhappy.png"
pause 1.0
repeat

or this:
image rain:
"rain"
0.1
"rain2"
0.1
"rain3"
0.1
repeat

I get nothing when I do that.
I do get animation when I do this:
scene e01s03p27a00
pause 0.1
scene e01s03p27a01
pause 0.1
scene e01s03p27a02
pause 0.1
scene e01s03p27a03
pause 0.1
scene e01s03p27a04
pause 0.1

but I can’t use the repeat command. It has no idea what repeat or loop is.

Please help.
BTW I have tried converting to a video and I hated the quality and when I added loop I couldn’t make it stop. I don’t want to make a video file so I will avoid it if I can.

I am using the latest version of Renpy and Atom.
Thank you for your time.
 

Epadder

Programmer
Game Developer
Oct 25, 2016
568
1,061
I think your misunderstanding what the is, the image command just defines a displayable you still have to ask for it to be shown.

It doesn't have to be a image file strictly.

The syntax used for a frame by frame animation is defining a displayable made of multiple other displayables using to control it.
Indentation matters and can cause things not to show up correctly.
Example.
Code:
image animatedbull:
    "bull 01"
    0.1
    "bull 02"
    0.1
    "bull 03"
    0.1
    "bull 04"
    0.1
    "bull 05"
    0.1
    repeat


label somelabel:
    scene animatedbull
    "Animated Bull"
Now the files are in my image directory and have been automatically defined by Ren'py as 'displayables' which are the filenames lowercase without the extensions (Subdirectoy is not accounted for by the current auto-definition only the file name, so duplicate filenames can also cause issues).
 

Acehole_Studios

Newbie
Game Developer
Nov 23, 2018
61
144
Thank you! The major reason it wasn't working when I was trying that it that I didn't want any text during the animation but I didn't tell it that. So what worked for me was:

Before the game start define the animation:

# Animations start
image e01s03anim:
"e01s03p27a00"
0.1
"e01s03p27a01"
0.1
"e01s03p27a02"
0.1
"e01s03p27a03"
0.1
"e01s03p27a04"
0.1
"e01s03p27a05"
0.1
"e01s03p27a06"
0.1
"e01s03p27a07"
0.1
"e01s03p27a08"
0.1
"e01s03p27a09"
0.1
"e01s03p27a10"
0.1
repeat

# Animations end


in the game I called it like this:

label mov:
show e01s03anim
window hide
pause
 
  • Like
Reactions: User_17502
U

User_17502

Guest
Guest
Thank you! The major reason it wasn't working when I was trying that it that I didn't want any text during the animation but I didn't tell it that. So what worked for me was:

Before the game start define the animation:

# Animations start
image e01s03anim:
"e01s03p27a00"
0.1
"e01s03p27a01"
0.1
"e01s03p27a02"
0.1
"e01s03p27a03"
0.1
"e01s03p27a04"
0.1
"e01s03p27a05"
0.1
"e01s03p27a06"
0.1
"e01s03p27a07"
0.1
"e01s03p27a08"
0.1
"e01s03p27a09"
0.1
"e01s03p27a10"
0.1
repeat

# Animations end


in the game I called it like this:

label mov:
show e01s03anim
window hide
pause
Thanks this will make my life so much easier.
 

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,888
2,860
The code above is almost right. When I put it in my game it broke it. This is how it should look:

Code:
image eileen animated:
    "eileen_happy.png"
    pause 1.0
    "eileen_vhappy.png"
    pause 1.0
there has to be a "pause" before the increment, otherwise Ren'py doesn't know what to do with it.

Otherwise this is a *FANTASTIC* post and will save me the trouble of having to convert my slide collections into movies, which is a pain and does not work that reliably anyway. This is a huge time saver for me, so thank you, thank you, thank you.

As a side note, in order to get smooth animations, I cut the pause time to 0.05, and to get "fast" animations, down to 0.03.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,416
15,322
On a side note, Ren'py can use text substitution in the image declaration. So, if your animations have the same number of frames and the same interval between them, you can save times by defining only one image :

Code:
image anim10Frames:
    "[actualAnim] 00"
    pause 0.5
    "[actualAnim] 01"
    pause 0.5
    "[actualAnim] 02"
    pause 0.5
    "[actualAnim] 03"
    pause 0.5
    "[actualAnim] 04"
    pause 0.5
    "[actualAnim] 05"
    pause 0.5
    "[actualAnim] 06"
    pause 0.5
    "[actualAnim] 07"
    pause 0.5
    "[actualAnim] 08"
    pause 0.5
    "[actualAnim] 09"
    pause 0.5
    repeat

# Must be defined from the start because of Ren'py's prediction feature.
default actualAnim = ""

label blablabla:
    $ actualAnim = "doing dishes"
    show anim10Frames
    [...]
    hide anim10Frames
    $ actualAnim = "cleaning livingroom"
    show anim10Frames
    [...]
    hide anim10Frames
Assuming that you have the following files in the "images" folder :
"doing dishes 00.jpg", "doing dishes 01.jpg", etc. and "cleaning livingroom 00.jpg", "cleaning livingroom 01.jpg", etc.
 
  • Like
Reactions: seamanq

seamanq

Well-Known Member
Game Developer
Aug 28, 2018
1,888
2,860
On a side note, Ren'py can use text substitution in the image declaration. So, if your animations have the same number of frames and the same interval between them, you can save times by defining only one image :

Code:
image anim10Frames:
    "[actualAnim] 00"
    pause 0.5
    "[actualAnim] 01"
    pause 0.5
    "[actualAnim] 02"
    pause 0.5
    "[actualAnim] 03"
    pause 0.5
    "[actualAnim] 04"
    pause 0.5
    "[actualAnim] 05"
    pause 0.5
    "[actualAnim] 06"
    pause 0.5
    "[actualAnim] 07"
    pause 0.5
    "[actualAnim] 08"
    pause 0.5
    "[actualAnim] 09"
    pause 0.5
    repeat

# Must be defined from the start because of Ren'py's prediction feature.
default actualAnim = ""

label blablabla:
    $ actualAnim = "doing dishes"
    show anim10Frames
    [...]
    hide anim10Frames
    $ actualAnim = "cleaning livingroom"
    show anim10Frames
    [...]
    hide anim10Frames
Assuming that you have the following files in the "images" folder :
"doing dishes 00.jpg", "doing dishes 01.jpg", etc. and "cleaning livingroom 00.jpg", "cleaning livingroom 01.jpg", etc.
Very cool. This is also good information to have and can make the code a little less cumbersome. I'm all over this because I has having problems with animations in webm form working and not working, then having to change them to mp4 for Android. If this is a workable solution for both, then it saves a lot of post work, keep high quality (perhaps even higher quality), and will be a consistent workable solution for both. It fits my workflow as well, as I generate a series of images to create the videos anyway, so if I can eliminate that step and making the video files, that's just icing on the cake.