How do i stop a sprite from shaking when following another sprite?

so i made a code in which, when the player comes in contact with another sprite, the other sprite will go towards the player and follow the player. but when this happens the sprite starts shaking violently. how do i fix this?

That depends on how you’re moving the other sprite. Can you provide a screen snip of the events that move the other sprite?

How are the Sprites collision box?

It won’t be the hitboxes. It’s more likely that the OP is moving the sprite by applying a force towards a given point on the player. The problem with doing that is the force tends to overshoot the position, and ends up yoyoing back and forth.

That’s what I suspect, but need a screen snip of the events to confirm.


this is my current code

i also found that slowing down the following force stops the shaking but it makes things look unrealistic

Here’s a post from last year that deals with the same issue, and a number of ways to fix it. Let us know if you need further help.