You can see that I limited it so it is not too far from its center in the final step. The problem is without the limitation it works but after adding the limit code, it isn’t working.
You’re updating First_X_Pos and First_Y_Pos every frame, so the limitation checks will never succeed. Put those two events under an At the beginning of the scene condition.
In the limitation checks, First_X_Pos and First_Y_Pos are not accessed correctly - you’re treating them like functions. Instead, use Circle.Variable(First_X_Pos) and Circle.Variable(First_Y_Pos). This is assuming there is only one Circle object in the scene, otherwise you’ll need to code it differently
You’ve now modified the limitation conditions from ‘>’ and ‘<’ to ‘=’. The values are fine, you just need to change the ‘=’ to the appropriate ‘<’ and ‘>’.
If you use forces, the positions will be decimal values with a large decimal place. The chance of it being exactly 5 pixels from the start is so incredibly tiny it’s non-existent.
Is there only 1 circle object in the scene? You can confirm this by looking at the instance list (this icon on the top right of the editor) and sorting them by name
If there is more than 1, remove the other circle objects.
If there is only 1, can you disable the limiting events, and see if that works? If it does, run the game in preview with debug, and check the value of First_X_Pos and First_Y_Pos in the debugger.
Have you tried using a tween? Set the duration to whatever you want. If it was moving further, I’d calculate the duration based on the distance to keep the speed consistent but this is only 10 pixels.
If you mean TravelToRandom position, I installed it. But couldn’t access it in behavior inspector. I accessed it through the events sheet. It wanted the pathfinder behavior and asked to add it to the object. After I added it, it works but still, I can’t limit the circle movement.
The problem is that the circle gets outside the +/-5 pixel box around the original position, and doesn’t get back. So it’s forces are always stopped. The following addition to the limiting events should fix your problem:
I’m not at my PC. Add a sprite called Circle. Add the tween behavior to it and these events. If you’re not sure where an expretis just type the first few letters.