Page 1 of 1

[SOLVED] Transform not working with yalign

Posted: Tue Jun 21, 2016 8:03 am
by Kinmoku
Hi all, I've got a small issue transforming a sprite. I want it to move diagonally and fade out at the end. Here's my code:

Code: Select all

    transform leaveroom:
        parallel:
            yalign 0.5
            pause 1.0
            linear 1.7 yalign 0.2
        parallel:
            alpha 1.0
            pause 1.6
            linear 1.1 alpha 0.0
        parallel:
            xanchor 0.0
            xalign 0.5
            pause 1.0
            linear 1.7 xalign 0.74
The problem is it completely ignores the y values. I tried it with a yanchor and that didn't work. I moved the parallel block to the top, that didn't work either. I wondered if you can only have 2 parallel blocks? Or does Renpy ignore y values on animated spites?

Here's the sprite code:

Code: Select all

image robin leave:
    "sprites/leave_01.png"
    0.1
    "sprites/leave_02.png"
    0.1
    "sprites/leave_03.png"
    0.1
    "sprites/leave_04.png"
    0.1
    "sprites/leave_05.png"
    0.1
    "sprites/leave_06.png"
    0.1
    "sprites/leave_07.png"
    0.1
    "sprites/leave_08.png"
    0.1
    "sprites/leave_09.png"
    0.1
    "sprites/leave_10.png"
    0.1
    "sprites/leave_11.png"
    0.1
    "sprites/leave_12.png"
    0.1
    "sprites/leave_13.png"
    0.1
    "sprites/leave_14.png"
    0.1
    "sprites/leave_15.png"
    0.1
    "sprites/leave_16.png"
    0.1
    "sprites/leave_17.png"
    0.1
    "sprites/leave_18.png"
    0.1
    "sprites/leave_19.png"
    0.1
    "sprites/leave_20.png"
    0.1
    "sprites/leave_21.png"
    0.1
    "sprites/leave_22.png"
    0.1
    "sprites/leave_23.png"
    0.1
    "sprites/leave_24.png"
    0.1
    "sprites/leave_25.png"
    0.1
    "sprites/leave_26.png"
    0.1
    "sprites/leave_27.png"
    0.1

Re: Transform not working with yalign

Posted: Tue Jun 21, 2016 3:54 pm
by Onishion
ATLs give me headaches, but I'm thinking it's a problem with yalign and the size of your image. Is your image at or near the same height as the stage? If so, that may cause issues with certain transforms.

People use align in animations a lot, but to me they cause more hassles than they're worth. What it does is set both the anchor AND the position of the object to the value you provide, which sometimes works nicely, and sometimes fights against you.

Have you tried using ypos instead? Also, setting xanchor, I believe, is redundant here as it immediately gets overriden to 0.5 by the xalign statement. I would try out:

Code: Select all

transform leaveroom:
        anchor (0,0) #this is the top left, but you can set it to whatever you'd like it to be)
        parallel:
            ypos 0.5
            pause 1.0
            linear 1.7 ypos 0.2
        parallel:
            alpha 1.0
            pause 1.6
            linear 1.1 alpha 0.0
        parallel:
            xpos 0.5
            pause 1.0
            linear 1.7 xpos 0.74

#or, you could cut out both the Xpos and Ypos bits, and just have this:
        parallel:
            pos (0.5,0.5)
            pause 1.0
            linear 1.7 pos (0.74,0.2)
You would need to leave the alpha as a parallel though. You only need to separate out the X and Y movments if you want them to have different timings, like if you wanted the X to complete a little before the Y.

Re: Transform not working with yalign

Posted: Wed Jun 22, 2016 6:00 am
by Kinmoku
The sprite is as tall as the screen, so that maybe why it didn't work. Xpos and ypos seems a lot cleaner though, so I've gone with that and it works :D I had to change the numbers a little, but it's working perfectly now - thank you! I'll use this method in future.

In case it will help anyone, here's the final code:

Code: Select all

    transform leaveroom:
        parallel:
            pos (0.54,-0.09)
            pause 1.0
            linear 1.7 pos (0.63,-0.14)
        parallel:
            alpha 1.0
            pause 1.6
            linear 1.1 alpha 0.0

Re: [SOLVED] Transform not working with yalign

Posted: Wed Jun 22, 2016 11:40 am
by Steamgirl
Just in case it's helpful for future reference, xalign and yalign set both the position and the anchor at the same time.

So if you do yalign 0.0, it will put the image at the top of the screen with the anchor at the top of the image.
If you put yalign 0.5, it will put the image in the middle of the screen with the anchor in the middle of the image.
If you put yalign 1.0, it will put the image at the bottom of the screen with the anchor at the bottom of the image.

Image

Hence that with a full height image, it looks as though nothing is happening, even though the ypos and the yanchor values are changing. :)

Re: [SOLVED] Transform not working with yalign

Posted: Wed Jun 22, 2016 12:54 pm
by Onishion
That's a helpful. image.

I still wish Renpy had a "dev view" for images where it would paint a border around them and paint the anchor point that you could turn on and off in the dev toolkit to test animations.

Re: [SOLVED] Transform not working with yalign

Posted: Thu Jun 23, 2016 5:35 am
by Kinmoku
Thanks Steamgirl! That's a really helpful diagram :) It makes much more sense now.

I second the Renpy anchor point dev view! They've always confused me xD