0 votes

Everytime I try to make an object stop in specifics coordinates, they go way more than i expect, how to I make them stop in a specific Y coordinate??

in Engine by (12 points)

You should show what you have tried. It will help to see what you may be doing wrong.

1 Answer

0 votes

Using an if statement. When your current coordinate is close enough to the specific target coord, set its position to it.
Let's say you have variables SPEEDX, SPEEDY, TARGETPOSITION
if abs(TARGET
POSITION.x - object.position.x) < abs(SPEEDX) and abs(TARGETPOSITION.y - object.position.y) < abs(SPEEDY):
object.set
postion(TARGETPOSITION)
object.target
position_reached()

by (811 points)
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.