0 votes

Hi,

I have this path array:
path = [Vector2(128, 0), Vector2(128, -192), Vector2(320, -192), Vector2(320, 64), Vector2(448, 64)]

Its a road type path, consisting of right degree angles. But i want to be able to move the using code for different sprites i can instance. So first sprite instance might have only 3 path points, the second one could have 7 path points. Hope that makes sense.

in Engine by (61 points)

1 Answer

0 votes
Best answer

You could add the points to a Curve2D and then use one of Curve2D's interpolate methods to get a position along the path.

by (1,552 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.