(Solved) How do stop an object at a specific position?

Hello.
I learn progressively the game logic of GDevelop for a few weeks.

In my sandbox game, I’m trying to bring a panel from the right to the center of my screen, when I click on the “About” button. (this button appears when Start ! is clicked)

As you can see in the screenshots, I thought about stopping the moment at position X 128. Y is already where I want.

Instead, both objects continue moving forward. They don’t stop.

I’m sure there are other methods of producing this and I’m open to that. But I want to understand why the object doesn’t stop.

Thanking you in advance. :pray:

Hi,

the problem is that you set a specific position x = 128. Force is moving the object by frame and it is very unlikely (although not impossible) that it is moved exactly to x = 128 in the process (x = 127.9999999999 would already not work). You can easily solve this by choosing the “less or equal to” operator. This means that the object stops always at a - maybe not visibly - different position.

For a more precise movement you could use the tween behavior instead. This will move your object to the exact position.

The X position is not likely to hit 128 exactly, you should change the condition to less than or equal to 128

You could also try adding the tween behaviour to the panel and use an event to tween it’s position to 128.

@Drona Hi, thanks for the explanations, I understand better how frames work! I had a vague intuition for this.

I also tested tween behavior. Thank you for these enlightening answers.

Subject resolved. :pray: