How do I change the position of a position2d based on the mouse position

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

I want my character to fire from the muzzle for when the gun sprite is flipped left and right. He’s only firing on the right side from the muzzle and if someone can help me, Please help

Here’s the code


if global_position.x > get_global_mouse_position().x:
	$Glock/glock/Position2D.scale.y = 1
	$Glock/glock.scale.y = -0.5
	
else:
	$Glock/glock/Position2D.scale.y = 1
	$Glock/glock.scale.y = 0.5
	
	

If anybody needs more info to help me solve the problem tell me.

:bust_in_silhouette: Reply From: SteveSmith

You are changing the scale, not the position.