Why the movment distance change each time?

As you can see in the code:

The balloon needs to move within a specific range of vertical motion.
But why does this distance change each time?


I think it’s because the balloon is building up force or momentum as it moves. So, each time it takes a little longer to change direction as an opposite force is applied and then each time it has a longer distance to regain momentum. So, it has time to go farther and faster. It just keeps building.

You could start applying opposite force sooner or vary the amount. You could use a trigger once and apply the force just once or add a speed limiter so it stops adding force after it reaches a certain speed.

Or you could do a million other things that might be better. This at least gets you pointed in the right direction.

Can you please explain more?
Just let me say the ballon hasn’t the physics behavior.

It may not have phisics but it’s applying a permanent force. It’s a small amount over time. It’s accumulative. The object starts gaining speed and force. When it reaches a certain y() it switches the direction of force but if it’s moving at say 75 (I want to say newtons, I could be wrong) but say it’s moving at 75. The direction of force being applied changes and it starts to slow down. It takes time and distance to cancel out the force.

Once the object stops, it starts to gain speed or forces. It moves. It slowly gains speed. Since it doesn’t actually stop at the limits it goes beyond. So, now it has a longer distance and more time to accumulate force. When it reaches the other set point it repeats the change in force but now it’s going faster and it takes longer to cancel out the force. It goes further. And so on.

So in your idea what should I do?
Even when I give a point number to each point this problem remains!
I mean:

  1. Starting point
  2. Up
  3. Down

You could lower or raise the numbers so; it begins to stops sooner. If it reaches the other point then you could stop it completely. Although, that might look unnatural.

There’s a behavior called “EllipseMovement” Assign it to you ballon object and then once setup it’s automatic.

Set the x radius to 0, the y radius to the distance and the loop duration to the time.

Does this mean that Gdevelop can’t handle such a simple task?

It’s not Gdevelop. It’s the process. It’s working as expected. It’s like skating on ice. The force builds up slowly. You either need to plan ahead and stop sooner and/or limit the max speed so there’s consistency.
Did you try the behavior?

Here’s how to do it with the tween behavior assigned to your balloon(s)
You can choose the tween style and the speed by changing the time. The time is currently in millisecond but according to the release notes, they seem to be changing it to seconds.

They basically just trigger each other back and forth. It just needs an initial start.