[Solved] Small sprite movements which require no correcting, afterwards?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
SelLi
Miko-Class Veteran
Posts: 550
Joined: Fri Apr 27, 2012 4:49 pm
Completed: The Silent Column
Projects: Ethereal Overflow
Deviantart: SelLillianna
itch: SelLillianna
Location: Canada
Contact:

[Solved] Small sprite movements which require no correcting, afterwards?

#1 Post by SelLi »

Hi everyone. :) I hope you're doing well.
I have a question for you - I've been using small ATL animations for my character sprites for a while, now, and they work fine for the most part, but I've been having a problem: when the animation is interrupted, the offset is kept, and the animation doesn't finish. For example, if I'm using this little nodding animation...

Code: Select all

transform nod:
    xanchor .5
    ease .3 yoffset 20
    ease .3 yoffset 0

# ...

show girl eyes closed at centpos:
    nod

"She nodded."

show girl eyes open at centpos

# The girl will be dipped, from here on out, if the player clicked before the animation could finish.

"Then, she opened her eyes."
This is how I've been solving the problem:

Code: Select all

transform vcor:
    xanchor .5
    yoffset 0

# ...

show girl eyes closed at centpos:
    nod

"She nodded."

show girl eyes open at centpos:
    vcor

# The girl will no longer be dipped, from here on out, because her yoffset has been set to 0.

"Then, she opened her eyes."
The issue is that sometimes I forget to apply this correction, and it's an extra thing to keep in mind while I'm building my visual novel. So, my question is, is there a better way to go about doing this, which doesn't need to be manually corrected each time?

I was thinking of using move transitions. Something like so...

Code: Select all

define m_2 = MoveTransition(.2)

transform centpos:
    yalign .5
    xalign .5

transform centjumppos:
    yanchor .5
    ypos .4
    xanchor .5
    xpos 0.5

# ...

show girl at centjumppos with m_2
show girl at centpos with m_2

"I startled her."
While that would solve this issue, that in itself would be a little tedious, to have to write each position and transition to lift her up, and then to set her back down, again. It would be nice to be able to save that little sequence of movement to a variable like "centjump" and to be able to write it like this...

Code: Select all

show girl centjump

"I startled her."
... But I'm not sure if that's possible.

What do you think I should do? Should I keep using the ATL animations and correcting the offsets, like I've been doing? Should I use the multiple move transition method? Can multiple move transitions be saved as a single sequence which can easily be reused? Or is there something else I've totally missed...? The latter wouldn't surprise me, at all. :) Any help would be appreciated.

Regardless, thank you for reading, and please have a nice day. <3
Last edited by SelLi on Sun Feb 11, 2024 8:15 pm, edited 1 time in total.

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1031
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Small sprite movements which require no correcting, afterwards?

#2 Post by m_from_space »

SelLi wrote: Sun Feb 11, 2024 5:29 am For example, if I'm using this little nodding animation...

Code: Select all

transform nod:
    xanchor .5
    ease .3 yoffset 20
    ease .3 yoffset 0

# ...

show girl eyes closed at centpos:
    nod

"She nodded."

show girl eyes open at centpos

# The girl will be dipped, from here on out, if the player clicked before the animation could finish.

"Then, she opened her eyes."
I think you should understand that you're replacing the transform. How should Renpy know what you want after that?

The way to do it is this:

Code: Select all

transform nod:
    # make sure to put this here
    animation
    xanchor 0.5
    ease .3 yoffset 20
    ease .3 yoffset 0

show girl eyes closed at centpos, nod

"She nodded."

# either this
show girl eyes open at centpos, nod

# or just without any statement
show girl eyes open

"Then, she opened her eyes."

User avatar
SelLi
Miko-Class Veteran
Posts: 550
Joined: Fri Apr 27, 2012 4:49 pm
Completed: The Silent Column
Projects: Ethereal Overflow
Deviantart: SelLillianna
itch: SelLillianna
Location: Canada
Contact:

Re: Small sprite movements which require no correcting, afterwards?

#3 Post by SelLi »

m_from_space wrote: Sun Feb 11, 2024 6:35 pm I think you should understand that you're replacing the transform. How should Renpy know what you want after that?

The way to do it is this:

Code: Select all

transform nod:
    # make sure to put this here
    animation
    xanchor 0.5
    ease .3 yoffset 20
    ease .3 yoffset 0

show girl eyes closed at centpos, nod

"She nodded."

# either this
show girl eyes open at centpos, nod

# or just without any statement
show girl eyes open

"Then, she opened her eyes."
Thank you very much. :) These are the sorts of things I don't know about. I'll try it out!

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1031
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Small sprite movements which require no correcting, afterwards?

#4 Post by m_from_space »

SelLi wrote: Sun Feb 11, 2024 6:43 pm Thank you very much. :) These are the sorts of things I don't know about. I'll try it out!
Here is what the "animation" keyword does by the way, forgot to include it: https://www.renpy.org/doc/html/atl.html ... -statement

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Semrush [Bot]