How would I keep a marker2d in front of patrolling enemy?

Godot Version

4.3

Question

I don’t have any code to post, just not sure how this works. I’m working in a 2d platformer where the enemy patrols, then will chase the player until getting within shooting range. I have a marker2d in my enemy scene which sets where projectiles spawn, the issue is when the enemy turns around the marker stays at the same place relative to the enemy, so while projectiles shoot fine towards the left, they spawn behind the enemy when they shoot right, my initial thought was to just make two markers, one for each side and disable left when facing right and vice versa, but I figured I would ask here because I assume there is a better way to do this as I’m still pretty new. Sorry if this is a common question, I wasn’t sure what to search.

When the enemy turns around, which of the nodes of the enemy do you flip?
If you set the enemy sprite scale.x to -1 to turn it around, you can make the marker a child of the sprite so it flips around with the enemy sprite.

If you’re flipping your enemy another way, what you have to do is to just reposition the marker2d once the enemy is flipped.

Ah that makes sense, I’ve just been enabling flip_h in the animation player depending on the animation but it definitely sounds like a better idea to do it that way, thank you. Just out of curiosity are there other benefits for using scale over flip_h?

Using scale, you can run into some issues with the children of the node as they will also be flipped.