[SOLVED] Transform not working with yalign

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
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

[SOLVED] Transform not working with yalign

#1 Post 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
Last edited by Kinmoku on Wed Jun 22, 2016 6:01 am, edited 1 time in total.

Onishion
Veteran
Posts: 295
Joined: Mon Apr 20, 2015 10:36 am
Contact:

Re: Transform not working with yalign

#2 Post 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.

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: Transform not working with yalign

#3 Post 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

User avatar
Steamgirl
Veteran
Posts: 322
Joined: Sat Jul 28, 2012 4:39 am
Completed: My Cup of Coffee, Queen at Arms (co-wrote a battle scene)
Projects: Stranded Hearts, Emma: A Lady's Maid
Deviantart: steamgirlgame
Contact:

Re: [SOLVED] Transform not working with yalign

#4 Post 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. :)

Onishion
Veteran
Posts: 295
Joined: Mon Apr 20, 2015 10:36 am
Contact:

Re: [SOLVED] Transform not working with yalign

#5 Post 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.

User avatar
Kinmoku
Miko-Class Veteran
Posts: 591
Joined: Mon Aug 11, 2014 9:39 am
Completed: One Night Stand
Projects: VIDEOVERSE
Tumblr: gamesbykinmoku
itch: kinmoku
Location: Germany
Contact:

Re: [SOLVED] Transform not working with yalign

#6 Post 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

Post Reply

Who is online

Users browsing this forum: No registered users