0 votes

I just want to align a seamless parallax layer with a sprite to the bottom of my 2D window and only move it down when I jump, but when I change the y value of motion_scale from 1 to 0.5 (for example) the vertical offset of the layer node has moved up when I run the game.

I have tried a lot of things to fix it, but it doesn't align perfectly. I know I need to use $Layer1.motion_scale.y in my calculations, but I can't find the right formula.

This is the closest I got, "0.1" is what needs to be fixed:

$FrontLayer/Sprite.position.y = -$FrontLayer/Sprite.region_rect.size.y * ($FrontLayer.motion_scale.y - 0.1)
in Engine by (12 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.