Flipping across an axis for a weapon under a player Node

Godot Version

4.3

Question

Hi! I recently came across a problem where I want to be able to flip my character and weapon when the character faces left. I can do this easily for the player by using the flip_h method, but I can’t do that with the weapon because it flips across the middle of the weapon not the x axis. I was thinking of making the weapon sprite share the same sprite2D as the character but I want to be able to change the weapon sprite to be different weapons so this solution wouldn’t work. Any ideas?
image

Hi! I see maybe a couple of ways to handle this.

  • Making both sprites children of a parent node, and you flip the parent node (scale.x = -scale.x)
  • Moving the pivot of the sword to x=0 of the parent node and flip_h as usual. I’m unsure if this one will be useful for you in every case.

Have you tried some of these alternatives?