Question about Renpy animations - Solved

Niteowl

Member
Game Developer
Apr 6, 2018
298
378
So I've been working on my game for a bit.
It's going well and up to now I felt like Renpy was pretty easy to learn (got to use multiple menus yesterday with no problem, labels etc)

Ran into a snag today.......
I was trying to turn a few frames into a simple slideshow animation..... but so far all the code I got online doesn't seem to work in my game

I tried

image xxxxx:
"130.jpg"
pause 1
"132.jpg"
pause 1
repeat


after that, there is a jump command........

anyways, I tried variations that give me error messages, the one above works but instead of repeating the images the game just goes to screen I wanted the player to jump to eventually...
it doesn't show the images 130 and 132 at all

If anybody could give me some tips it would be appreciated......
I just want to do a simple animation that will keep repeating until the player moves past a few messages and then gets to the ending of the scene.....

I don't understand what I'm doing wrong...the code above works for some people
Am I missing something? Should I define the image before those lines, somehow?

Please help ;)
 

Deleted member 1121028

Well-Known Member
Dec 28, 2018
1,716
3,295
Take a look at this thread.
I got into some trouble too (while not the same problem), not long time ago but finally got it working thanks to the people here

qEYyxSqtl0.gif

For this one I declare my two images :

Python:
image Aublink01 = "prologue/prologue_378.png"
image Aublink02 = "prologue/prologue_378bis.png"

and then:

Python:
show loop:
    alpha 0.
    "Aublink01"
    linear 1. alpha 1.
    block:
        "Aublink01"
        4.5
        "Aublink02"
        .25
        repeat
"blablabla"
 

Niteowl

Member
Game Developer
Apr 6, 2018
298
378
Take a look at this thread.
I got into some trouble too (while not the same problem), not long time ago but finally got it working thanks to the people here

View attachment 403808

For this one I declare my two images :

Python:
image Aublink01 = "prologue/prologue_378.png"
image Aublink02 = "prologue/prologue_378bis.png"

and then:

Python:
show loop:
    alpha 0.
    "Aublink01"
    linear 1. alpha 1.
    block:
        "Aublink01"
        4.5
        "Aublink02"
        .25
        repeat
"blablabla"
No, for me it doesn't work

of the two images I"m trying to loop it shows only the second one and then goes to the next dialogue....
it doesn't show any loop regardless of how long I make the pauses.....
It's driving me insane....maybe I should just give up....... all the code that should work doesn't.....arghh

thanks for trying though, much appreciated
 

Niteowl

Member
Game Developer
Apr 6, 2018
298
378
So......
any other suggestions.....

I don't understand why the repeat function will not work for me......
I watched videos with code that works fine, but when I do the exact same thing it doesn't

I could make an animation using labels, with jump back to the beginning, but that's an infinite loop and the game crashes if you try to get out.....

In theory, the code I posted above should work (it's taken from Renpy documentation)
but it doesn't....the ALT blocks don't seem to work, anybody understands why?
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,222
I can see a couple of possibilities. No reflection of your skill as a programmer intended... just me working through a couple of possibilities...

Option 1:

It could be a misinterpretation of what image: is doing.

image: (wherever it is in your code) defines an image. So in your first example, you're creating a new image "xxxxx" which uses ATL (Animation and Transformation Language) to join your two other images together, with a pause and repeat.

What it doesn't do is show the image itself.

Like other things in RenPy, image statements are gathered up and processed before the main game gets started. So where they exist within the code doesn't matter (which is why you see so many games where all those image/animation statements are at the top of the code).

To display the image, you need to put a show xxxxx or scene xxxxx.

Reading some of your other replies though... you're talking about one of the images being shown... so it could be I'm completely wrong in my assumption of your initial problem.


Option 2:

The other reason it could be is if you're not showing any dialogue with/after the image (maybe a show/scene of this image followed by a show/scene of another image?).

What ATL does is define a series of events that will happen, as long as the game gives the player enough time to experience them. But if you define ATL that says something like "show this for 3 seconds, then show that for 3 seconds", but the player's actions (or your code) mean things are only shown for 1 second - then things will jump forward. If however the game gets the full 6 seconds to show it... then the player will see it as you intended.

If that is what's going on here, I think what you need is either a pause after your show/scene statement or add a Pause {time} to your show/scene statement. Or just add a line of dialogue for the player to click through.

Something like this:

Python:
image loop:
    "loop01.png"
    pause 0.5
    "loop02.png"
    pause 0.5
    repeat

label start:
    scene loop
        with Pause 4.0

    scene next_image
    "<<< THE END >>>"

Edit: In my experience, a lot of authors will immediately rush to add a pause line in here (or add the "with pause" as I've suggested). However, I often find that a couple of lines of dialogue work much better. The player naturally pauses to read the text, then clicks, then pauses to read the follow-up lines... all the while your repeating animation is still showing on screen until replaced by another show/scene image. Just a thought.

Oh... and I'm not sure if it's "with pause" or "with Pause" . I'm not in a position to do a quick test, so use whichever works.



Option 3:

If you have a Pause statement in there already... also keep in mind that if you're also using text auto advance, that pause will only last as long as you've set your auto advance time settings for... again, perhaps not long enough to show the full animation... which is why "with pause {time}" can sometimes work better. Not that will help if your player is clicking to advance like a maniac.


Edit: Option 4:

A late edition, but not impossible.

Your initial post doesn't include any indentation. I get that. Posting to the forums doesn't include indentation. But since it's a possibility, I'm mention it here.
The definition of ATL image has to be indented in a similar way to our examples. Yeah, yeah, unlikely I know... but I'm just covering all bases.
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,375
15,288
Option 2:
Personally, and according his, "instead of repeating the images the game just goes to screen I wanted the player to jump to eventually", I would say that it's this one. He display the animation, but jump/call/whatever right after, which make Ren'py update everything.

His error being probably to think that the pause inside the animation pause the game, and not just the animation. Therefore, like you said, he need a pause/interaction in between the show that display the animation and whatever will update the screen after.
 
  • Like
Reactions: Niteowl

Niteowl

Member
Game Developer
Apr 6, 2018
298
378
ok, guys I figured it out....

yes, it was a combination of the above issues...... mainly 1, 2 and 3

On another forum someone mentioned I can use the image lines to define the image, but I still had to show it (which I now do using the 'scene' statement, so I defined the sequence at the beginning and later, when I want it, the 'scene xxx' command shows the animation, which looks ok for a very simple one) and to add pauses or lines of dialogues after that.... so it repeats until the player gets to the next scene.

On that topic, not sure why the 'show' statement doesn't work but whatev (maybe when I used it I hadn't fixed the lack of a pause or line of dialogue to follow)

The indentation was fine, I just did a poor job of copying my text on this post (the editor I use does the indents correctly).

I know, I do suck as a coder, but I just started learning two weeks ago....overall not doing too bad (menus were not a problem at all, used a few already and they work great).
I can do simple animations too now. I'm just trying to learn one piece at a time

I think making my game will take longer than I hoped and it will probably just be a hobby so I should maybe spend less time on it and more time on other issues I need to deal with, but it's ok....it's kind of a cool hobby anyways. I'm enjoying making it, occasional frustrations aside, hope other players will like it too

thanks for the help guys
 

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,583
2,222
In theory, the only difference between show and scene is that scene clears the workspace/desktop/screen (whatever you want to call it) before displaying the image you've asked it to.

Whereas show just adds an image to the existing scene.

There are some rules about image name prefixes and which layer an image appears on... but for the most part, relatively inexperienced devs like us would never need to worry about them.

So yeah... I'm guessing if you tried show right now, knowing everything else you've learned along the way... it'd probably work just fine.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,375
15,288
[...]
Whereas show just adds an image to the existing scene.
Exactly.

If it can help, "you" (who read me) can look at the game like if it was a puppet show. scene is the canvas representing the context/background, while show is the puppets themselves. Therefore, if you don't have puppets, like it's the case in most of adult games, especially those with 3D CG, then show is almost never needed.