ATL transform moving in wrong direction

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
HyDrone
Newbie
Posts: 12
Joined: Tue Apr 10, 2018 12:38 am
Contact:

ATL transform moving in wrong direction

#1 Post by HyDrone »

Here's my code:

Code: Select all

transform scrollin:
    xpos 1920 yalign 0.5
    pause 1.0
    linear 2.0 xoffset -1400
 
transform scrollout:
    linear 2.0 xoffset -800
When I apply these to an image, scrollin works as intended (move from right to left), but with scrollout what happens is the image moves 800 pixels to the right. What is the cause of the problem and how do I fix it?

Edit: I found a clue, I think. I switched the -800 with -2000. For some reason that does register as leftward movement... but what is the reason?

I've posted a similar topic recently, but this is technically a different function and probably has a different cause.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: ATL transform moving in wrong direction

#2 Post by Imperf3kt »

You are using xoffset, which basically moves the image's anchor point by the offset amount.
When you go to scroll it out, it uses the offset as its start point because it has been anchored there.
Imagine a sheet of A4 paper. The bottom left is your reference point. If you offset the position, the reference point moves off the paper, instead of moving the paper. Then, when you go to move it from what you expect is 0,0, it is really -1400,0, so moving the offset to -800 will move it to the right (because -800 is further right than -1400)

I suggest using xalign or xpos for all positioning.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

HyDrone
Newbie
Posts: 12
Joined: Tue Apr 10, 2018 12:38 am
Contact:

Re: ATL transform moving in wrong direction

#3 Post by HyDrone »

Thank you very much for the detailed explanation!

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot]