Help with moving an enemy patrolling back and forth with markers/empty game objects like Unity

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JayH

Hi,

In Unity for moving enemies that are patrolling left and right, I would normally set two markers for the left-most and right-most transforms, allowing me to reverse them when the enemy has reached those positions.

All the tutorials for Godot that I’ve seen appear to focus on raycasts when the enemy reaches the end of a platform, or reversing direction when reaching a wall.

My enemies are on a long platform, but never reach the ends (they patrol a short distance), plus there are no walls for them to collide with either.

Can somone help show me how to use some form of markers with transfroms please?

Perhaps I could use the RemoteTransform Node instead of an empty game object like in Unity?

Thanks.

:bust_in_silhouette: Reply From: SleepyTom

Hi in unity i would use empty game objects as the left and right markers, but in Godot I use a separate Node2D with attached area2d objects that detect a collision and then flip the colliding object.