0 votes

I have bunch of Walls moving down with correct speed position etc. and I cant's change it. Few of this walls needs to move also in side ways with randomly generated values. The best option for me in this situation will be Tween.

How can I use Tween only for one Axis?
I have found some info in internet about it but it's seems to now working: https://github.com/godotengine/godot/issues/8257

tween.interpolate_property(get_node("Node2D_to_move"), "transform/posX", 0, 100, 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)

My walls are moving down using WallPos.y += 512*delta

Of course i have tween.start() and with normal values (for both axis) it's working correctly.


in Engine by (227 points)

Tween a variable and use it to update the position as mentioned here https://godotengine.org/qa/14993/how-can-i-achieve-set_pos-as-a-parable-with-tween-node?show=15000#a15000

1 Answer

0 votes
Best answer

You need to put a Vector2 in place of the start and target values like this.

var n = get_node("node2d_to_move")
tween.interpolate_property(n, "transform/pos", n.get_pos(), n.get_pos() + Vector2(0,100), 1, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT)
by (750 points)
selected by
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 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 webmaster@godotengine.org with your username.