[SOLVED] How do I make an object stopped after reaching a certain distance from another object and won't move again if the other object is moving?

For example: A van is moving toward the player and stopped at 200 pixels away from the player. If the player moves, it moves, too. How do I stop the van from keep moving?

You need to use a variable that stores whether or not the van reached the player. So:
If ReachedThePlayer==False
If distance over 200 pixels: move van

If distance under or equals 200 pixels: ReachedThePlayer set to True
and stop the van.


1 Like

It worked! Thanks a lot!