Ren'Py Image transform cancelling another transform

nonomo

Newbie
Game Developer
May 2, 2019
43
68
Hi I'm trying to add a bit of life in my VN with transforms.
It's supposed to add some movement to my sprite.
So here's my code :
Code:
show maincharacter:
        linear 17.0 xoffset 700
    show ellie:
        linear 17.0 xoffset 700
    mc "Some dicussion"
    e "Some dicussion"
    mc "Some dicussion"
    e "Some dicussion"
    mc "Some dicussion"
    show ellie at turn_right_emote
    e "Some dicussion"
Now, the line "show ellie at turn_right_emote " cancels "show ellie: linear 17.0 xoffset 700"
I don't know if it's possible, but can I make my second show not cancel the first but add the animation on it instead ?
I could add "linear 17.0 xoffset 700" To the second show, but since there are dialogs in between, the speed of the animation will change based on the player's reading speed and I don't want that.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,964
16,209
Now, the line "show ellie at turn_right_emote " cancels "show ellie: linear 17.0 xoffset 700"
When you paint a wall, do you expect the color to become a mix between the old one and the new one, or to be the new color ?
It's the same here. If you apply a transform, it will override the previously applied one.


I don't know if it's possible, but can I make my second show not cancel the first but add the animation on it instead ?
No.


I could add "linear 17.0 xoffset 700" To the second show, but since there are dialogs in between, the speed of the animation will change based on the player's reading speed and I don't want that.
It wouldn't works anyway, and it's not a question of reading speed. When you would apply "turn_right_emote", the linear move would restart.


What you need to do is to rely on a stopping . Something that would looks like:
Python:
init python:
    def stoppingATL( trans, st, at ):
        if waitingState:
            return 0
        else:
            return None

default waitingState = True

transform ellie_turn_right:
    linear 17.0 xoffset 700
    function stoppingATL
    [whatever /turn_right_emote/ is]

label whatever:
    $ waitingState = True
    show ellie at ellie_turn_right
    mc "Some dicussion"
    e "Some dicussion"
    mc "Some dicussion"
    e "Some dicussion"
    mc "Some dicussion"
    $ waitingState = False
    e "Some dicussion"
This isn't strictly the answer to your problem, because the transform will wait for the linear move to finish before it wait for the next move to do.
But this flaw come from your design. As it is, if it was possible to extend a transform, instead of purely replace it, it would have waited for the linear move to have finished, or have interrupted it mid way.

It's possible to make "turn_right_emote" be applied right when the state change, by handling the whole transform directly in the function. But then you would still face the same issue. Either the move is interrupted mid way, because 17 seconds is fucking long, or the image is forced at its destination place, jumping in an instant after having moved slower than a sloth. In both case it would be something really weird.
 

nonomo

Newbie
Game Developer
May 2, 2019
43
68
Thank you, I was a bit expecting something like that since I couldn't find anything to completely solve it.
I guess I'll change that scene to a more normal thing.
 

osanaiko

Engaged Member
Modder
Jul 4, 2017
2,547
4,631
Thank you, I was a bit expecting something like that since I couldn't find anything to completely solve it.
I guess I'll change that scene to a more normal thing.
As you have found it is a hassle to try to setup timed events (visual but the same problem exists for audio) in combination with user-clickable dialogue, because different players will have different reading speed. Some will be speed clicking, some will read every word carefully. I think this is the reason many "commercial" h-games use simple, fast, "reaction" animations during the dialogue, and quickly return to the default state. And each animation is overridden by the next one if the user is clicking so fast that the next one must trigger before the previous finishes.